{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# EGS master catalogue\n", "## Preparation of Canada France Hawaii Telescope Legacy Survey (CFHTLS) data\n", "\n", "The catalogue is in `dmu0_CFHTLS`.\n", "\n", "In the catalogue, we keep:\n", "\n", "- The position;\n", "- The stellarity (g band stellarity);\n", "- The aperture magnitude (3 arcsec).\n", "- The total magnitude (Kron like aperture magnitude).\n", "\n", "We use the 2007 release, which we take as the date." ] }, { "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-07 19:29:17.397499\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 = \"cfhtls-deep_ra\"\n", "DEC_COL = \"cfhtls-deep_dec\"" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## I - Column selection" ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "collapsed": true }, "outputs": [], "source": [ "imported_columns = OrderedDict({\n", " 'cfhtls': \"cfhtls-deep_id\",\n", " 'raj2000': \"cfhtls-deep_ra\",\n", " 'dej2000': \"cfhtls-deep_dec\",\n", " 'gcl': \"cfhtls-deep_stellarity\",\n", " 'umaga': \"m_cfhtls-deep_u\",\n", " 'e_umaga': \"merr_cfhtls-deep_u\",\n", " 'gmaga': \"m_cfhtls-deep_g\",\n", " 'e_gmaga': \"merr_cfhtls-deep_g\",\n", " 'rmaga': \"m_cfhtls-deep_r\",\n", " 'e_rmaga': \"merr_cfhtls-deep_r\",\n", " 'imaga': \"m_cfhtls-deep_i\",\n", " 'e_imaga': \"merr_cfhtls-deep_i\",\n", " 'zmaga': \"m_cfhtls-deep_z\",\n", " 'e_zmaga': \"merr_cfhtls-deep_z\",\n", " 'umag': \"m_ap_cfhtls-deep_u\",\n", " 'e_umag': \"merr_ap_cfhtls-deep_u\",\n", " 'gmag': \"m_ap_cfhtls-deep_g\",\n", " 'e_gmag': \"merr_ap_cfhtls-deep_g\",\n", " 'rmag': \"m_ap_cfhtls-deep_r\",\n", " 'e_rmag': \"merr_ap_cfhtls-deep_r\",\n", " 'imag': \"m_ap_cfhtls-deep_i\",\n", " 'e_imag': \"merr_ap_cfhtls-deep_i\",\n", " 'zmag': \"m_ap_cfhtls-deep_z\",\n", " 'e_zmag': \"merr_ap_cfhtls-deep_z\"\n", " \n", " })\n", "\n", "\n", "catalogue = Table.read(\"../../dmu0/dmu0_CFHTLS/data/CFHTLS-DEEP_EGS.fits\")[list(imported_columns)]\n", "for column in imported_columns:\n", " catalogue[column].name = imported_columns[column]\n", "\n", "epoch = 2007\n", "\n", "# Clean table metadata\n", "catalogue.meta = None" ] }, { "cell_type": "code", "execution_count": 5, "metadata": { "collapsed": true }, "outputs": [], "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", " #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": {}, "outputs": [ { "data": { "text/html": [ "<Table masked=True length=10>\n", "
idx | cfhtls-deep_id | cfhtls-deep_ra | cfhtls-deep_dec | cfhtls-deep_stellarity | m_cfhtls-deep_u | merr_cfhtls-deep_u | m_cfhtls-deep_g | merr_cfhtls-deep_g | m_cfhtls-deep_r | merr_cfhtls-deep_r | m_cfhtls-deep_i | merr_cfhtls-deep_i | m_cfhtls-deep_z | merr_cfhtls-deep_z | m_ap_cfhtls-deep_u | merr_ap_cfhtls-deep_u | m_ap_cfhtls-deep_g | merr_ap_cfhtls-deep_g | m_ap_cfhtls-deep_r | merr_ap_cfhtls-deep_r | m_ap_cfhtls-deep_i | merr_ap_cfhtls-deep_i | m_ap_cfhtls-deep_z | merr_ap_cfhtls-deep_z | f_cfhtls-deep_u | ferr_cfhtls-deep_u | flag_cfhtls-deep_u | f_cfhtls-deep_g | ferr_cfhtls-deep_g | flag_cfhtls-deep_g | f_cfhtls-deep_r | ferr_cfhtls-deep_r | flag_cfhtls-deep_r | f_cfhtls-deep_i | ferr_cfhtls-deep_i | flag_cfhtls-deep_i | f_cfhtls-deep_z | ferr_cfhtls-deep_z | flag_cfhtls-deep_z | f_ap_cfhtls-deep_u | ferr_ap_cfhtls-deep_u | f_ap_cfhtls-deep_g | ferr_ap_cfhtls-deep_g | f_ap_cfhtls-deep_r | ferr_ap_cfhtls-deep_r | f_ap_cfhtls-deep_i | ferr_ap_cfhtls-deep_i | f_ap_cfhtls-deep_z | ferr_ap_cfhtls-deep_z |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
deg | deg | mag | mag | mag | mag | mag | mag | mag | mag | mag | mag | mag | mag | mag | mag | mag | mag | mag | mag | mag | mag | ||||||||||||||||||||||||||||
0 | 0300_0574781 | 215.691082 | 53.132557 | 0.02 | 24.795 | 0.134 | nan | nan | 26.67 | 2.905 | 25.077 | 0.617 | 23.376 | 0.389 | 24.834 | 0.137 | nan | nan | 26.501 | 2.452 | 24.993 | 0.562 | 23.402 | 0.392 | 0.43853 | 0.0541228 | False | nan | nan | False | 0.077983 | 0.208652 | False | 0.338221 | 0.192203 | False | 1.62032 | 0.580531 | False | 0.423058 | 0.0533822 | nan | nan | 0.0911171 | 0.205777 | 0.365426 | 0.189152 | 1.58198 | 0.571165 |
1 | 0300_0574432 | 215.689507 | 53.132034 | 0.58 | 26.075 | 0.406 | 26.047 | 0.463 | 25.314 | 0.346 | 24.811 | 0.387 | 23.122 | 0.194 | 26.107 | 0.417 | 25.985 | 0.436 | 25.285 | 0.334 | 24.811 | 0.386 | 23.139 | 0.197 | 0.134896 | 0.050443 | False | 0.13842 | 0.0590278 | False | 0.271894 | 0.0866467 | False | 0.432115 | 0.154023 | False | 2.04739 | 0.365828 | False | 0.130978 | 0.050305 | 0.146555 | 0.058852 | 0.279254 | 0.0859057 | 0.432115 | 0.153625 | 2.01558 | 0.365714 |
2 | 0300_0575128 | 215.691012 | 53.130966 | 0.98 | 20.451 | 0.004 | 19.163 | 0.005 | 18.32 | 0.002 | 18.077 | 0.002 | 17.94 | 0.004 | 20.491 | 0.003 | 19.174 | 0.004 | 18.342 | 0.002 | 18.101 | 0.001 | 17.966 | 0.003 | 23.9662 | 0.0882948 | False | 78.4874 | 0.361448 | False | 170.608 | 0.314272 | False | 213.403 | 0.393102 | False | 242.103 | 0.891939 | False | 23.0994 | 0.0638259 | 77.6962 | 0.286243 | 167.186 | 0.307968 | 208.737 | 0.192254 | 236.374 | 0.653126 |
3 | 0300_0572283 | 215.68919 | 53.128688 | 0.86 | 27.156 | 1.087 | 26.328 | 0.522 | nan | nan | 26.417 | 1.489 | 24.672 | 0.731 | 27.172 | 1.099 | 26.325 | 0.517 | nan | nan | 26.283 | 1.309 | 24.702 | 0.747 | 0.0498425 | 0.0499005 | False | 0.106856 | 0.0513743 | False | nan | nan | False | 0.0984464 | 0.135011 | False | 0.491133 | 0.330668 | False | 0.0491133 | 0.0497133 | 0.107152 | 0.051023 | nan | nan | 0.111378 | 0.134281 | 0.477749 | 0.328698 |
4 | 0300_0571771 | 215.69 | 53.127889 | 0.64 | 27.297 | 1.227 | nan | nan | nan | nan | nan | nan | nan | nan | 27.076 | 1.018 | nan | nan | nan | nan | nan | nan | nan | nan | 0.0437723 | 0.0494675 | False | nan | nan | False | nan | nan | False | nan | nan | False | nan | nan | False | 0.0536537 | 0.0503064 | nan | nan | nan | nan | nan | nan | nan | nan |
5 | 0300_0571613 | 215.687279 | 53.12726 | 0.95 | 24.655 | 0.061 | 24.215 | 0.039 | 24.133 | 0.06 | 23.446 | 0.051 | 23.189 | 0.098 | 24.693 | 0.056 | 24.235 | 0.036 | 24.129 | 0.053 | 23.469 | 0.046 | 23.226 | 0.089 | 0.498884 | 0.0280288 | False | 0.748169 | 0.0268745 | False | 0.806864 | 0.0445889 | False | 1.51915 | 0.0713585 | False | 1.92486 | 0.173741 | False | 0.481725 | 0.0248464 | 0.734513 | 0.0243544 | 0.809842 | 0.0395323 | 1.4873 | 0.0630135 | 1.86037 | 0.152499 |
6 | 0300_0571954 | 215.686341 | 53.128158 | 0.62 | 26.402 | 0.247 | 26.037 | 0.16 | 26.228 | 0.308 | 26.046 | 0.409 | 27.278 | 3.122 | 26.407 | 0.248 | 26.032 | 0.159 | 26.177 | 0.293 | 26.063 | 0.415 | 27.07 | 2.572 | 0.0998159 | 0.0227077 | False | 0.139701 | 0.0205871 | False | 0.117165 | 0.0332373 | False | 0.138548 | 0.0521914 | False | 0.0445451 | 0.128088 | False | 0.0993574 | 0.0226949 | 0.140346 | 0.0205529 | 0.1228 | 0.0331393 | 0.136395 | 0.0521343 | 0.053951 | 0.127805 |
7 | 0300_0572142 | 215.684233 | 53.128497 | 0.42 | 26.608 | 0.306 | 26.026 | 0.155 | 26.195 | 0.27 | 25.33 | 0.182 | 25.666 | 0.633 | 26.654 | 0.262 | 26.038 | 0.13 | 26.101 | 0.204 | 25.452 | 0.167 | 25.636 | 0.511 | 0.0825658 | 0.02327 | False | 0.141124 | 0.0201469 | False | 0.120781 | 0.0300358 | False | 0.267917 | 0.0449104 | False | 0.196607 | 0.114625 | False | 0.0791408 | 0.0190975 | 0.139572 | 0.0167116 | 0.131704 | 0.024746 | 0.239442 | 0.0368292 | 0.202116 | 0.0951255 |
8 | 0300_0571608 | 215.685291 | 53.127668 | 0.72 | 25.695 | 0.125 | 25.006 | 0.053 | 25.19 | 0.101 | 24.543 | 0.087 | 24.048 | 0.137 | 25.726 | 0.129 | 25.007 | 0.054 | 25.19 | 0.101 | 24.562 | 0.089 | 24.046 | 0.136 | 0.191426 | 0.0220387 | False | 0.361077 | 0.0176259 | False | 0.304789 | 0.0283529 | False | 0.553096 | 0.0443195 | False | 0.872569 | 0.110102 | False | 0.186037 | 0.0221037 | 0.360745 | 0.0179419 | 0.304789 | 0.0283529 | 0.5435 | 0.0445518 | 0.874178 | 0.1095 |
9 | 0300_0571901 | 215.684543 | 53.127605 | 0.7 | 26.924 | 0.386 | 25.119 | 0.062 | 23.971 | 0.033 | 22.114 | 0.009 | 21.355 | 0.011 | 26.827 | 0.323 | 25.137 | 0.058 | 23.983 | 0.03 | 22.134 | 0.008 | 21.37 | 0.011 | 0.0617163 | 0.0219413 | False | 0.325387 | 0.0185809 | False | 0.936698 | 0.0284701 | False | 5.18084 | 0.0429455 | False | 10.4232 | 0.105601 | False | 0.0674838 | 0.020076 | 0.320037 | 0.0170964 | 0.926403 | 0.0255974 | 5.08627 | 0.037477 | 10.2802 | 0.104152 |