{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# GAMA-09 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", "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": 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_ra\"\n", "DEC_COL = \"cfhtls_dec\"" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## I - Column selection" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [], "source": [ "imported_columns = OrderedDict({\n", " 'cfhtls': \"cfhtls_id\",\n", " 'raj2000': \"cfhtls_ra\",\n", " 'dej2000': \"cfhtls_dec\",\n", " 'gcl': \"cfhtls_stellarity\",\n", " 'umaga': \"m_cfhtls_u\",\n", " 'e_umaga': \"merr_cfhtls_u\",\n", " 'gmaga': \"m_cfhtls_g\",\n", " 'e_gmaga': \"merr_cfhtls_g\",\n", " 'rmaga': \"m_cfhtls_r\",\n", " 'e_rmaga': \"merr_cfhtls_r\",\n", " 'imaga': \"m_cfhtls_i\",\n", " 'e_imaga': \"merr_cfhtls_i\",\n", " 'zmaga': \"m_cfhtls_z\",\n", " 'e_zmaga': \"merr_cfhtls_z\",\n", " 'umag': \"m_ap_cfhtls_u\",\n", " 'e_umag': \"merr_ap_cfhtls_u\",\n", " 'gmag': \"m_ap_cfhtls_g\",\n", " 'e_gmag': \"merr_ap_cfhtls_g\",\n", " 'rmag': \"m_ap_cfhtls_r\",\n", " 'e_rmag': \"merr_ap_cfhtls_r\",\n", " 'imag': \"m_ap_cfhtls_i\",\n", " 'e_imag': \"merr_ap_cfhtls_i\",\n", " 'zmag': \"m_ap_cfhtls_z\",\n", " 'e_zmag': \"merr_ap_cfhtls_z\"\n", " \n", " })\n", "\n", "\n", "catalogue = Table.read(\"../../dmu0/dmu0_CFHTLS/data/CFHTLS-WIDE_GAMA-09.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": {}, "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_id | cfhtls_ra | cfhtls_dec | cfhtls_stellarity | m_cfhtls_u | merr_cfhtls_u | m_cfhtls_g | merr_cfhtls_g | m_cfhtls_r | merr_cfhtls_r | m_cfhtls_i | merr_cfhtls_i | m_cfhtls_z | merr_cfhtls_z | m_ap_cfhtls_u | merr_ap_cfhtls_u | m_ap_cfhtls_g | merr_ap_cfhtls_g | m_ap_cfhtls_r | merr_ap_cfhtls_r | m_ap_cfhtls_i | merr_ap_cfhtls_i | m_ap_cfhtls_z | merr_ap_cfhtls_z | f_cfhtls_u | ferr_cfhtls_u | flag_cfhtls_u | f_cfhtls_g | ferr_cfhtls_g | flag_cfhtls_g | f_cfhtls_r | ferr_cfhtls_r | flag_cfhtls_r | f_cfhtls_i | ferr_cfhtls_i | flag_cfhtls_i | f_cfhtls_z | ferr_cfhtls_z | flag_cfhtls_z | f_ap_cfhtls_u | ferr_ap_cfhtls_u | f_ap_cfhtls_g | ferr_ap_cfhtls_g | f_ap_cfhtls_r | ferr_ap_cfhtls_r | f_ap_cfhtls_i | ferr_ap_cfhtls_i | f_ap_cfhtls_z | ferr_ap_cfhtls_z |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
deg | deg | mag | mag | mag | mag | mag | mag | mag | mag | mag | mag | mag | mag | mag | mag | mag | mag | mag | mag | mag | mag | ||||||||||||||||||||||||||||
0 | 1210_186805 | 132.065848 | -2.124048 | 0.46 | 25.672 | 0.342 | 25.966 | 0.308 | 25.894 | 0.498 | 26.192 | 0.976 | nan | nan | 25.645 | 0.334 | 25.933 | 0.299 | 25.807 | 0.459 | 26.09 | 0.887 | nan | nan | 0.195524 | 0.0615888 | False | 0.149142 | 0.0423084 | False | 0.159368 | 0.073098 | False | 0.121116 | 0.108874 | False | nan | nan | False | 0.200447 | 0.0616626 | 0.153744 | 0.0423396 | 0.172663 | 0.0729942 | 0.133045 | 0.108692 | nan | nan |
1 | 1210_186722 | 132.067068 | -2.124444 | 0.71 | 26.72 | 0.949 | 25.719 | 0.261 | 25.556 | 0.39 | nan | nan | 25.095 | 1.016 | 26.618 | 0.809 | 25.957 | 0.304 | 25.66 | 0.402 | 26.446 | 1.233 | 25.017 | 0.883 | 0.0744732 | 0.0650942 | False | 0.187241 | 0.0450107 | False | 0.21757 | 0.078152 | False | nan | nan | False | 0.33266 | 0.311293 | False | 0.0818088 | 0.0609571 | 0.150383 | 0.0421064 | 0.197697 | 0.0731984 | 0.0958518 | 0.108853 | 0.357437 | 0.290694 |
2 | 1210_186926 | 132.066104 | -2.123557 | 0.6 | 26.8 | 1.056 | 26.335 | 0.475 | 25.373 | 0.338 | 24.796 | 0.297 | nan | nan | 26.299 | 0.607 | 26.306 | 0.419 | 25.361 | 0.304 | 25.072 | 0.347 | 26.673 | 4.065 | 0.0691831 | 0.0672883 | False | 0.10617 | 0.0464482 | False | 0.257513 | 0.0801664 | False | 0.438127 | 0.119848 | False | nan | nan | False | 0.109749 | 0.061357 | 0.109044 | 0.0420814 | 0.260375 | 0.0729036 | 0.339781 | 0.108594 | 0.0777678 | 0.291163 |
3 | 1210_186792 | 132.067672 | -2.124065 | 0.89 | nan | nan | 24.897 | 0.157 | 24.528 | 0.194 | 25.897 | 1.019 | 24.719 | 0.92 | 26.487 | 0.72 | 24.993 | 0.125 | 24.778 | 0.178 | 26.003 | 0.819 | 24.236 | 0.43 | nan | nan | False | 0.399209 | 0.0577265 | False | 0.560789 | 0.100202 | False | 0.158928 | 0.149159 | False | 0.470327 | 0.398532 | False | 0.0922996 | 0.061208 | 0.365426 | 0.0420713 | 0.445451 | 0.073029 | 0.144145 | 0.108732 | 0.733837 | 0.290632 |
4 | 1210_187561 | 132.064531 | -2.120901 | 0.93 | 25.43 | 0.276 | 24.844 | 0.116 | 24.609 | 0.198 | 24.242 | 0.209 | 23.277 | 0.188 | 25.473 | 0.237 | 24.989 | 0.107 | 24.646 | 0.169 | 24.324 | 0.184 | 23.738 | 0.231 | 0.244343 | 0.0621133 | False | 0.419179 | 0.0447851 | False | 0.520475 | 0.0949164 | False | 0.729793 | 0.140482 | False | 1.77501 | 0.30735 | False | 0.234855 | 0.0512654 | 0.366775 | 0.0361459 | 0.503037 | 0.0783001 | 0.676706 | 0.114682 | 1.16091 | 0.246994 |
5 | 1210_187784 | 132.063017 | -2.1201 | 0.82 | 25.753 | 0.353 | 25.614 | 0.182 | 25.536 | 0.404 | 25.456 | 0.479 | 24.502 | 0.513 | 25.76 | 0.357 | 25.605 | 0.181 | 25.552 | 0.411 | 25.395 | 0.454 | 24.294 | 0.425 | 0.181468 | 0.0589997 | False | 0.206253 | 0.0345738 | False | 0.221615 | 0.0824626 | False | 0.238561 | 0.105247 | False | 0.57438 | 0.271389 | False | 0.180302 | 0.0592848 | 0.20797 | 0.03467 | 0.218374 | 0.0826642 | 0.252348 | 0.105519 | 0.695664 | 0.27231 |
6 | 1210_187747 | 132.065303 | -2.120448 | 0.05 | 24.846 | 0.227 | 23.952 | 0.068 | 23.72 | 0.115 | 23.414 | 0.126 | 23.202 | 0.239 | 25.135 | 0.175 | 24.278 | 0.053 | 23.939 | 0.084 | 23.535 | 0.082 | 23.576 | 0.196 | 0.418408 | 0.0874785 | False | 0.953235 | 0.0597014 | False | 1.18032 | 0.125018 | False | 1.56459 | 0.181571 | False | 1.90195 | 0.418672 | False | 0.320627 | 0.0516789 | 0.705992 | 0.0344629 | 0.964718 | 0.0746372 | 1.39959 | 0.105704 | 1.34772 | 0.243294 |
7 | 1210_187559 | 132.066571 | -2.120941 | 0.58 | 26.512 | 0.633 | 26.628 | 0.494 | 27.691 | 2.605 | 26.955 | 1.937 | 25.275 | 0.973 | 26.632 | 0.707 | 26.662 | 0.51 | 27.333 | 1.87 | 27.337 | 2.749 | 25.35 | 1.04 | 0.0901987 | 0.0525871 | False | 0.0810587 | 0.036881 | False | 0.0304509 | 0.0730606 | False | 0.0599791 | 0.107005 | False | 0.281838 | 0.252574 | False | 0.0807607 | 0.052589 | 0.0785597 | 0.0369016 | 0.0423448 | 0.0729318 | 0.0421891 | 0.106819 | 0.263027 | 0.251947 |
8 | 1210_188153 | 132.067689 | -2.118412 | 0.57 | 26.132 | 0.537 | 24.975 | 0.106 | 24.31 | 0.103 | 23.204 | 0.066 | 22.628 | 0.092 | 26.145 | 0.509 | 25.044 | 0.106 | 24.287 | 0.094 | 23.238 | 0.063 | 22.665 | 0.089 | 0.127997 | 0.0633067 | False | 0.371535 | 0.0362728 | False | 0.685488 | 0.0650299 | False | 1.89845 | 0.115404 | False | 3.227 | 0.273441 | False | 0.126474 | 0.0592916 | 0.348658 | 0.0340393 | 0.700164 | 0.0606182 | 1.83992 | 0.106762 | 3.11889 | 0.255661 |
9 | 1210_188297 | 132.068746 | -2.117738 | 0.91 | 25.588 | 0.317 | 25.399 | 0.149 | 24.851 | 0.177 | 24.496 | 0.207 | 23.085 | 0.15 | 25.544 | 0.306 | 25.385 | 0.147 | 24.832 | 0.174 | 24.468 | 0.202 | 23.082 | 0.15 | 0.211252 | 0.0616787 | False | 0.25142 | 0.0345034 | False | 0.416485 | 0.0678967 | False | 0.577563 | 0.110115 | False | 2.11836 | 0.292663 | False | 0.219988 | 0.0620007 | 0.254683 | 0.034482 | 0.423838 | 0.0679242 | 0.592652 | 0.110262 | 2.12422 | 0.293472 |