{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# SA13 master catalogue\n", "## Preparation of UKIRT Hemisphere Survey (UHS) data\n", "\n", "The catalogue comes from `dmu0_UHS`. This is a J band only survey documented in https://arxiv.org/pdf/1707.09975.pdf\n", "\n", "In the catalogue, we keep:\n", "\n", "- The identifier (it's unique in the catalogue);\n", "- The position;\n", "- The stellarity;\n", "- The magnitude for each band in aperture 4 (2 arcsec aperture corrected).\n", "- The kron magnitude to be used as total magnitude (no “auto” magnitude is provided).\n", "\n", "We don't know when the maps have been observed. We will use the year of the reference paper." ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "This notebook was run with herschelhelp_internal version: \n", "0246c5d (Thu Jan 25 17:01:47 2018 +0000) [with local modifications]\n" ] } ], "source": [ "from herschelhelp_internal import git_version\n", "print(\"This notebook was run with herschelhelp_internal version: \\n{}\".format(git_version()))" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "collapsed": true }, "outputs": [], "source": [ "%matplotlib inline\n", "#%config InlineBackend.figure_format = 'svg'\n", "\n", "import matplotlib.pyplot as plt\n", "plt.rc('figure', figsize=(10, 6))\n", "\n", "from collections import OrderedDict\n", "import os\n", "\n", "from astropy import units as u\n", "from astropy.coordinates import SkyCoord\n", "from astropy.table import Column, Table\n", "import numpy as np\n", "\n", "from herschelhelp_internal.flagging import gaia_flag_column\n", "from herschelhelp_internal.masterlist import nb_astcor_diag_plot, remove_duplicates\n", "from herschelhelp_internal.utils import astrometric_correction, mag_to_flux" ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "collapsed": true }, "outputs": [], "source": [ "OUT_DIR = os.environ.get('TMP_DIR', \"./data_tmp\")\n", "try:\n", " os.makedirs(OUT_DIR)\n", "except FileExistsError:\n", " pass\n", "\n", "RA_COL = \"uhs_ra\"\n", "DEC_COL = \"uhs_dec\"" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## I - Column selection" ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "collapsed": true }, "outputs": [], "source": [ "imported_columns = OrderedDict({\n", " 'SOURCEID': \"uhs_id\",\n", " 'RA': \"uhs_ra\",\n", " 'DEC': \"uhs_dec\",\n", " 'PSTAR': \"uhs_stellarity\",\n", " 'JPETROMAG': \"m_ukidss_j\", \n", " 'JPETROMAGERR': \"merr_ukidss_j\", \n", " 'JAPERMAG4': \"m_ap_ukidss_j\", \n", " 'JAPERMAG4ERR': \"merr_ap_ukidss_j\", \n", "\n", " })\n", "\n", "\n", "catalogue = Table.read(\"../../dmu0/dmu0_UHS/data/UHS-DR1_SA13.fits\")[list(imported_columns)]\n", "for column in imported_columns:\n", " catalogue[column].name = imported_columns[column]\n", "\n", "epoch = 2011\n", "\n", "# Clean table metadata\n", "catalogue.meta = None" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "0.925175419285\n" ] } ], "source": [ "#Vega to AB\n", "#Vega ZPT (1548.66 Jy) from http://svo2.cab.inta-csic.es/svo/theory/fps3/index.php?id=UKIRT/WFCAM.J\n", "\n", "vega_to_ab = {\n", " \"j\": -2.5*np.log10(1548.66 / 3631)\n", "}\n", "print(vega_to_ab[\"j\"])" ] }, { "cell_type": "code", "execution_count": 6, "metadata": { "collapsed": true }, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "/opt/anaconda3/envs/herschelhelp_internal/lib/python3.6/site-packages/astropy/table/column.py:1096: MaskedArrayFutureWarning: setting an item on a masked array which has a shared mask will not copy the mask and also change the original mask array in the future.\n", "Check the NumPy 1.11 release notes for more information.\n", " ma.MaskedArray.__setitem__(self, index, value)\n" ] } ], "source": [ "# Adding flux and band-flag columns\n", "for col in catalogue.colnames:\n", " if col.startswith('m_'):\n", " \n", " errcol = \"merr{}\".format(col[1:])\n", " \n", " # Some object have a magnitude to 0, we suppose this means missing value\n", " catalogue[col][catalogue[col] <= 0] = np.nan\n", " catalogue[errcol][catalogue[errcol] <= 0] = np.nan \n", " \n", " # Convert magnitude from Vega to AB\n", " catalogue[col] += vega_to_ab[col[-1]]\n", "\n", " flux, error = mag_to_flux(np.array(catalogue[col]), np.array(catalogue[errcol]))\n", " \n", " # Fluxes are added in µJy\n", " catalogue.add_column(Column(flux * 1.e6, name=\"f{}\".format(col[1:])))\n", " catalogue.add_column(Column(error * 1.e6, name=\"f{}\".format(errcol[1:])))\n", " \n", " # Band-flag column\n", " if \"ap\" not in col:\n", " catalogue.add_column(Column(np.zeros(len(catalogue), dtype=bool), name=\"flag{}\".format(col[1:])))\n", " \n", "# TODO: Set to True the flag columns for fluxes that should not be used for SED fitting." ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [ { "data": { "text/html": [ "<Table masked=True length=10>\n", "
idx | uhs_id | uhs_ra | uhs_dec | uhs_stellarity | m_ukidss_j | merr_ukidss_j | m_ap_ukidss_j | merr_ap_ukidss_j | f_ukidss_j | ferr_ukidss_j | flag_ukidss_j | f_ap_ukidss_j | ferr_ap_ukidss_j |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
deg | deg | ||||||||||||
0 | 459663644456 | 198.255412692 | 42.4824223737 | 0.00306749 | 19.8065 | 0.164174 | 19.7825 | 0.144478 | 43.3903 | 6.56103 | False | 44.3627 | 5.9033 |
1 | 459663644470 | 198.251120083 | 42.4830960569 | 0.00306749 | 19.1719 | 0.206151 | 19.6732 | 0.130807 | 77.8433 | 14.7803 | False | 49.058 | 5.91038 |
2 | 459663644475 | 198.24589601 | 42.480507192 | 0.00306749 | 19.1551 | 0.172944 | 19.541 | 0.115851 | 79.061 | 12.5934 | False | 55.4101 | 5.91241 |
3 | 459663644479 | 198.241936578 | 42.4836517333 | 0.00306749 | 19.4274 | 0.201662 | 19.8643 | 0.155373 | 61.521 | 11.4268 | False | 41.1415 | 5.8875 |
4 | 459663644482 | 198.239128913 | 42.4797628027 | 0.00306749 | 20.5322 | 0.419988 | 20.3444 | 0.240042 | 22.2402 | 8.60301 | False | 26.4388 | 5.84526 |
5 | 459663644485 | 198.237188029 | 42.4813011991 | 0.993865 | 18.4819 | 0.066625 | 18.4972 | 0.0456044 | 146.98 | 9.01927 | False | 144.918 | 6.08704 |
6 | 459663644498 | 198.226213605 | 42.5014211002 | 0.00306749 | 17.9949 | 0.0742216 | 18.1854 | 0.0350844 | 230.163 | 15.7341 | False | 193.118 | 6.24041 |
7 | 459663644504 | 198.22152688 | 42.5002516541 | 0.00306749 | 20.4897 | 0.456323 | 20.077 | 0.190187 | 23.1262 | 9.71967 | False | 33.8228 | 5.9247 |
8 | 459663644510 | 198.216449974 | 42.4790017216 | 0.00306749 | 20.1221 | 0.322585 | 20.0747 | 0.188047 | 32.4472 | 9.64045 | False | 33.8949 | 5.87051 |
9 | 459663644517 | 198.212471013 | 42.4847520334 | 0.00306749 | 19.6251 | 0.258985 | 19.6486 | 0.128127 | 51.2835 | 12.2329 | False | 50.1846 | 5.92227 |