{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# CDFS SWIRE master catalogue\n", "## Preparation of ATLAS/VST data\n", "\n", "ATLAS/VST catalogue: the catalogue comes from `dmu0_ATLAS`.\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 aperture corrected aperture magnitude in each band (2\")\n", "- The Petrosian 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", "04829ed (Thu Nov 2 16:57:19 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, 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 = \"atlas_ra\"\n", "DEC_COL = \"atlas_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': \"atlas_id\",\n", " 'ra': \"atlas_ra\",\n", " 'dec': \"atlas_dec\",\n", " 'pStar': \"atlas_stellarity\",\n", " 'uAperMag3': \"m_ap_atlas_u\", \n", " 'uAperMag3Err': \"merr_ap_atlas_u\", \n", " 'uPetroMag': \"m_atlas_u\", \n", " 'uPetroMagErr': \"merr_atlas_u\", \n", " 'ulAperMag3': \"m_ap_atlas_ul\", \n", " 'ulAperMag3Err': \"merr_ap_atlas_ul\", \n", " 'ulPetroMag': \"m_atlas_ul\", \n", " 'ulPetroMagErr': \"merr_atlas_ul\", \n", " 'gAperMag3': \"m_ap_atlas_g\", \n", " 'gAperMag3Err': \"merr_ap_atlas_g\", \n", " 'gPetroMag': \"m_atlas_g\", \n", " 'gPetroMagErr': \"merr_atlas_g\", \n", " 'rAperMag3': \"m_ap_atlas_r\", \n", " 'rAperMag3Err': \"merr_ap_atlas_r\", \n", " 'rPetroMag': \"m_atlas_r\", \n", " 'rPetroMagErr': \"merr_atlas_r\", \n", " 'iAperMag3': \"m_ap_atlas_i\", \n", " 'iAperMag3Err': \"merr_ap_atlas_i\", \n", " 'iPetroMag': \"m_atlas_i\", \n", " 'iPetroMagErr': \"merr_atlas_i\", \n", " 'zAperMag3': \"m_ap_atlas_z\", \n", " 'zAperMag3Err': \"merr_ap_atlas_z\", \n", " 'zPetroMag': \"m_atlas_z\", \n", " 'zPetroMagErr': \"merr_atlas_z\", \n", "\n", " })\n", "\n", "\n", "catalogue = Table.read(\"../../dmu0/dmu0_ATLAS/data/ATLAS_CDFS-SWIRE.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": [], "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", " # Large negative numbers are used for missing values.\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 length=10>\n", "
idx | atlas_id | atlas_ra | atlas_dec | atlas_stellarity | m_ap_atlas_u | merr_ap_atlas_u | m_atlas_u | merr_atlas_u | m_ap_atlas_ul | merr_ap_atlas_ul | m_atlas_ul | merr_atlas_ul | m_ap_atlas_g | merr_ap_atlas_g | m_atlas_g | merr_atlas_g | m_ap_atlas_r | merr_ap_atlas_r | m_atlas_r | merr_atlas_r | m_ap_atlas_i | merr_ap_atlas_i | m_atlas_i | merr_atlas_i | m_ap_atlas_z | merr_ap_atlas_z | m_atlas_z | merr_atlas_z | f_ap_atlas_u | ferr_ap_atlas_u | f_atlas_u | ferr_atlas_u | flag_atlas_u | f_ap_atlas_ul | ferr_ap_atlas_ul | f_atlas_ul | ferr_atlas_ul | flag_atlas_ul | f_ap_atlas_g | ferr_ap_atlas_g | f_atlas_g | ferr_atlas_g | flag_atlas_g | f_ap_atlas_r | ferr_ap_atlas_r | f_atlas_r | ferr_atlas_r | flag_atlas_r | f_ap_atlas_i | ferr_ap_atlas_i | f_atlas_i | ferr_atlas_i | flag_atlas_i | f_ap_atlas_z | ferr_ap_atlas_z | f_atlas_z | ferr_atlas_z | flag_atlas_z |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | 730165362081 | 51.416438263 | -28.5675023961 | 0.0500000007451 | 19.4833106995 | 0.03033708781 | 19.8903083801 | 0.0423593558371 | nan | nan | nan | nan | nan | nan | nan | nan | nan | nan | nan | nan | nan | nan | nan | nan | nan | nan | nan | nan | 58.4353595012 | 1.63277104017 | 40.1676706975 | 1.56711791388 | False | nan | nan | nan | nan | False | nan | nan | nan | nan | False | nan | nan | nan | nan | False | nan | nan | nan | nan | False | nan | nan | nan | nan | False |
1 | 730165362082 | 51.4341608062 | -28.5650674872 | 0.0500000007451 | 19.4004116058 | 0.0284509435296 | 19.7559375763 | 0.0377803966403 | nan | nan | nan | nan | nan | nan | nan | nan | nan | nan | nan | nan | nan | nan | nan | nan | nan | nan | nan | nan | 63.0718192003 | 1.65275207598 | 45.45953295 | 1.58185678842 | False | nan | nan | nan | nan | False | nan | nan | nan | nan | False | nan | nan | nan | nan | False | nan | nan | nan | nan | False | nan | nan | nan | nan | False |
2 | 730165362083 | 51.4410104768 | -28.5578899393 | 5.29221040324e-07 | 21.3994808197 | 0.144612416625 | 21.6723136902 | 0.166680008173 | 21.5033607483 | 0.178771138191 | 21.6194000244 | 0.392693430185 | 20.9679965973 | 0.0290264319628 | 20.3628520966 | 0.0553098209202 | 20.3530311584 | 0.0243935305625 | 20.0097808838 | 0.0515892580152 | 19.9406318665 | 0.0430505089462 | 19.4873466492 | 0.0819628238678 | 19.5647773743 | 0.0755860731006 | 19.1659564972 | 0.097144715488 | 10.0047829707 | 1.33256663715 | 7.78170071763 | 1.1946308261 | False | 9.09192198841 | 1.49702407923 | 8.17033737792 | 2.95508042989 | False | 14.8868002503 | 0.397988657572 | 25.9931648655 | 1.32414972215 | False | 26.2293505026 | 0.589301950434 | 35.9821944751 | 1.70971061533 | False | 38.3484004156 | 1.52055181353 | 58.2185440612 | 4.3949499444 | False | 54.2112036844 | 3.77404012743 | 78.273977144 | 7.00345369938 | False |
3 | 730165362085 | 51.43345417 | -28.5553083137 | 0.0526230409741 | 21.3532066345 | 0.138704419136 | 21.5784454346 | 0.138183042407 | 21.4512042999 | 0.170517414808 | 20.7136459351 | 0.23652087152 | 20.7741222382 | 0.0249061100185 | 20.7491092682 | 0.0526322163641 | 20.2714519501 | 0.0228828024119 | 20.2637500763 | 0.0427407696843 | 20.1814041138 | 0.0530941672623 | 20.3233032227 | 0.124013505876 | 19.9803161621 | 0.110638052225 | 19.9946594238 | 0.136019781232 | 10.4404050053 | 1.33377730747 | 8.48441349707 | 1.07982221181 | False | 9.53933894336 | 1.49817553147 | 18.816620499 | 4.09908360796 | False | 17.7971763871 | 0.408256104173 | 18.2119434339 | 0.882843312238 | False | 28.2760811885 | 0.595942159783 | 28.4773760007 | 1.12103194452 | False | 30.7212126505 | 1.50231446259 | 26.9574439526 | 3.07909703975 | False | 36.9720502948 | 3.7675041262 | 36.486838171 | 4.57102906223 | False |
4 | 730165362087 | 51.5065358537 | -28.5485972699 | 0.333333343267 | 18.0668621063 | 0.0116977151483 | 18.0702114105 | 0.0176780018955 | 18.8462467194 | 0.0204039551318 | 18.0861091614 | 0.0260918308049 | 19.3005027771 | 0.00840146373957 | 18.9081878662 | 0.0135871795937 | nan | nan | nan | nan | 15.1505994797 | 0.00173338036984 | 15.0535364151 | 0.00165672285948 | nan | nan | nan | nan | 215.404691252 | 2.32076880999 | 214.741229727 | 3.49642560461 | False | 105.07546298 | 1.97465555878 | 211.619817467 | 5.08553408104 | False | 69.1510675581 | 0.535093316495 | 99.2487060811 | 1.24202360395 | False | nan | nan | nan | nan | False | 3160.53211837 | 5.04579685952 | 3456.09310796 | 5.27364605818 | False | nan | nan | nan | nan | False |
5 | 730165362088 | 51.437546604 | -28.5382101942 | 5.29221040324e-07 | 21.3404369354 | 0.137365192175 | 21.1915435791 | 0.157265558839 | 21.3729095459 | 0.159333363175 | 21.6399288177 | 0.593238830566 | 20.8826599121 | 0.0273388549685 | 20.4417362213 | 0.0644191354513 | 20.5349349976 | 0.0282469261438 | 19.8918418884 | 0.061219021678 | 20.2975292206 | 0.0585787408054 | 19.7762889862 | 0.100248485804 | 20.1730804443 | 0.128891736269 | 19.6766643524 | 0.121567808092 | 10.5639229717 | 1.33652659161 | 12.1166501468 | 1.75505960679 | False | 10.2526511744 | 1.50459143384 | 8.01730624147 | 4.38060125299 | False | 16.1040842952 | 0.405501099639 | 24.1716062722 | 1.43415497402 | False | 22.18329226 | 0.577128970507 | 40.1109773902 | 2.26164954582 | False | 27.6050356137 | 1.48937487675 | 44.6153603978 | 4.11943739544 | False | 30.9576383357 | 3.67509505383 | 48.9028600223 | 5.47555978724 | False |
6 | 730165362089 | 51.4267302675 | -28.53556064 | 0.999998986721 | 21.6012916565 | 0.173368692398 | 21.6314849854 | 0.175797581673 | 21.5961074829 | 0.195029750466 | 22.1372566223 | 0.805256545544 | 19.5075645447 | 0.00991537701339 | 19.5440979004 | 0.0167481303215 | 18.3892478943 | 0.00602723052725 | 18.4104366302 | 0.00875805877149 | 17.9251308441 | 0.00870747398585 | 17.9318809509 | 0.0161361489445 | 17.5734519958 | 0.0141142541543 | 17.6060295105 | 0.0272030383348 | 8.30774843711 | 1.32656853203 | 8.07990037302 | 1.30826156437 | False | 8.34751113097 | 1.49945539787 | 5.0710436761 | 3.76103430559 | False | 57.1444664508 | 0.521866109471 | 55.2536331408 | 0.852320337595 | False | 160.066645026 | 0.888575479998 | 156.973140782 | 1.26621916677 | False | 245.441311191 | 1.96840984291 | 243.920116975 | 3.62512673043 | False | 339.327612678 | 4.41116004597 | 329.297319695 | 8.25051939134 | False |
7 | 730165362092 | 51.4723752174 | -28.5315502733 | 0.999998986721 | 15.835392952 | 0.00362712424248 | 15.8412590027 | 0.00357002951205 | 15.8483533859 | 0.00367736187764 | 16.0883541107 | 0.00446022488177 | 14.6542110443 | 0.000778341956902 | 14.7387771606 | 0.000762283103541 | 14.0927495956 | 0.000680710247252 | 14.0703783035 | 0.000648081710096 | 13.8929281235 | 0.000950105953962 | 13.8596324921 | 0.000797602522653 | 13.7024335861 | 0.00138936098665 | 13.6904830933 | 0.00142384809442 | 1682.06517427 | 5.6192833437 | 1673.00176418 | 5.50102837655 | False | 1662.1057259 | 5.62951129955 | 1332.47280998 | 5.47382352666 | False | 4992.47136133 | 3.57900004819 | 4618.37438482 | 3.24250839563 | False | 8373.36767931 | 5.24974405232 | 8547.68833524 | 5.10216058873 | False | 10065.3469756 | 8.80798305179 | 10378.7966547 | 7.62446196195 | False | 11995.726781 | 15.3503168845 | 12128.4907885 | 15.9054551388 | False |
8 | 730165362093 | 51.4169423276 | -28.5306971245 | 5.29221040324e-07 | 21.2844295502 | 0.131245702505 | 20.9097251892 | 0.137375935912 | 21.2592792511 | 0.144611284137 | 21.0367183685 | 0.381680250168 | 19.7298336029 | 0.0115710161626 | 19.1687278748 | 0.0214996486902 | 18.7427902222 | 0.00755382003263 | 18.2387294769 | 0.0130934854969 | 18.2922687531 | 0.0113716116175 | 17.8400554657 | 0.0214767437428 | 17.9247512817 | 0.0186996459961 | 17.4020595551 | 0.0374796427786 | 11.1231598873 | 1.34458713552 | 15.7076032931 | 1.98745026082 | False | 11.3838273252 | 1.5162337598 | 13.973739814 | 4.91233550528 | False | 46.56574535 | 0.49626510538 | 78.0744350065 | 1.54602279722 | False | 115.580324949 | 0.804129925992 | 183.868870925 | 2.21737507163 | False | 175.021942171 | 1.83311705199 | 265.44699528 | 5.25075710836 | False | 245.527129987 | 4.22871632453 | 397.352708781 | 13.7166261169 | False |
9 | 730165362096 | 51.4204295545 | -28.51779905 | 0.00307639758103 | 21.3030338287 | 0.133796557784 | 21.2939357758 | 0.188064277172 | 21.3410758972 | 0.155863776803 | 21.4733276367 | 0.498498648405 | 21.2733364105 | 0.0379613116384 | 21.1531867981 | 0.100887820125 | 21.0618152618 | 0.0442202985287 | 20.8006763458 | 0.102161549032 | 20.7758998871 | 0.0896983593702 | 21.0437164307 | 0.182684645057 | nan | nan | nan | nan | 10.934186281 | 1.34743271907 | 11.0261955311 | 1.90988702728 | False | 10.5577078733 | 1.51562066026 | 9.34692903325 | 4.29149499611 | False | 11.2373895402 | 0.392900268469 | 12.5523569507 | 1.16637901972 | False | 13.6544400578 | 0.556123497542 | 17.3671862451 | 1.63415260663 | False | 17.7680613533 | 1.46791268965 | 13.883962364 | 2.33609851576 | False | nan | nan | nan | nan | False |