{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# ELAIS-N2 master catalogue\n", "## Preparation of Isaac Newton Telescope / Wide Field Camera (INT/WFC) data\n", "\n", "Isaac Newton Telescope / Wide Field Camera (INT/WFC) catalogue: the catalogue comes from `dmu0_INTWFC`.\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 apertude 4 ($1.2 * \\sqrt{2}$ arcsec = 1.7 arcsec).\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": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "This notebook was run with herschelhelp_internal version: \n", "44f1ae0 (Thu Nov 30 18:27:54 2017 +0000)\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": false }, "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 = \"wfc_ra\"\n", "DEC_COL = \"wfc_dec\"" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## I - Column selection" ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "collapsed": false }, "outputs": [], "source": [ "imported_columns = OrderedDict({\n", " 'id': \"wfc_id\",\n", " 'ra': \"wfc_ra\",\n", " 'decl': \"wfc_dec\",\n", " 'pstar': \"wfc_stellarity\",\n", " 'umag4': \"m_ap_wfc_u\", \n", " 'uemag4': \"merr_ap_wfc_u\", \n", " 'ukronmag': \"m_wfc_u\", \n", " 'uekronmag': \"merr_wfc_u\",\n", " 'gmag4': \"m_ap_wfc_g\", \n", " 'gemag4': \"merr_ap_wfc_g\", \n", " 'gkronmag': \"m_wfc_g\", \n", " 'gekronmag': \"merr_wfc_g\",\n", " 'rmag4': \"m_ap_wfc_r\", \n", " 'remag4': \"merr_ap_wfc_r\", \n", " 'rkronmag': \"m_wfc_r\", \n", " 'rekronmag': \"merr_wfc_r\",\n", " 'imag4': \"m_ap_wfc_i\", \n", " 'iemag4': \"merr_ap_wfc_i\", \n", " 'ikronmag': \"m_wfc_i\", \n", " 'iekronmag': \"merr_wfc_i\",\n", " 'zmag4': \"m_ap_wfc_z\", \n", " 'zemag4': \"merr_ap_wfc_z\", \n", " 'zkronmag': \"m_wfc_z\", \n", " 'zekronmag': \"merr_wfc_z\"\n", " })\n", "\n", "\n", "catalogue = Table.read(\"../../dmu0/dmu0_INTWFC/data/en2_intwfc_v2.1_HELP_coverage.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": { "collapsed": false }, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "/opt/anaconda3/envs/herschelhelp_internal/lib/python3.6/site-packages/ipykernel/__main__.py:8: RuntimeWarning: invalid value encountered in less_equal\n", "/opt/anaconda3/envs/herschelhelp_internal/lib/python3.6/site-packages/ipykernel/__main__.py:9: RuntimeWarning: invalid value encountered in less_equal\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", "\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": 6, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/html": [ "<Table length=10>\n", "
idx | wfc_id | wfc_ra | wfc_dec | wfc_stellarity | m_ap_wfc_u | merr_ap_wfc_u | m_wfc_u | merr_wfc_u | m_ap_wfc_g | merr_ap_wfc_g | m_wfc_g | merr_wfc_g | m_ap_wfc_r | merr_ap_wfc_r | m_wfc_r | merr_wfc_r | m_ap_wfc_i | merr_ap_wfc_i | m_wfc_i | merr_wfc_i | m_ap_wfc_z | merr_ap_wfc_z | m_wfc_z | merr_wfc_z | f_ap_wfc_u | ferr_ap_wfc_u | f_wfc_u | ferr_wfc_u | flag_wfc_u | f_ap_wfc_g | ferr_ap_wfc_g | f_wfc_g | ferr_wfc_g | flag_wfc_g | f_ap_wfc_r | ferr_ap_wfc_r | f_wfc_r | ferr_wfc_r | flag_wfc_r | f_ap_wfc_i | ferr_ap_wfc_i | f_wfc_i | ferr_wfc_i | flag_wfc_i | f_ap_wfc_z | ferr_ap_wfc_z | f_wfc_z | ferr_wfc_z | flag_wfc_z |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | 220090401629 | 250.877744918 | 40.668194985 | 0.0 | nan | nan | nan | nan | 14.94 | 0.022 | 13.824 | 0.022 | 14.75 | 0.016 | 13.138 | 0.016 | 14.271 | 0.019 | 13.147 | 0.019 | 13.072 | 0.034 | 12.912 | 0.034 | nan | nan | nan | nan | False | 3837.07 | 77.7497 | 10725.1 | 217.3191607 | False | 4570.88 | 67.359 | 20174.4 | 297.300547361 | False | 7105.59 | 124.345 | 20007.8 | 350.129693747 | False | 21438.8 | 671.35867849 | 24842.8 | 777.955 | False |
1 | 220090400005 | 251.140122498 | 40.561597886 | 0.9 | nan | nan | nan | nan | nan | nan | nan | nan | 23.754 | 0.214 | 23.792 | 0.162 | nan | nan | nan | nan | nan | nan | nan | nan | nan | nan | nan | nan | False | nan | nan | nan | nan | False | 1.14393 | 0.22547 | 1.10459 | 0.16481272155 | False | nan | nan | nan | nan | False | nan | nan | nan | nan | False |
2 | 220090400006 | 251.142009921 | 40.668052582 | 0.9 | nan | nan | nan | nan | nan | nan | nan | nan | 23.148 | 0.123 | 23.271 | 0.136 | nan | nan | nan | nan | nan | nan | nan | nan | nan | nan | nan | nan | False | nan | nan | nan | nan | False | 1.99894 | 0.226454 | 1.78484 | 0.223570441449 | False | nan | nan | nan | nan | False | nan | nan | nan | nan | False |
3 | 220090400008 | 251.141667299 | 40.650407151 | 0.0030764 | nan | nan | nan | nan | 23.622 | 0.108 | 23.744 | 0.12 | 22.276 | 0.057 | 22.418 | 0.06 | 21.857 | 0.064 | 21.919 | 0.083 | 21.451 | 0.144 | 21.017 | 0.18 | nan | nan | nan | nan | False | 1.29181 | 0.128499 | 1.15452 | 0.127601801978 | False | 4.46272 | 0.234288 | 3.91562 | 0.216384969463 | False | 6.56447 | 0.38695 | 6.20011 | 0.473972507734 | False | 9.54113 | 1.26543006627 | 14.2298 | 2.35911 | False |
4 | 220090400010 | 251.140739806 | 40.60508903 | 0.05 | nan | nan | nan | nan | nan | nan | nan | nan | 23.288 | 0.14 | 23.404 | 0.155 | nan | nan | nan | nan | nan | nan | nan | nan | nan | nan | nan | nan | False | nan | nan | nan | nan | False | 1.75711 | 0.22657 | 1.57907 | 0.225427758664 | False | nan | nan | nan | nan | False | nan | nan | nan | nan | False |
5 | 220090400014 | 251.139932348 | 40.56474514 | 0.486486 | nan | nan | nan | nan | 22.999 | 0.069 | 23.163 | 0.077 | 22.516 | 0.07 | 22.549 | 0.081 | nan | nan | nan | nan | nan | nan | nan | nan | nan | nan | nan | nan | False | 2.29298 | 0.145722 | 1.97151 | 0.139819001106 | False | 3.57766 | 0.23066 | 3.47056 | 0.25891709538 | False | nan | nan | nan | nan | False | nan | nan | nan | nan | False |
6 | 220090400015 | 251.141682615 | 40.676937115 | 9.52581e-06 | nan | nan | nan | nan | 23.684 | 0.124 | 23.68 | 0.14 | 22.912 | 0.1 | 22.636 | 0.114 | 22.542 | 0.115 | 22.607 | 0.106 | 21.893 | 0.213 | 21.866 | 0.24 | nan | nan | nan | nan | False | 1.22011 | 0.139347 | 1.22462 | 0.157907793437 | False | 2.48428 | 0.22881 | 3.20332 | 0.336341545335 | False | 3.49301 | 0.369976 | 3.29003 | 0.321204103329 | False | 6.35039 | 1.24582043463 | 6.51029 | 1.43909 | False |
7 | 220090400016 | 251.138677381 | 40.532506444 | 0.00306748 | nan | nan | nan | nan | 23.549 | 0.11 | 22.952 | 0.106 | 23.269 | 0.138 | 23.003 | 0.137 | nan | nan | nan | nan | nan | nan | nan | nan | nan | nan | nan | nan | False | 1.38166 | 0.139981 | 2.39442 | 0.233766090787 | False | 1.78814 | 0.227277 | 2.28455 | 0.288267815904 | False | nan | nan | nan | nan | False | nan | nan | nan | nan | False |
8 | 220090400017 | 251.140099686 | 40.603390091 | 0.0524781 | nan | nan | nan | nan | 23.502 | 0.106 | 22.979 | 0.114 | 22.926 | 0.101 | 22.479 | 0.126 | 22.857 | 0.191 | 23.09 | 0.178 | nan | nan | nan | nan | nan | nan | nan | nan | False | 1.44278 | 0.140858 | 2.33561 | 0.245233698479 | False | 2.45245 | 0.228138 | 3.70169 | 0.429582057222 | False | 2.61336 | 0.459736 | 2.10863 | 0.345696951626 | False | nan | nan | nan | nan | False |
9 | 220090400004 | 251.139864428 | 40.546853548 | 0.944606 | nan | nan | nan | nan | nan | nan | nan | nan | 23.707 | 0.205 | 23.754 | 0.161 | 22.622 | 0.155 | 22.741 | 0.153 | 21.419 | 0.188 | 21.633 | 0.202 | nan | nan | nan | nan | False | nan | nan | nan | nan | False | 1.19454 | 0.225543 | 1.14393 | 0.169629625475 | False | 3.24489 | 0.463241 | 2.90804 | 0.409795590485 | False | 9.82652 | 1.70150494523 | 8.06864 | 1.50116 | False |