{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# CDFS-SWIRE master catalogue\n", "## Preparation of CANDELS-GOODS-S data\n", "\n", "CANDELS-GOODS-N catalogue: the catalogue comes from `dmu0_CANDELS-GOODS-S`.\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 total magnitude.\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", "33f5ec7 (Wed Dec 6 16:56:17 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": {}, "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, flux_to_mag" ] }, { "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 = \"candels_ra\"\n", "DEC_COL = \"candels_dec\"" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## I - Column selection" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [], "source": [ "imported_columns = OrderedDict({\n", " 'ID': \"candels_id\",\n", " 'RA': \"candels_ra\",\n", " 'DEC': \"candels_dec\",\n", " 'CLASS_STAR': \"candels_stellarity\",\n", " #HST data\n", " 'ACS_F435W_FLUX': \"f_acs_f435w\", \n", " 'ACS_F435W_FLUXERR': \"ferr_acs_f435w\", \n", " 'ACS_F606W_FLUX': \"f_acs_f606w\", \n", " 'ACS_F606W_FLUXERR': \"ferr_acs_f606w\", \n", " 'ACS_F775W_FLUX': \"f_acs_f775w\", \n", " 'ACS_F775W_FLUXERR': \"ferr_acs_f775w\", \n", " 'ACS_F814W_FLUX': \"f_acs_f814w\", \n", " 'ACS_F814W_FLUXERR': \"ferr_acs_f814w\", \n", " 'ACS_F850LP_FLUX': \"f_acs_f850lp\", \n", " 'ACS_F850LP_FLUXERR': \"ferr_acs_f850lp\", \n", " \n", " 'WFC3_F098M_FLUX': \"f_wfc3_f098m\", \n", " 'WFC3_F098M_FLUXERR': \"ferr_wfc3_f098m\", \n", " 'WFC3_F105W_FLUX': \"f_wfc3_f105w\", \n", " 'WFC3_F105W_FLUXERR': \"ferr_wfc3_f105w\", \n", " 'WFC3_F125W_FLUX': \"f_wfc3_f125w\", \n", " 'WFC3_F125W_FLUXERR': \"ferr_wfc3_f125w\", \n", " 'WFC3_F160W_FLUX': \"f_wfc3_f160w\", \n", " 'WFC3_F160W_FLUXERR': \"ferr_wfc3_f160w\", \n", " #ISAAC?\n", " 'ISAAC_KS_FLUX':\"f_isaac_k\",\n", " 'ISAAC_KS_FLUXERR':\"ferr_isaac_k\",\n", " #HAWKI WIRCAM\n", " 'HAWKI_KS_FLUX': \"f_hawki_k\",# 33 WIRCAM_K_FLUX Flux density (in μJy) in the Ks-band (CFHT/WIRCam) (3)\n", " 'HAWKI_KS_FLUXERR': \"ferr_hawki_k\",# 34 WIRCAM_K_FLUXERR \n", " #Spitzer/IRAC\n", " 'IRAC_CH1_FLUX': \"f_candels-irac_i1\",# 47 IRAC_CH1_FLUX Flux density (in μJy) in the 3.6μm-band (Spitzer/IRAC) (3)\n", " 'IRAC_CH1_FLUXERR': \"ferr_candels-irac_i1\",# 48 IRAC_CH1_FLUXERR Flux uncertainty (in μJy) in the 3.6μm-band (Spitzer/IRAC) (3)\n", " 'IRAC_CH2_FLUX': \"f_candels-irac_i2\",# 49 IRAC_CH2_FLUX Flux density (in μJy) in the 4.5μm-band (Spitzer/IRAC) (3)\n", " 'IRAC_CH2_FLUXERR': \"ferr_candels-irac_i2\",# 50 IRAC_CH2_FLUXERR Flux uncertainty (in μJy) in the 4.5μm-band (Spitzer/IRAC) (3)\n", " 'IRAC_CH3_FLUX': \"f_candels-irac_i3\",# 51 IRAC_CH3_FLUX Flux density (in μJy) in the 5.8μm-band (Spitzer/IRAC) (3)\n", " 'IRAC_CH3_FLUXERR': \"ferr_candels-irac_i3\",# 52 IRAC_CH3_FLUXERR Flux uncertainty (in μJy) in the 5.8μm-band (Spitzer/IRAC) (3)\n", " 'IRAC_CH4_FLUX': \"f_candels-irac_i4\",# 53 IRAC_CH4_FLUX Flux density (in μJy) in the 8.0μm-band (Spitzer/IRAC) (3)\n", " 'IRAC_CH4_FLUXERR': \"ferr_candels-irac_i4\"# 54 IRAC_CH4_FLUXERR\n", " \n", " \n", " })\n", "\n", "\n", "catalogue = Table.read(\"../../dmu0/dmu0_CANDELS-GOODS-S/data/hlsp_candels_hst_wfc3_goodss-tot-multiband_f160w_v1_cat.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": "stderr", "output_type": "stream", "text": [ "/opt/herschelhelp_internal/herschelhelp_internal/utils.py:76: RuntimeWarning: invalid value encountered in log10\n", " magnitudes = 2.5 * (23 - np.log10(fluxes)) - 48.6\n", "/opt/herschelhelp_internal/herschelhelp_internal/utils.py:76: RuntimeWarning: divide by zero encountered in log10\n", " magnitudes = 2.5 * (23 - np.log10(fluxes)) - 48.6\n", "/opt/herschelhelp_internal/herschelhelp_internal/utils.py:80: RuntimeWarning: divide by zero encountered in true_divide\n", " errors = 2.5 / np.log(10) * errors_on_fluxes / fluxes\n" ] } ], "source": [ "# Adding flux and band-flag columns\n", "for col in catalogue.colnames:\n", " if col.startswith('f_'):\n", " \n", " errcol = \"ferr{}\".format(col[1:])\n", " \n", " # Some object have a magnitude to 0, we suppose this means missing value\n", " mask = np.isclose(catalogue[col], -99.) \n", " catalogue[col][mask] = np.nan\n", " catalogue[errcol][mask] = np.nan \n", " \n", "\n", " mag, error = flux_to_mag(np.array(catalogue[col])*1.e-6, np.array(catalogue[errcol])*1.e-6)\n", " \n", " # Fluxes are added in µJy\n", " catalogue.add_column(Column(mag, name=\"m{}\".format(col[1:])))\n", " catalogue.add_column(Column(error, name=\"m{}\".format(errcol[1:])))\n", " \n", "\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", "catalogue['candels_stellarity'] = catalogue['candels_stellarity'].astype(float)" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [ { "data": { "text/html": [ "<Table length=10>\n", "
idx | candels_id | candels_ra | candels_dec | candels_stellarity | f_acs_f435w | ferr_acs_f435w | f_acs_f606w | ferr_acs_f606w | f_acs_f775w | ferr_acs_f775w | f_acs_f814w | ferr_acs_f814w | f_acs_f850lp | ferr_acs_f850lp | f_wfc3_f098m | ferr_wfc3_f098m | f_wfc3_f105w | ferr_wfc3_f105w | f_wfc3_f125w | ferr_wfc3_f125w | f_wfc3_f160w | ferr_wfc3_f160w | f_isaac_k | ferr_isaac_k | f_hawki_k | ferr_hawki_k | f_candels-irac_i1 | ferr_candels-irac_i1 | f_candels-irac_i2 | ferr_candels-irac_i2 | f_candels-irac_i3 | ferr_candels-irac_i3 | f_candels-irac_i4 | ferr_candels-irac_i4 | m_acs_f435w | merr_acs_f435w | flag_acs_f435w | m_acs_f606w | merr_acs_f606w | flag_acs_f606w | m_acs_f775w | merr_acs_f775w | flag_acs_f775w | m_acs_f814w | merr_acs_f814w | flag_acs_f814w | m_acs_f850lp | merr_acs_f850lp | flag_acs_f850lp | m_wfc3_f098m | merr_wfc3_f098m | flag_wfc3_f098m | m_wfc3_f105w | merr_wfc3_f105w | flag_wfc3_f105w | m_wfc3_f125w | merr_wfc3_f125w | flag_wfc3_f125w | m_wfc3_f160w | merr_wfc3_f160w | flag_wfc3_f160w | m_isaac_k | merr_isaac_k | flag_isaac_k | m_hawki_k | merr_hawki_k | flag_hawki_k | m_candels-irac_i1 | merr_candels-irac_i1 | flag_candels-irac_i1 | m_candels-irac_i2 | merr_candels-irac_i2 | flag_candels-irac_i2 | m_candels-irac_i3 | merr_candels-irac_i3 | flag_candels-irac_i3 | m_candels-irac_i4 | merr_candels-irac_i4 | flag_candels-irac_i4 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | 1 | 53.0929957 | -27.9545375 | 0.0299999993294 | 1.57247 | 0.0562002 | 6.56154 | 0.0567839 | 15.6708 | 0.131342 | 17.6684 | 0.180936 | 23.1631 | 0.165851 | nan | nan | nan | nan | 37.9073 | 0.0958995 | 54.8362 | 0.116206 | nan | nan | nan | nan | 76.3619 | 0.139008 | 58.9298 | 0.0822037 | 49.5586 | 0.591554 | 35.9697 | 0.523036 | 23.4085 | 0.0388043 | False | 21.8575 | 0.00939602 | False | 20.9123 | 0.0090999 | False | 20.782 | 0.0111187 | False | 20.488 | 0.00777402 | False | nan | nan | False | nan | nan | False | 19.9532 | 0.00274674 | False | 19.5523 | 0.00230084 | False | nan | nan | False | nan | nan | False | 19.1928 | 0.00197646 | False | 19.4742 | 0.00151454 | False | 19.6622 | 0.0129598 | False | 20.0102 | 0.0157877 | False |
1 | 2 | 53.1028883 | -27.9596622 | 0.509999990463 | nan | nan | 0.122752 | 0.0268322 | nan | nan | 0.120398 | 0.0353473 | 0.204252 | 0.0639968 | nan | nan | nan | nan | 0.489016 | 0.0583247 | 0.376055 | 0.101423 | nan | nan | nan | nan | 4.32343 | 0.125855 | 4.17359 | 0.0717704 | 1.93559 | 0.706397 | 1.40668 | 0.541094 | nan | nan | False | 26.1774 | 0.23733 | False | nan | nan | False | 26.1984 | 0.318758 | False | 25.6246 | 0.340186 | False | nan | nan | False | nan | nan | False | 24.6767 | 0.129495 | False | 24.9619 | 0.292826 | False | nan | nan | False | nan | nan | False | 22.3104 | 0.0316058 | False | 22.3487 | 0.0186707 | False | 23.183 | 0.396241 | False | 23.5295 | 0.41764 | False |
2 | 3 | 53.1016865 | -27.9584786 | 0.0299999993294 | nan | nan | 3.34779 | 0.0594275 | nan | nan | 5.47988 | 0.0956989 | 6.13215 | 0.155562 | nan | nan | nan | nan | 8.46696 | 0.0777481 | 10.5502 | 0.110988 | nan | nan | nan | nan | 7.49208 | 0.135364 | 6.48226 | 0.0809801 | 3.45865 | 0.721565 | 7.87405 | 0.57855 | nan | nan | False | 22.5881 | 0.0192732 | False | nan | nan | False | 22.0531 | 0.018961 | False | 21.931 | 0.0275432 | False | nan | nan | False | nan | nan | False | 21.5807 | 0.0099698 | False | 21.3419 | 0.0114219 | False | nan | nan | False | nan | nan | False | 21.7135 | 0.0196167 | False | 21.8707 | 0.0135636 | False | 22.5527 | 0.226513 | False | 21.6595 | 0.079775 | False |
3 | 4 | 53.1022798 | -27.9586509 | 0.00999999977648 | nan | nan | 0.28294 | 0.0769396 | nan | nan | 0.572661 | 0.122873 | 0.620282 | 0.190909 | nan | nan | nan | nan | 0.706361 | 0.106992 | 0.881169 | 0.214985 | nan | nan | nan | nan | 1.71141 | 0.129901 | 1.37216 | 0.0770705 | 1.78349 | 0.699897 | -0.325973 | 0.557147 | nan | nan | False | 25.2708 | 0.295243 | False | nan | nan | False | 24.5053 | 0.232961 | False | 24.4185 | 0.334165 | False | nan | nan | False | nan | nan | False | 24.2774 | 0.164456 | False | 24.0374 | 0.264895 | False | nan | nan | False | nan | nan | False | 23.3166 | 0.0824105 | False | 23.5565 | 0.0609828 | False | 23.2718 | 0.426077 | False | nan | -1.85572 | False |
4 | 5 | 53.0905594 | -27.9584995 | 0.0 | 0.0616629 | 0.0101197 | 0.117489 | 0.0131163 | 0.130316 | 0.0221347 | 0.114363 | 0.0234091 | 0.111082 | 0.0262729 | nan | nan | nan | nan | 0.165881 | 0.0256818 | 0.308574 | 0.0219707 | nan | nan | nan | nan | 2.82623 | 0.133584 | 2.12198 | 0.0671409 | 4.57958 | 0.606722 | 2.52612 | 0.527717 | 26.9249 | 0.178184 | False | 26.225 | 0.12121 | False | 26.1125 | 0.184417 | False | 26.2543 | 0.222241 | False | 26.2859 | 0.256796 | False | nan | nan | False | nan | nan | False | 25.8505 | 0.168094 | False | 25.1766 | 0.0773052 | False | nan | nan | False | nan | nan | False | 22.772 | 0.0513182 | False | 23.0832 | 0.0343534 | False | 22.2479 | 0.143843 | False | 22.8939 | 0.226815 | False |
5 | 6 | 53.0999405 | -27.9582797 | 0.0 | nan | nan | 1.01299 | 0.0415012 | nan | nan | 1.1913 | 0.0587654 | 1.14286 | 0.0900046 | nan | nan | nan | nan | 1.38284 | 0.0363205 | 1.37406 | 0.063972 | nan | nan | nan | nan | 1.83482 | 0.124917 | 1.75306 | 0.0726456 | 2.2002 | 0.645725 | 0.479455 | 0.521698 | nan | nan | False | 23.886 | 0.0444815 | False | nan | nan | False | 23.7099 | 0.0535581 | False | 23.755 | 0.0855059 | False | nan | nan | False | nan | nan | False | 23.5481 | 0.028517 | False | 23.555 | 0.0505485 | False | nan | nan | False | nan | nan | False | 23.241 | 0.0739184 | False | 23.2905 | 0.0449922 | False | 23.0438 | 0.318647 | False | 24.6981 | 1.1814 | False |
6 | 7 | 53.0961485 | -27.9575924 | 0.0 | 0.750837 | 0.0335719 | 1.75813 | 0.0326885 | 3.87552 | 0.0772168 | 4.05189 | 0.0957558 | 5.05038 | 0.0863977 | nan | nan | nan | nan | 7.30726 | 0.0704524 | 9.55474 | 0.136626 | nan | nan | nan | nan | 18.5387 | 0.162151 | 13.7508 | 0.0916589 | 12.3678 | 0.758402 | 10.7663 | 0.658811 | 24.2111 | 0.0485461 | False | 23.2874 | 0.0201868 | False | 22.4292 | 0.0216325 | False | 22.3809 | 0.0256585 | False | 22.1417 | 0.0185739 | False | nan | nan | False | nan | nan | False | 21.7406 | 0.010468 | False | 21.4495 | 0.0155253 | False | nan | nan | False | nan | nan | False | 20.7298 | 0.00949652 | False | 21.0542 | 0.00723721 | False | 21.1693 | 0.0665781 | False | 21.3198 | 0.0664383 | False |
7 | 8 | 53.091539 | -27.9583631 | 0.360000014305 | 0.0552173 | 0.0123191 | 0.070271 | 0.0116116 | 0.0806083 | 0.0210433 | 0.101759 | 0.0273173 | 0.106426 | 0.027046 | nan | nan | nan | nan | 0.137755 | 0.0281735 | 0.146131 | 0.0232199 | nan | nan | nan | nan | 1.80913 | 0.183908 | 1.05341 | 0.0903556 | 1.44388 | 0.725899 | 3.63358 | 0.649447 | 27.0448 | 0.24223 | False | 26.7831 | 0.179407 | False | 26.6341 | 0.283438 | False | 26.3811 | 0.291467 | False | 26.3324 | 0.275918 | False | nan | nan | False | nan | nan | False | 26.0522 | 0.222054 | False | 25.9882 | 0.172521 | False | nan | nan | False | nan | nan | False | 23.2563 | 0.110371 | False | 23.8435 | 0.0931283 | False | 23.5012 | 0.545845 | False | 22.4992 | 0.194059 | False |
8 | 9 | 53.0895949 | -27.9580295 | 0.0 | 0.116514 | 0.0182176 | 0.207775 | 0.02597 | 0.441355 | 0.0446217 | 0.412882 | 0.038471 | 0.439651 | 0.0527499 | nan | nan | nan | nan | 0.475793 | 0.0456359 | 0.545227 | 0.0355639 | nan | nan | nan | nan | 1.63995 | 0.130341 | 1.38403 | 0.0697079 | 1.59181 | 0.611055 | 0.259089 | 0.52638 | 26.2341 | 0.169761 | False | 25.606 | 0.135707 | False | 24.788 | 0.10977 | False | 24.8604 | 0.101165 | False | 24.7922 | 0.130268 | False | nan | nan | False | nan | nan | False | 24.7065 | 0.104139 | False | 24.5586 | 0.0708201 | False | nan | nan | False | nan | nan | False | 23.3629 | 0.0862928 | False | 23.5471 | 0.0546841 | False | 23.3953 | 0.416786 | False | 25.3664 | 2.20584 | False |
9 | 10 | 53.0909628 | -27.9578333 | 0.0 | 0.22139 | 0.0216918 | 0.357964 | 0.0253868 | 0.584102 | 0.0459367 | 0.584998 | 0.0523299 | 0.616088 | 0.0576579 | nan | nan | nan | nan | 0.703004 | 0.0529971 | 0.755778 | 0.045867 | nan | nan | nan | nan | 2.97497 | 0.138839 | 1.9797 | 0.0711056 | 3.01486 | 0.606722 | 4.98112 | 0.521029 | 25.5371 | 0.10638 | False | 25.0154 | 0.0770004 | False | 24.4838 | 0.0853877 | False | 24.4821 | 0.0971225 | False | 24.4259 | 0.101611 | False | nan | nan | False | nan | nan | False | 24.2826 | 0.08185 | False | 24.204 | 0.0658917 | False | nan | nan | False | nan | nan | False | 22.7163 | 0.0506703 | False | 23.1585 | 0.0389968 | False | 22.7018 | 0.218498 | False | 22.1567 | 0.113569 | False |