{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Herschel Stripe 82 DECAM merging\n", "\n", "Both DES and DECaLS provide DECam fluxes which have overlapping coverage. We chose which to use DES preferentially. In this notebook we cross match both catalogues and take the DES fluxes where available, using DECaLS otherwise" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "This notebook was run with herschelhelp_internal version: \n", "017bb1e (Mon Jun 18 14:58:59 2018 +0100)\n", "This notebook was executed on: \n", "2019-02-05 16:48:13.563631\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": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "/opt/pyenv/versions/3.7.2/lib/python3.7/site-packages/matplotlib/__init__.py:855: MatplotlibDeprecationWarning: \n", "examples.directory is deprecated; in the future, examples will be found relative to the 'datapath' directory.\n", " \"found relative to the 'datapath' directory.\".format(key))\n", "/opt/pyenv/versions/3.7.2/lib/python3.7/site-packages/matplotlib/__init__.py:846: MatplotlibDeprecationWarning: \n", "The text.latex.unicode rcparam was deprecated in Matplotlib 2.2 and will be removed in 3.1.\n", " \"2.2\", name=key, obj_type=\"rcparam\", addendum=addendum)\n", "/opt/pyenv/versions/3.7.2/lib/python3.7/site-packages/seaborn/apionly.py:9: UserWarning: As seaborn no longer sets a default style on import, the seaborn.apionly module is deprecated. It will be removed in a future version.\n", " warnings.warn(msg, UserWarning)\n" ] } ], "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", "import os\n", "import time\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", "from pymoc import MOC\n", "\n", "from herschelhelp_internal.masterlist import merge_catalogues, nb_merge_dist_plot\n", "from herschelhelp_internal.utils import coords_to_hpidx, ebv, gen_help_id, inMoc" ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "collapsed": true }, "outputs": [], "source": [ "TMP_DIR = os.environ.get('TMP_DIR', \"./data_tmp\")\n", "OUT_DIR = os.environ.get('OUT_DIR', \"./data\")\n", "SUFFIX = os.environ.get('SUFFIX', time.strftime(\"_%Y%m%d\"))\n", "\n", "try:\n", " os.makedirs(OUT_DIR)\n", "except FileExistsError:\n", " pass" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## I - Reading the prepared pristine catalogues" ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "collapsed": true }, "outputs": [], "source": [ "des = Table.read(\"{}/DES.fits\".format(TMP_DIR))\n", "decals = Table.read(\"{}/DECaLS.fits\".format(TMP_DIR))" ] }, { "cell_type": "code", "execution_count": 5, "metadata": { "collapsed": true }, "outputs": [], "source": [ "for col in des.colnames:\n", " if '_decam_' in col:\n", " des[col].name = col.replace('_decam_', '_des-decam_')\n", " \n", "for col in decals.colnames:\n", " if '_decam_' in col:\n", " decals[col].name = col.replace('_decam_', '_decals-decam_')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## II - Merging tables\n", "\n", "We first merge DES and DECaLS.\n", "\n", "At every step, we look at the distribution of the distances separating the sources from one catalogue to the other (within a maximum radius) to determine the best cross-matching radius." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### DES" ] }, { "cell_type": "code", "execution_count": 6, "metadata": { "collapsed": true }, "outputs": [], "source": [ "master_catalogue = des\n", "master_catalogue['des_ra'].name = 'ra'\n", "master_catalogue['des_dec'].name = 'dec'\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Add DECaLS" ] }, { "cell_type": "code", "execution_count": 7, "metadata": { "scrolled": true }, "outputs": [ { "data": { "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXcAAAEKCAYAAADpfB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XwZTO7A7jb3XfGne9aWeBGM1sLlIHX1bz3qLvvBIjr5KuJAn+Xuz8G4PHUwWb2p8DpZnZ5/LsLib4sflenjdeZ2b+Pl1fFv7Mnbsv34+2nHuacvwT+a/wQi7vd/Tdmdj5wFvBY/Fk7iOZ3Pxd40N1/Fx8j6Ae0SHIU7tIyZvYaojDcTdRzBcDdv2hmPwYuBn5hZu+Y5Nf/CngZOIOohz5W817+j9cCAAABkElEQVS+ZrnMkf87N+Bj7v7TKbR7PfAnwFvcfcTM/gVoj98ec/fykX7f3e80s0eInk50X1wKMuB2d79+wrne2Wi7RGqp5i4tYWa9wE3Aje7uE9472d1/5e5fIpop8fXAINBTs9tCol5xhWjmyHoXL58BlpvZm+Nz9JhZhmjm0I/E88ZjZq8zs646x1oIvBoH++uJetcNnzP+Utvh7l8FfgicDvwzcLmZHRvve4yZnQg8DPyRmZ1U3V6nbSKAeu4yuzriMkmW6OHX3wQmm6f9E2b2x0SPZXsa+Em8XI4vVN5GVJP+vpldDfwjMHykE7t7wczeBXwtnjd9lKj3fTNR2WZTfOG1H/izOp/jH4EPm9k2ogB/eIrn/AvgvWZWBF4C/ru77zWzvwb+KR4eWgQ+6u4Pxxds74637yYaaSRyRJryV6QOi57feq+7H1WPv4vLQ59y90ta3RY5+qgsI1JfGVh4tN3ERPTXy6utboscndRzFxEJkHruIiIBUriLiARI4S4iEiCFu4hIgBTuIiIB+v9BbWrObUZYQwAAAABJRU5ErkJggg==\n", "text/plain": [ "
" ] }, "metadata": { "needs_background": "light" }, "output_type": "display_data" } ], "source": [ "nb_merge_dist_plot(\n", " SkyCoord(master_catalogue['ra'], master_catalogue['dec']),\n", " SkyCoord(decals['decals_ra'], decals['decals_dec'])\n", ")" ] }, { "cell_type": "code", "execution_count": 8, "metadata": { "collapsed": true }, "outputs": [], "source": [ "# Given the graph above, we use 0.8 arc-second radius\n", "master_catalogue = merge_catalogues(master_catalogue, decals, \"decals_ra\", \"decals_dec\", radius=0.8*u.arcsec)\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Cleaning\n", "\n", "When we merge the catalogues, astropy masks the non-existent values (e.g. when a row comes only from a catalogue and has no counterparts in the other, the columns from the latest are masked for that row). We indicate to use NaN for masked values for floats columns, False for flag columns and -1 for ID columns." ] }, { "cell_type": "code", "execution_count": 9, "metadata": { "collapsed": true }, "outputs": [], "source": [ "for col in master_catalogue.colnames:\n", " if (col.startswith(\"m_\") \n", " or col.startswith(\"merr_\") \n", " or col.startswith(\"f_\")\n", " or col.startswith(\"ferr_\")\n", " or \"stellarity\" in col):\n", " master_catalogue[col].fill_value = np.nan\n", " elif \"flag\" in col:\n", " master_catalogue[col].fill_value = 0\n", " elif \"id\" in col:\n", " master_catalogue[col].fill_value = -1\n", " \n", "master_catalogue = master_catalogue.filled()" ] }, { "cell_type": "code", "execution_count": 10, "metadata": {}, "outputs": [ { "data": { "text/html": [ "Table length=10\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "
idxdes_idradecdes_stellaritym_des-decam_gmerr_des-decam_gm_ap_des-decam_gmerr_ap_des-decam_gm_des-decam_rmerr_des-decam_rm_ap_des-decam_rmerr_ap_des-decam_rm_des-decam_imerr_des-decam_im_ap_des-decam_imerr_ap_des-decam_im_des-decam_zmerr_des-decam_zm_ap_des-decam_zmerr_ap_des-decam_zm_des-decam_ymerr_des-decam_ym_ap_des-decam_ymerr_ap_des-decam_yf_des-decam_gferr_des-decam_gflag_des-decam_gf_ap_des-decam_gferr_ap_des-decam_gf_des-decam_rferr_des-decam_rflag_des-decam_rf_ap_des-decam_rferr_ap_des-decam_rf_des-decam_iferr_des-decam_iflag_des-decam_if_ap_des-decam_iferr_ap_des-decam_if_des-decam_zferr_des-decam_zflag_des-decam_zf_ap_des-decam_zferr_ap_des-decam_zf_des-decam_yferr_des-decam_yflag_des-decam_yf_ap_des-decam_yferr_ap_des-decam_ydes_flag_cleaneddes_flag_gaiaflag_mergeddecals_idf_decals-decam_gf_decals-decam_rf_decals-decam_zferr_decals-decam_gferr_decals-decam_rferr_decals-decam_zf_ap_decals-decam_gf_ap_decals-decam_rf_ap_decals-decam_zferr_ap_decals-decam_gferr_ap_decals-decam_rferr_ap_decals-decam_zm_decals-decam_gmerr_decals-decam_gflag_decals-decam_gm_decals-decam_rmerr_decals-decam_rflag_decals-decam_rm_decals-decam_zmerr_decals-decam_zflag_decals-decam_zm_ap_decals-decam_gmerr_ap_decals-decam_gm_ap_decals-decam_rmerr_ap_decals-decam_rm_ap_decals-decam_zmerr_ap_decals-decam_zdecals_stellaritydecals_flag_cleaneddecals_flag_gaia
degdeg
06402514129.9625519245649561.857482002985860.999808073043823214.7785787582397460.0001698109554126858714.755880832672120.0001942718954524025317.2212200164794920.001878693117760121819.5404887199401860.005734185222536325517.275451660156250.002696406794711947419.781581878662110.0084539363160729416.8895683288574220.002801575465127825719.2856321334838870.00837686192244291314.1147308349609380.000847931951284408614.2826442718505860.00045434274943545464452.1367625682560.696321623951075False4546.1908854906870.8134546094550313469.36639608689650.8121635938563568False55.437611674091620.2927870805460521446.497812932496341.1088694761573417False44.3983927369035460.34570200670188855637.04875083733981.643806426104957False70.104701846817250.54088406088994778205.5494302582326.408322306346515False7029.7890234343062.941721625254117False3False-1nannannannannannannannannannannannannannanFalsenannanFalsenannanFalsenannannannannannannanFalse0
1125273261350.18296992456493-1.111477997014140.999714136123657215.1518802642822270.0002276346640428528215.1361632347106930.000221034570131450916.809061050415040.001550736371427774419.2481913566589360.00433425419032573716.0775794982910160.00140306528192013518.876194000244140.00271435640752315515.1594200134277340.001072445418685674718.092511177062990.002310307696461677613.5575237274169920.000720222247764468215.9740076065063480.00179049849975854163156.8060067898580.6618536543728427False3202.8360351516430.6520345210271143686.0812961818080.9799168666227303False72.564374719150180.28967666714670151345.76181291800821.73908880367473False102.216828031019660.25554356657425743134.95993311998563.0965840535700377False210.375678262453050.447652520481588613708.5180757293389.093534560930557False1480.46095297207512.441443053691034False2False-1nannannannannannannannannannannannannannanFalsenannanFalsenannanFalsenannannannannannannanFalse0
227803976012.594595924564954-1.167160997014140.999854385852813714.6528301239013670.00018324858683627114.8702502250671390.000221354886889457716.9759902954101560.0017298168968409319.466565608978270.00482370331883430516.7956581115722660.00238565751351416119.305894851684570.00429996615275740616.307115554809570.00273376447148621118.944415092468260.007221970241516828513.2948598861694340.000496547727379947913.706431388854980.000373695016605779534998.8251991327620.8436926479638615False4091.6635001110470.8341894718879429588.30681840325110.937302330474812False59.343581926925510.26365136562448477694.60316100730211.5262319177584278False68.808495062552670.2725102087362591089.31573771044652.7427773421694153False95.991761882295830.63850652184813717460.4746512120257.985327346586858False11951.638385773084.113584575576254False3False-1nannannannannannannannannannannannannannanFalsenannanFalsenannanFalsenannannannannannannanFalse0
3124464173350.22394192456494-1.031655997014140.999478101730346715.1947107315063480.0002070461196126416315.0811648368835450.0002224419877165928517.517055511474610.001869671745225787219.7459197044372560.00501962518319487617.5804328918457030.00345048541203141219.9762287139892580.01005529519170522717.2997150421142580.00509228464215993919.8798894882202150.0175628159195184714.0906438827514650.000809056509751826514.1844635009765620.00044018652988597753034.6995997636280.578706663338235False3369.25642522044650.6902819423986115357.419131687114150.615486937609675False45.880920050227250.21211876393453852337.15285627408751.0714766691027136False37.111500518338990.34369959395629707436.630413436589832.0478697669830495False40.554981228019980.65601539932613088389.6230249395926.2516835055742535False7695.105875951673.1198019719669836False3False-1nannannannannannannannannannannannannannanFalsenannanFalsenannanFalsenannannannannannannanFalse0
4130230378351.4153469245651.877026002985860.998991191387176514.9056921005249020.000195541215362027314.980537891387940.0002240620233351364717.6380367279052730.003019240917637944220.1785273551940920.01027149055153131517.7257061004638670.00469403807073831620.5073833465576170.01164934970438480416.8361034393310550.0047742626629769819.4756746292114260.02023485675454139713.7598619461059570.000596803438384085913.9582595825195310.0003160188498441133960.2550805407360.7132423955274578False3696.45006257773640.7628317786114224319.73141437489670.8891166792674027False30.802719279139060.29140581169772334294.92905536651371.275087086522743False22.7534188444674930.24413161496128724669.2041480534862.942663571463771False58.847788719072251.096745756320444811377.7194698642476.25406251613136False9477.5518050311842.758575248424335False3False-1nannannannannannannannannannannannannannanFalsenannanFalsenannanFalsenannannannannannannanFalse0
5125271997350.18956392456494-1.07921499701413980.999656677246093815.2366323471069340.0001787194632925093215.1774258613586430.000225004710955545315.6703376770019530.000333801406668499116.0585188865661620.000419546006014570617.696737289428710.002856533043086528819.8003787994384770.00898702256381511717.1761665344238280.003089706646278500619.147938728332520.00830832682549953514.3715171813964840.000659006531350314614.4830179214477540.0005314718582667412919.75937215759270.4806119807449221False3083.3984904976910.63899424471135841958.2355440103530.602044747438929False1369.59589411979370.5292339748032261302.90405285386770.7969297072990721False43.636356402788680.3611935550052899489.252874825735941.3922791304511124False79.583770037060220.60899504739329526477.2868053424183.931502229955371False5845.1119218354292.8612037447595275False3False-1nannannannannannannannannannannannannannanFalsenannanFalsenannanFalsenannannannannannannanFalse0
61512638229.518864924564955-0.50359399701413990.845424950122833310.1274814605712892.4180399122997187e-0514.4322495460510250.000228617340326309211.093712806701668.242495823651552e-0515.8367571830749510.000699366501066833710.6394586563110355.4149339121067896e-0515.4549951553344730.00036411633482202899.7260046005249024.309895302867517e-0515.1767387390136720.0004381728940643378.0960988998413094.037336111650802e-0513.3980407714843750.0004993428592570126322854.92501567047.190292551258673False6124.9166293169981.2896891007026634132591.2537831945210.065823086411369False1679.9529811201621.0821255045322344201472.853499013810.048133073206007False2387.82193759409170.8007884127969033467302.5595542064418.549856748023878False3085.35047712948971.2451615243573642096816.57057203177.97062696057125False15877.5573980188627.302275519964148False3False-1nannannannannannannannannannannannannannanFalsenannanFalsenannanFalsenannannannannannannanFalse0
729200293316.1387559245649541.366833002985860.999822139739990214.4036531448364260.0001510487782070413214.5587868690490720.000237461281358264423.8966922760009770.2473045587539672923.911830425262450.2136517316102981623.6705913543701170.301896661520004323.6847858428955080.2464123070240020823.7938518524169920.733622491359710723.4903230667114260.4447463154792785622.524278640747070.514801621437072823.0775537490844730.78376126289367686288.3794830145050.8748460571259725False5451.1138467348831.19221268776222141.00305117176649960.228470899611038False0.98916292448332270.194647991597229731.23527444869140020.3434768321131692False1.21923006344056950.27670928850745931.10270478476564660.7450880129895475False1.45838024673463520.59739118808097723.55049204309595321.6834651480489247False2.13293931993440781.539706613578186False0False-1nannannannannannannannannannannannannannanFalsenannanFalsenannanFalsenannannannannannannanFalse0
827438608611.099912924564956-2.24584499701413960.999629318714141814.935804367065430.000219804016523994515.0216193199157710.000240925248363055318.403347015380860.00997930578887462621.2871031761169430.02829167805612087218.427068710327150.015078871510922909nannan17.8213825225830080.013765943236649036nannan14.330054283142090.001813561655580997514.6675138473510740.00088480295380577453851.9288199848280.7798113595979874False3559.199010768480.7897875210249281158.001494129504551.4522360202298477False11.095802797751930.2891299738854475154.586838670583062.1469258070037083Falsenannan270.05174689603653.4239597081105955Falsenannan6729.43010566241311.240517125668184False4931.6751411471064.018987957640728False3False-1nannannannannannannannannannannannannannanFalsenannanFalsenannanFalsenannannannannannannanFalse0
91806431122.8662259245649557-1.85332099701413980.991942048072814915.3159294128417970.0001906089019030332615.2903485298156740.0002420836535748094315.2398939132690430.000374391995137557415.4639391899108890.0004783462500199675617.2679481506347660.00168150593526661419.0739631652832030.00507848663255572317.1943645477294920.00260830437764525419.1691942214965820.0099032707512378714.2692079544067380.000533778569661080814.4239225387573240.00044180449913255872714.1149351358670.4764826531138078False2778.8211012579220.61958619586896152911.00153664702841.0037941706075506False2368.2324305047221.0433796877575523449.594241175814030.6962974815482317False85.195122925945710.3984966984081935481.120853190080251.1558144805824757False78.040907580659380.71183058468219047117.325338773373.499078065642419False6172.07201187611552.511520912600012False3False-1nannannannannannannannannannannannannannanFalsenannanFalsenannanFalsenannannannannannannanFalse0
\n", "\n" ], "text/plain": [ "" ] }, "execution_count": 10, "metadata": {}, "output_type": "execute_result" } ], "source": [ "master_catalogue[:10].show_in_notebook()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## III - Merging flags and stellarity\n", "\n", "Each pristine catalogue contains a flag indicating if the source was associated to a another nearby source that was removed during the cleaning process. We merge these flags in a single one." ] }, { "cell_type": "code", "execution_count": 11, "metadata": { "collapsed": true }, "outputs": [], "source": [ "flag_cleaned_columns = [column for column in master_catalogue.colnames\n", " if 'flag_cleaned' in column]\n", "\n", "flag_column = np.zeros(len(master_catalogue), dtype=bool)\n", "for column in flag_cleaned_columns:\n", " flag_column |= master_catalogue[column]\n", " \n", "master_catalogue.add_column(Column(data=flag_column, name=\"decam_flag_cleaned\"))\n", "master_catalogue.remove_columns(flag_cleaned_columns)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Each pristine catalogue contains a flag indicating the probability of a source being a Gaia object (0: not a Gaia object, 1: possibly, 2: probably, 3: definitely). We merge these flags taking the highest value." ] }, { "cell_type": "code", "execution_count": 12, "metadata": { "collapsed": true }, "outputs": [], "source": [ "flag_gaia_columns = [column for column in master_catalogue.colnames\n", " if 'flag_gaia' in column]\n", "\n", "master_catalogue.add_column(Column(\n", " data=np.max([master_catalogue[column] for column in flag_gaia_columns], axis=0),\n", " name=\"decam_flag_gaia\"\n", "))\n", "master_catalogue.remove_columns(flag_gaia_columns)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Each prisitine catalogue may contain one or several stellarity columns indicating the probability (0 to 1) of each source being a star. We merge these columns taking the highest value." ] }, { "cell_type": "code", "execution_count": 13, "metadata": { "collapsed": true }, "outputs": [], "source": [ "stellarity_columns = [column for column in master_catalogue.colnames\n", " if 'stellarity' in column]\n", "\n", "master_catalogue.add_column(Column(\n", " data=np.nanmax([master_catalogue[column] for column in stellarity_columns], axis=0),\n", " name=\"decam_stellarity\"\n", "))\n", "master_catalogue.remove_columns(stellarity_columns)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## VIII - Cross-identification table\n", "\n", "We are producing a table associating to each HELP identifier, the identifiers of the sources in the pristine catalogue. This can be used to easily get additional information from them." ] }, { "cell_type": "code", "execution_count": 14, "metadata": { "collapsed": true }, "outputs": [], "source": [ "master_catalogue.add_column(Column(data=np.arange(len(master_catalogue)), \n", " name=\"decam_intid\"))\n" ] }, { "cell_type": "code", "execution_count": 15, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "['des_id', 'decals_id', 'decam_intid']\n" ] } ], "source": [ "\n", "id_names = []\n", "for col in master_catalogue.colnames:\n", " if '_id' in col:\n", " id_names += [col]\n", " if '_intid' in col:\n", " id_names += [col]\n", " \n", "print(id_names)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## VI - Choosing between multiple values for the same filter\n", "\n" ] }, { "cell_type": "code", "execution_count": 16, "metadata": { "collapsed": true }, "outputs": [], "source": [ "decam_origin = Table()\n", "decam_origin.add_column(master_catalogue['decam_intid'])" ] }, { "cell_type": "code", "execution_count": 17, "metadata": { "collapsed": true }, "outputs": [], "source": [ "decam_stats = Table()\n", "decam_stats.add_column(Column(data=['g','r','i','z','y'], name=\"Band\"))\n", "for col in [\"DES\", \"DECaLS\"]:\n", " decam_stats.add_column(Column(data=np.full(5, 0), name=\"{}\".format(col)))\n", " decam_stats.add_column(Column(data=np.full(5, 0), name=\"use {}\".format(col)))\n", " decam_stats.add_column(Column(data=np.full(5, 0), name=\"{} ap\".format(col)))\n", " decam_stats.add_column(Column(data=np.full(5, 0), name=\"use {} ap\".format(col)))" ] }, { "cell_type": "code", "execution_count": 18, "metadata": {}, "outputs": [], "source": [ "decam_bands = ['g','r','i','z','y'] # Lowercase naming convention (k is Ks)\n", "for band in decam_bands:\n", " if (band == 'i') or (band == 'y'):\n", " master_catalogue[\"f_des-decam_{}\".format(band)].name = \"f_decam_{}\".format(band)\n", " master_catalogue[\"ferr_des-decam_{}\".format(band)].name = \"ferr_decam_{}\".format(band)\n", " master_catalogue[\"m_des-decam_{}\".format(band)].name = \"m_decam_{}\".format(band)\n", " master_catalogue[\"merr_des-decam_{}\".format(band)].name = \"merr_decam_{}\".format(band)\n", " master_catalogue[\"f_ap_des-decam_{}\".format(band)].name = \"f_ap_decam_{}\".format(band)\n", " master_catalogue[\"ferr_ap_des-decam_{}\".format(band)].name = \"ferr_ap_decam_{}\".format(band)\n", " master_catalogue[\"m_ap_des-decam_{}\".format(band)].name = \"m_ap_decam_{}\".format(band)\n", " master_catalogue[\"merr_ap_des-decam_{}\".format(band)].name = \"merr_ap_decam_{}\".format(band)\n", " master_catalogue[\"flag_des-decam_{}\".format(band)].name = \"flag_decam_{}\".format(band)\n", " \n", " continue\n", "\n", " # DECam total flux \n", " has_des = ~np.isnan(master_catalogue['f_des-decam_' + band])\n", " has_decals = ~np.isnan(master_catalogue['f_decals-decam_' + band])\n", "\n", " use_des = has_des \n", " use_decals = has_decals & ~has_des\n", "\n", "\n", " f_decam = np.full(len(master_catalogue), np.nan)\n", " f_decam[use_des] = master_catalogue['f_des-decam_' + band][use_des]\n", " f_decam[use_decals] = master_catalogue['f_decals-decam_' + band][use_decals]\n", "\n", " ferr_decam = np.full(len(master_catalogue), np.nan)\n", " ferr_decam[use_des] = master_catalogue['ferr_des-decam_' + band][use_des]\n", " ferr_decam[use_decals] = master_catalogue['ferr_decals-decam_' + band][use_decals]\n", " \n", " m_decam = np.full(len(master_catalogue), np.nan)\n", " m_decam[use_des] = master_catalogue['m_des-decam_' + band][use_des]\n", " m_decam[use_decals] = master_catalogue['m_decals-decam_' + band][use_decals]\n", " \n", " merr_decam = np.full(len(master_catalogue), np.nan)\n", " merr_decam[use_des] = master_catalogue['merr_des-decam_' + band][use_des]\n", " merr_decam[use_decals] = master_catalogue['merr_decals-decam_' + band][use_decals]\n", " \n", " flag_decam = np.full(len(master_catalogue), False, dtype=bool)\n", " flag_decam[use_des] = master_catalogue['flag_des-decam_' + band][use_des]\n", " flag_decam[use_decals] = master_catalogue['flag_decals-decam_' + band][use_decals]\n", "\n", " master_catalogue.add_column(Column(data=f_decam, name=\"f_decam_\" + band))\n", " master_catalogue.add_column(Column(data=ferr_decam, name=\"ferr_decam_\" + band))\n", " master_catalogue.add_column(Column(data=m_decam, name=\"m_decam_\" + band))\n", " master_catalogue.add_column(Column(data=merr_decam, name=\"merr_decam_\" + band))\n", " master_catalogue.add_column(Column(data=flag_decam, name=\"flag_decam_\" + band))\n", "\n", "\n", " old_des_columns = ['f_des-decam_' + band,\n", " 'ferr_des-decam_' + band,\n", " 'm_des-decam_' + band, \n", " 'merr_des-decam_' + band,\n", " 'flag_des-decam_' + band]\n", " old_decals_columns = ['f_decals-decam_' + band,\n", " 'ferr_decals-decam_' + band,\n", " 'm_decals-decam_' + band, \n", " 'merr_decals-decam_' + band,\n", " 'flag_decals-decam_' + band]\n", " \n", " old_columns = old_des_columns + old_decals_columns\n", " master_catalogue.remove_columns(old_columns)\n", "\n", " origin = np.full(len(master_catalogue), ' ', dtype='Table length=5\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "
idxBandDESuse DESDES apuse DES apDECaLSuse DECaLSDECaLS apuse DECaLS ap
0g17916439179164391807568418075684220708656064610222069396140397
1r18364250183642501838642518386425233446226600444229719646354365
2i00000000
3z18240782182407821832091318320913233597066673056220117905699597
4y00000000
\n", "\n" ], "text/plain": [ "" ] }, "execution_count": 19, "metadata": {}, "output_type": "execute_result" } ], "source": [ "decam_stats.show_in_notebook()" ] }, { "cell_type": "code", "execution_count": 20, "metadata": { "collapsed": true }, "outputs": [], "source": [ "decam_origin.write(\"{}/herschel-stripe-82_decam_fluxes_origins{}.fits\".format(OUT_DIR, SUFFIX), overwrite=True)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## IX - Saving the catalogue" ] }, { "cell_type": "code", "execution_count": 21, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "['des_id',\n", " 'ra',\n", " 'dec',\n", " 'm_decam_i',\n", " 'merr_decam_i',\n", " 'm_ap_decam_i',\n", " 'merr_ap_decam_i',\n", " 'm_decam_y',\n", " 'merr_decam_y',\n", " 'm_ap_decam_y',\n", " 'merr_ap_decam_y',\n", " 'f_decam_i',\n", " 'ferr_decam_i',\n", " 'flag_decam_i',\n", " 'f_ap_decam_i',\n", " 'ferr_ap_decam_i',\n", " 'f_decam_y',\n", " 'ferr_decam_y',\n", " 'flag_decam_y',\n", " 'f_ap_decam_y',\n", " 'ferr_ap_decam_y',\n", " 'flag_merged',\n", " 'decals_id',\n", " 'decam_flag_cleaned',\n", " 'decam_flag_gaia',\n", " 'decam_stellarity',\n", " 'decam_intid',\n", " 'f_decam_g',\n", " 'ferr_decam_g',\n", " 'm_decam_g',\n", " 'merr_decam_g',\n", " 'flag_decam_g',\n", " 'f_ap_decam_g',\n", " 'ferr_ap_decam_g',\n", " 'm_ap_decam_g',\n", " 'merr_ap_decam_g',\n", " 'f_decam_r',\n", " 'ferr_decam_r',\n", " 'm_decam_r',\n", " 'merr_decam_r',\n", " 'flag_decam_r',\n", " 'f_ap_decam_r',\n", " 'ferr_ap_decam_r',\n", " 'm_ap_decam_r',\n", " 'merr_ap_decam_r',\n", " 'f_decam_z',\n", " 'ferr_decam_z',\n", " 'm_decam_z',\n", " 'merr_decam_z',\n", " 'flag_decam_z',\n", " 'f_ap_decam_z',\n", " 'ferr_ap_decam_z',\n", " 'm_ap_decam_z',\n", " 'merr_ap_decam_z']" ] }, "execution_count": 21, "metadata": {}, "output_type": "execute_result" } ], "source": [ "master_catalogue.colnames" ] }, { "cell_type": "code", "execution_count": 22, "metadata": { "collapsed": true }, "outputs": [], "source": [ "master_catalogue[\"ra\"].name = \"decam_ra\"\n", "master_catalogue[\"dec\"].name = \"decam_dec\"\n", "master_catalogue[\"flag_merged\"].name = \"decam_flag_merged\"" ] }, { "cell_type": "code", "execution_count": 23, "metadata": { "collapsed": true }, "outputs": [], "source": [ "columns = [\"decam_intid\", \"des_id\", \"decals_id\",\n", " 'decam_ra', 'decam_dec', 'decam_flag_merged', \n", " 'decam_flag_cleaned', 'decam_flag_gaia', 'decam_stellarity']\n", "\n", "bands = [column[5:] for column in master_catalogue.colnames if 'f_ap' in column]\n", "for band in bands:\n", " columns += [\"f_ap_{}\".format(band), \"ferr_ap_{}\".format(band),\n", " \"m_ap_{}\".format(band), \"merr_ap_{}\".format(band),\n", " \"f_{}\".format(band), \"ferr_{}\".format(band),\n", " \"m_{}\".format(band), \"merr_{}\".format(band),\n", " \"flag_{}\".format(band)] \n" ] }, { "cell_type": "code", "execution_count": 24, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Missing columns: set()\n" ] } ], "source": [ "# We check for columns in the master catalogue that we will not save to disk.\n", "print(\"Missing columns: {}\".format(set(master_catalogue.colnames) - set(columns)))" ] }, { "cell_type": "code", "execution_count": 25, "metadata": {}, "outputs": [ { "data": { "text/html": [ "Table length=10\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "
idxdes_iddecam_radecam_decm_decam_imerr_decam_im_ap_decam_imerr_ap_decam_im_decam_ymerr_decam_ym_ap_decam_ymerr_ap_decam_yf_decam_iferr_decam_iflag_decam_if_ap_decam_iferr_ap_decam_if_decam_yferr_decam_yflag_decam_yf_ap_decam_yferr_ap_decam_ydecam_flag_mergeddecals_iddecam_flag_cleaneddecam_flag_gaiadecam_stellaritydecam_intidf_decam_gferr_decam_gm_decam_gmerr_decam_gflag_decam_gf_ap_decam_gferr_ap_decam_gm_ap_decam_gmerr_ap_decam_gf_decam_rferr_decam_rm_decam_rmerr_decam_rflag_decam_rf_ap_decam_rferr_ap_decam_rm_ap_decam_rmerr_ap_decam_rf_decam_zferr_decam_zm_decam_zmerr_decam_zflag_decam_zf_ap_decam_zferr_ap_decam_zm_ap_decam_zmerr_ap_decam_z
degdeg
06402514129.9625519245649561.8574820029858617.275451660156250.002696406794711947419.781581878662110.0084539363160729414.1147308349609380.000847931951284408614.2826442718505860.0004543427494354546446.497812932496341.1088694761573417False44.3983927369035460.345702006701888558205.5494302582326.408322306346515False7029.7890234343062.941721625254117False-1False30.999808073043823204452.1367625682560.69632162395107514.7785787582397460.00016981095541268587False4546.1908854906870.813454609455031314.755880832672120.00019427189545240253469.36639608689650.812163593856356817.2212200164794920.0018786931177601218False55.437611674091620.292787080546052119.5404887199401860.0057341852225363255637.04875083733981.64380642610495716.8895683288574220.0028015754651278257False70.104701846817250.540884060889947719.2856321334838870.008376861922442913
1125273261350.18296992456493-1.1114779970141416.0775794982910160.00140306528192013518.876194000244140.00271435640752315513.5575237274169920.000720222247764468215.9740076065063480.00179049849975854161345.76181291800821.73908880367473False102.216828031019660.255543566574257413708.5180757293389.093534560930557False1480.46095297207512.441443053691034False-1False20.999714136123657213156.8060067898580.661853654372842715.1518802642822270.00022763466404285282False3202.8360351516430.652034521027114315.1361632347106930.0002210345701314509686.0812961818080.979916866622730316.809061050415040.0015507363714277744False72.564374719150180.289676667146701519.2481913566589360.0043342541903257373134.95993311998563.096584053570037715.1594200134277340.0010724454186856747False210.375678262453050.447652520481588618.092511177062990.0023103076964616776
227803976012.594595924564954-1.1671609970141416.7956581115722660.00238565751351416119.305894851684570.00429996615275740613.2948598861694340.000496547727379947913.706431388854980.00037369501660577953694.60316100730211.5262319177584278False68.808495062552670.27251020873625917460.4746512120257.985327346586858False11951.638385773084.113584575576254False-1False30.999854385852813724998.8251991327620.843692647963861514.6528301239013670.000183248586836271False4091.6635001110470.834189471887942914.8702502250671390.0002213548868894577588.30681840325110.93730233047481216.9759902954101560.00172981689684093False59.343581926925510.2636513656244847719.466565608978270.0048237033188343051089.31573771044652.742777342169415316.307115554809570.002733764471486211False95.991761882295830.63850652184813718.944415092468260.0072219702415168285
3124464173350.22394192456494-1.0316559970141417.5804328918457030.00345048541203141219.9762287139892580.01005529519170522714.0906438827514650.000809056509751826514.1844635009765620.0004401865298859775337.15285627408751.0714766691027136False37.111500518338990.343699593956297078389.6230249395926.2516835055742535False7695.105875951673.1198019719669836False-1False30.999478101730346733034.6995997636280.57870666333823515.1947107315063480.00020704611961264163False3369.25642522044650.690281942398611515.0811648368835450.00022244198771659285357.419131687114150.61548693760967517.517055511474610.0018696717452257872False45.880920050227250.2121187639345385219.7459197044372560.005019625183194876436.630413436589832.047869766983049517.2997150421142580.005092284642159939False40.554981228019980.656015399326130819.8798894882202150.01756281591951847
4130230378351.4153469245651.8770260029858617.7257061004638670.00469403807073831620.5073833465576170.01164934970438480413.7598619461059570.000596803438384085913.9582595825195310.000316018849844113294.92905536651371.275087086522743False22.7534188444674930.2441316149612872411377.7194698642476.25406251613136False9477.5518050311842.758575248424335False-1False30.998991191387176543960.2550805407360.713242395527457814.9056921005249020.0001955412153620273False3696.45006257773640.762831778611422414.980537891387940.00022406202333513647319.73141437489670.889116679267402717.6380367279052730.0030192409176379442False30.802719279139060.2914058116977233420.1785273551940920.010271490551531315669.2041480534862.94266357146377116.8361034393310550.00477426266297698False58.847788719072251.096745756320444819.4756746292114260.020234856754541397
5125271997350.18956392456494-1.079214997014139817.696737289428710.002856533043086528819.8003787994384770.00898702256381511714.3715171813964840.000659006531350314614.4830179214477540.000531471858266741302.90405285386770.7969297072990721False43.636356402788680.36119355500528996477.2868053424183.931502229955371False5845.1119218354292.8612037447595275False-1False30.999656677246093852919.75937215759270.480611980744922115.2366323471069340.00017871946329250932False3083.3984904976910.638994244711358415.1774258613586430.00022500471095554531958.2355440103530.60204474743892915.6703376770019530.0003338014066684991False1369.59589411979370.529233974803226116.0585188865661620.0004195460060145706489.252874825735941.392279130451112417.1761665344238280.0030897066462785006False79.583770037060220.608995047393295219.147938728332520.008308326825499535
61512638229.518864924564955-0.503593997014139910.6394586563110355.4149339121067896e-0515.4549951553344730.00036411633482202898.0960988998413094.037336111650802e-0513.3980407714843750.0004993428592570126201472.853499013810.048133073206007False2387.82193759409170.80078841279690332096816.57057203177.97062696057125False15877.5573980188627.302275519964148False-1False30.84542495012283336322854.92501567047.19029255125867310.1274814605712892.4180399122997187e-05False6124.9166293169981.289689100702663414.4322495460510250.0002286173403263092132591.2537831945210.06582308641136911.093712806701668.242495823651552e-05False1679.9529811201621.082125504532234415.8367571830749510.0006993665010668337467302.5595542064418.5498567480238789.7260046005249024.309895302867517e-05False3085.35047712948971.24516152435736415.1767387390136720.000438172894064337
729200293316.1387559245649541.3668330029858623.6705913543701170.301896661520004323.6847858428955080.2464123070240020822.524278640747070.514801621437072823.0775537490844730.78376126289367681.23527444869140020.3434768321131692False1.21923006344056950.27670928850745933.55049204309595321.6834651480489247False2.13293931993440781.539706613578186False-1False00.999822139739990276288.3794830145050.874846057125972514.4036531448364260.00015104877820704132False5451.1138467348831.192212687762221414.5587868690490720.00023746128135826441.00305117176649960.22847089961103823.8966922760009770.24730455875396729False0.98916292448332270.1946479915972297323.911830425262450.213651731610298161.10270478476564660.745088012989547523.7938518524169920.7336224913597107False1.45838024673463520.597391188080977223.4903230667114260.44474631547927856
827438608611.099912924564956-2.245844997014139618.427068710327150.015078871510922909nannan14.330054283142090.001813561655580997514.6675138473510740.0008848029538057745154.586838670583062.1469258070037083Falsenannan6729.43010566241311.240517125668184False4931.6751411471064.018987957640728False-1False30.999629318714141883851.9288199848280.779811359597987414.935804367065430.0002198040165239945False3559.199010768480.789787521024928115.0216193199157710.0002409252483630553158.001494129504551.452236020229847718.403347015380860.009979305788874626False11.095802797751930.289129973885447521.2871031761169430.028291678056120872270.05174689603653.423959708110595517.8213825225830080.013765943236649036Falsenannannannan
91806431122.8662259245649557-1.853320997014139817.2679481506347660.00168150593526661419.0739631652832030.00507848663255572314.2692079544067380.000533778569661080814.4239225387573240.0004418044991325587449.594241175814030.6962974815482317False85.195122925945710.39849669840819357117.325338773373.499078065642419False6172.07201187611552.511520912600012False-1False30.991942048072814992714.1149351358670.476482653113807815.3159294128417970.00019060890190303326False2778.8211012579220.619586195868961515.2903485298156740.000242083653574809432911.00153664702841.003794170607550615.2398939132690430.0003743919951375574False2368.2324305047221.043379687757552315.4639391899108890.00047834625001996756481.120853190080251.155814480582475717.1943645477294920.002608304377645254False78.040907580659380.711830584682190419.1691942214965820.00990327075123787
\n", "\n" ], "text/plain": [ "" ] }, "execution_count": 25, "metadata": {}, "output_type": "execute_result" } ], "source": [ "master_catalogue[:10].show_in_notebook()" ] }, { "cell_type": "code", "execution_count": 26, "metadata": { "collapsed": true }, "outputs": [], "source": [ "master_catalogue[columns].write(\"{}/decam_merged_catalogue_herschel-stripe-82.fits\".format(TMP_DIR), overwrite=True)" ] } ], "metadata": { "kernelspec": { "display_name": "Python (herschelhelp_internal)", "language": "python", "name": "helpint" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.7.2" } }, "nbformat": 4, "nbformat_minor": 2 }