{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Selecting columns of CS82\n", "\n", "We want to publish the CS82 catalog through VO.\n", "To publish it in VO we will use DaCHS, which pretty much is an interface to a (Postgres) database.\n", "Although DaCHS does a great job on data management, ingesting a ~million entries + dozens columns catalog can be\n", "quite slow, so we want to improve this step.\n", "\n", "The way we will \"improve\" the data ingestion is by reducing the amount of data to ingest: all entries (rows) will be ingested, but most probably some columns are not really usefull (for our purposes) and we may avoid them.\n", "\n", "This note, then, is a superficial investigation of CS82 data and metadata features." ] }, { "cell_type": "code", "execution_count": 19, "metadata": {}, "outputs": [], "source": [ "filename = 'cs82_phz.fits'" ] }, { "cell_type": "code", "execution_count": 20, "metadata": {}, "outputs": [], "source": [ "from importlib import reload" ] }, { "cell_type": "code", "execution_count": 21, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "" ] }, "execution_count": 21, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# from emptyspace\n", "import table\n", "reload(table)" ] }, { "cell_type": "code", "execution_count": 22, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Help on package table:\n", "\n", "NAME\n", " table\n", "\n", "PACKAGE CONTENTS\n", " acolumn\n", " adataframe\n", " ametatable\n", " atable\n", " io (package)\n", " ucd (package)\n", " utils (package)\n", "\n", "FUNCTIONS\n", " info(filename)\n", " (FITS only) Print the list columns and table's metadata\n", " \n", " read(filename, format=None, columns=None, rows=None, ucds=None, metatable=None, metaonly=False, **kwargs)\n", " Return ~ATable from catalog 'filename'\n", " \n", " Input:\n", " - filename : string\n", " - format : string : 'fits','ecsv','csv'\n", " - columns : list of strings or integers\n", " - rows : integer, float, list of integers\n", " - ucds : list of strings\n", " - metatable : string : name of the metatable file\n", " - metaonly : boolean\n", "\n", "DATA\n", " absolute_import = _Feature((2, 5, 0, 'alpha', 1), (3, 0, 0, 'alpha', 0...\n", "\n", "FILE\n", " /home/chbrandt/Dropbox/PhD/code_repositories/emptyspace/table/__init__.py\n", "\n", "\n" ] } ], "source": [ "help(table)" ] }, { "cell_type": "code", "execution_count": 23, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", " file: cs82_phz.fits\n", " extension: 1\n", " type: BINARY_TBL\n", " extname: Joined\n", " rows: 5777379\n", " column info:\n", " OBJID_CS82 i4 \n", " RA f8 \n", " DEC f8 \n", " FLAGS i2 \n", " WEIGHT f4 \n", " FITCLASS i2 \n", " MAG_AUTO f4 \n", " MAGERR_AUTO f4 \n", " MAG_EXP f4 \n", " MAG_PSF f4 \n", " REFF_EXP f8 \n", " ASPECT_EXP f4 \n", " MU_MEAN_EXP f8 \n", " P_EXP f4 \n", " N_SER f4 \n", " SPREAD_MODEL_SER\n", " f4 \n", " LENS i2 \n", " OBJID_SDSS i8 \n", " MAG_DERED_U f8 \n", " MAG_DERED_G f8 \n", " MAG_DERED_R f8 \n", " MAG_DERED_I f8 \n", " MAG_DERED_Z f8 \n", " ZSPEC f8 \n", " ZPHOT f8 \n", " ZMORPH f8 \n", " ZBEST f8 \n", " ODDS_PHOT f8 \n", " ODDS_MORPH f8 \n", " ODDS_BEST f8 \n", " SOURCE_SPEC S7 \n", " CLASS_SPEC S6 \n", "None\n" ] }, { "data": { "text/plain": [ "" ] }, "execution_count": 23, "metadata": {}, "output_type": "execute_result" } ], "source": [ "table.info(filename)" ] }, { "cell_type": "code", "execution_count": 25, "metadata": {}, "outputs": [], "source": [ "cols = 'OBJID_CS82,RA,DEC,MAG_AUTO,MAGERR_AUTO'.split(',')\n", "cat = table.read(filename, columns=cols)" ] }, { "cell_type": "code", "execution_count": 26, "metadata": {}, "outputs": [], "source": [ "cat.write('cs82_phz_REDUCED.fits', format='fits')" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.5.4" } }, "nbformat": 4, "nbformat_minor": 2 }