{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Write speczs to the VO\n", "\n", "Perform some minor changes to the tables so that they can be ingested to the VO." ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "This notebook was run with herschelhelp_internal version: \n", "017bb1e (Mon Jun 18 14:58:59 2018 +0100)\n", "This notebook was executed on: \n", "2018-07-20 12:52:12.810625\n" ] } ], "source": [ "from herschelhelp_internal import git_version\n", "print(\"This notebook was run with herschelhelp_internal version: \\n{}\".format(git_version()))\n", "import datetime\n", "print(\"This notebook was executed on: \\n{}\".format(datetime.datetime.now()))" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "collapsed": true }, "outputs": [], "source": [ "from astropy.table import Table, Column\n", "from herschelhelp_internal.utils import coords_to_hpidx, gen_help_id\n", "\n", "import numpy as np" ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "collapsed": true }, "outputs": [], "source": [ "vo_folder = '/mnt/hedam/data_vo/specz/'\n", "#vo_folder = '/Users/rs548/GitHub/gavo_inputs/specz/data/'" ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "collapsed": true }, "outputs": [], "source": [ "def convert_specz(original, field, vo_folder):\n", " new = Table.read(original)\n", " new['RA'].name = 'ra'\n", " new['DEC'].name = 'dec'\n", " new['Z_SPEC'].name = 'z_spec'\n", " new['Z_SOURCE'].name = 'z_source'\n", " new['Z_QUAL'].name = 'z_qual'\n", " new['REL'].name = 'z_rel'\n", " new['OBJID'].name = 'objid'\n", " new['AGN'].name = 'agn_flag'\n", " new.add_column(Column(np.char.replace(np.array(gen_help_id(nep['ra'], nep['dec']), dtype=np.string_), b'HELP', b'HELP_SPECZ'),\n", " name=\"specz_id\"))\n", " new.add_column(Column(np.full(len(new), field, dtype='