{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# XMM-13hr 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", "This notebook was executed on: \n", "2018-02-21 14:07:59.843473\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": [ "%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_XMM-13hr.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 | 459621206470 | 203.144709071 | 38.2140207744 | 0.00306749 | 19.3204 | 0.182334 | 19.8994 | 0.160211 | 67.8939 | 11.4018 | False | 39.8311 | 5.87747 |
1 | 459621206476 | 203.148579228 | 38.2101019679 | 0.993865 | 14.7341 | 0.00350534 | 14.728 | 0.00282313 | 4638.32 | 14.975 | False | 4664.54 | 12.1287 |
2 | 459621206478 | 203.224484006 | 38.2079822598 | 0.00306749 | 19.2365 | 0.182846 | 19.1677 | 0.0829127 | 73.3492 | 12.3526 | False | 78.1475 | 5.96777 |
3 | 459621206484 | 203.22022099 | 38.2055999748 | 0.00306749 | 20.3401 | 0.465671 | 19.8166 | 0.148913 | 26.5443 | 11.3848 | False | 42.9901 | 5.89625 |
4 | 459621206490 | 203.170785083 | 38.203062631 | 0.00306749 | 19.2261 | 0.167351 | 19.8507 | 0.153367 | 74.0582 | 11.415 | False | 41.6611 | 5.8849 |
5 | 459621206499 | 203.216362751 | 38.1991879254 | 0.00306749 | 20.2498 | 0.362802 | 20.1903 | 0.209289 | 28.8467 | 9.63919 | False | 30.4714 | 5.87374 |
6 | 459621206500 | 203.20391246 | 38.198962094 | 0.00306749 | 19.5233 | 0.220066 | 19.6835 | 0.13201 | 56.3232 | 11.4161 | False | 48.5971 | 5.90872 |
7 | 459621206505 | 203.200348742 | 38.1957272546 | 0.00306749 | 19.5455 | 0.212503 | 19.5379 | 0.115741 | 55.1813 | 10.8002 | False | 55.5703 | 5.92387 |
8 | 459621206510 | 203.191492816 | 38.1922951841 | 0.00306749 | 19.0041 | 0.182926 | 19.5416 | 0.116109 | 90.8547 | 15.3073 | False | 55.3821 | 5.92257 |
9 | 459621206511 | 203.190798042 | 38.1914094319 | 0.00306749 | 20.1108 | 0.285833 | 20.3322 | 0.238104 | 32.7843 | 8.63085 | False | 26.738 | 5.86368 |