{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# XMM-LSS 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-07 12:41:32.224691\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": [ { "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 the optical catalogues and then add the infrared ones: HSC, VHS, VICS82, UKIDSS-LAS, PanSTARRS, SHELA, SpIES.\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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F8M/M7dnwv3EbsHskhtKNylbszsVIIwPEhQcwXA3b9iZv8XuBL4VzN76zgf/xzwEnAuQQ09V7FuuGK6yMT/nxvwn939V1Mo9+XAHwOXuPugmf0WaAlX59y9ONHn3f27ZraF4ElFm8OmIANud/frxxzr31dbLpFKanOXujCzDuAm4EZ39zHrXuXuj7v73xGMmPhqoA9oq9hsEUGtuEQwauRkFy+fAVaY2evCY7SZWYpghNBPhmPGY2anm9mCSfa1CDgaBvurCWrXVR8z/FLb5e5fA34GnAP8GrjazJaF2y4xszXAQ8AbzOz6epM6AAAA4ElEQVSU8vJJyiYCqOYus2te2EySJnjw9beB8cZo/6yZ/TuCR7TtAH4RThfDC5W3EbRJ/8TMPgT8EhiY6MDuPmJm7wW+Ho6fPkRQ+76FoNlma3jhtQt4xyTn8UvgE2b2FEGAPzTFY74HuNbM8sCLwN+6+xEz+2vgX8LuoXngU+7+UHjB9s5w+UGCnkYiE9KQvyKTsODZrXe7+5x6DF7YPPTn7n5Vvcsic4+aZUQmVwQWzbWbmAh+vRytd1lkblLNXUQkhlRzFxGJIYW7iEgMKdxFRGJI4S4iEkMKdxGRGPr/7dmetvvoKHkAAAAASUVORK5CYII=\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 \"m_\" in col or \"merr_\" in col or \"f_\" in col or \"ferr_\" in col 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
08821889833.22824207774105-3.070391202801570.999468266963958714.9015989303588870.000234246384934522215.1681919097900390.000279493891866877717.2654056549072270.002315005054697394419.8153915405273440.00790432468056678817.550184249877930.00468100514262914720.1605577468872070.01321648340672254616.89293861389160.00541690457612276120.427545547485350.0253638587892055513.8476161956787110.00237594149075448513.853844642639160.00125757383648306133975.21321838408950.8576478537508474False3109.73395768334830.8005182499160827450.64830097468030.960871609581799False43.037138104994240.31331691014213664346.678014059642631.494655478501944False31.3167655667498370.3812136968918463635.07432376266273.1684832793564235False24.4896050387589060.57210110640537410494.3011244802422.96492034515749False10434.27174164915612.08568627217851False3False-1nannannannannannannannannannannannannannanFalsenannanFalsenannanFalsenannannannannannannanFalse0
111749383236.85647907774105-6.907555202801570.998808920383453415.4073343276977540.000302307598758488915.3775825500488280.000292854121653363117.495903015136720.00220428756438195719.7489814758300780.00507304957136511817.3662700653076170.00278971693478524719.6503515243530270.00777488294988870617.157049179077150.00503754103556275419.644666671752930.01381957437843084314.3034200668334960.001118108280934393414.3385000228881840.00049642019439488652494.97540576985560.6946899445503859False2564.2890626061440.6916621346914933364.45070438977830.739916521154968False45.7517183142813550.21377267697837152410.669050299259771.0551830170084795False50.102499255997360.35878058178878164497.943798988545152.3103331267907836False50.365521055934890.64106738017083296896.55133510557.102177420148214False6677.2861938802623.0529880977255974False3False-1nannannannannannannannannannannannannannanFalsenannanFalsenannanFalsenannannannannannannanFalse0
211207886436.00836007774105-2.367909202801570.999278306961059615.4926290512084960.000324958062265068315.4900579452514650.0002951867063529789417.676120758056640.002882420783862471620.0859050750732420.0094044022262096417.250026702880860.003218095283955335619.795563697814940.00999093055725097716.848693847656250.00429351534694433219.4382648468017580.01277735270559787813.9780282974243160.000917025841772556314.0133342742919920.00044296123087406162306.4730237616890.6903214622332868False2311.94139961341170.6285637008715302308.71071014006160.8195675553684664False33.5457858325424350.2905660339785696457.076948006348231.3547647801904192False43.8303078363195550.4033259275839978661.4887476198952.6158399041042384False60.910766021665480.7168208424995329306.5492728867417.86042331789787False9008.786409238643.675426037217616False3False-1nannannannannannannannannannannannannannanFalsenannanFalsenannanFalsenannannannannannannanFalse0
39436465934.64591607774105-6.94740820280157050.999887526035308815.0154981613159180.000289184798020869514.9572525024414060.0003001676814164966316.7303581237792970.001826183055527508319.0731525421142580.00413368688896298417.7020854949951170.005838424433022737522.2413682937622070.03655680269002914416.9626426696777340.005601542536169290519.3820819854736330.01869738474488258413.9499626159667970.000871613738127052814.173132896423340.00055247155250981453579.32171719302320.9533489104462195False3776.58269704751771.0440916190161937737.66087684236361.2407284459259458False85.258754338033980.32460278420480493301.415652879403751.6208288022030564False4.6073656751718060.1551302767375157595.58387650393073.072743087568468False64.145649339642671.1046475931792339550.254688607777.66680999742217False7775.8315079710453.956693795819863False3False-1nannannannannannannannannannannannannannanFalsenannanFalsenannanFalsenannannannannannannanFalse0
49436550434.62076507774105-6.9686532028015690.991078555583953914.9421949386596680.00030461611459031714.9351043701171880.000314714416163042216.6659584045410160.001659459550864994519.1079483032226560.00474427407607436217.2819671630859380.003388271667063236219.6915636062622070.0065034232102334516.3339996337890620.0027849348261952418.9276924133300780.00605756090953946113.4329881668090820.000558770436327904513.7376356124877930.0003827225591521713829.3232141635371.0743618513383346False3854.41304017281071.1172505294317163782.73839637658981.1963520254767999False82.569694682565160.360799667760122443.826403153404271.385055062462681False48.2363633039396760.288929744917162331062.67422383470332.7257803892765526False97.481686611790220.543871754140411315374.6321336078847.912502012946044False11613.03553650694.0936008770630865False3False-1nannannannannannannannannannannannannannanFalsenannanFalsenannanFalsenannannannannannannanFalse0
59086213733.58497207774105-6.380997202801570.9998275041580215.102769851684570.000304993765894323615.111548423767090.000315041339490562717.2942199707031250.0021092577371746319.7791862487792970.0071488395333290117.6717643737792970.00392187386751174920.957434654235840.01503781136125326216.6393814086914060.00307403714396059519.2144947052001950.00890615303069353113.8674116134643550.000931858783587813413.9963550567626950.00050430127885192633302.87440339772460.9278092580440834False3276.27713183926150.9506570119275664438.845866133470960.8525450606810437False44.496464021598430.2929791598520175309.951862584462451.1196017087109982False15.0323243642331580.20820274493919794802.13494451410432.2710789260771076False74.851777492636190.61399940616086210304.7000450684658.84425259759478False9150.7771129627784.2503405342222145False3False-1nannannannannannannannannannannannannannanFalsenannanFalsenannanFalsenannannannannannannanFalse0
69085370433.34062307774105-6.215360202801570.997185707092285215.2150688171386720.0002635160344652831615.2125339508056640.00031821979791857315.5851564407348630.000372938229702413115.8745841979980470.0004698029661085456617.9346008300781250.003194617340341210420.8327856063842770.01651099696755409217.139581680297850.002474283799529075619.3686218261718750.0079187424853444114.4314298629760740.000800543639343231914.491736412048340.00059022096684202552978.3276483224120.7228616746726921False2985.2892679179630.87496220850161922118.0559284245170.7275284962366231False1622.43131734434470.7020333685617212243.309837104709570.7159030170348388False16.8610943056356320.2564098680047346506.01958705848061.15316783304846False64.945829719943960.473677951232944876129.542417861464.519482884700024False5798.3634645234693.1520692366475074False3False-1nannannannannannannannannannannannannannanFalsenannanFalsenannanFalsenannannannannannannanFalse0
713036733537.82393607774105-3.84291720280156970.999870359897613514.9874992370605470.0003069741360377520314.9314661026000980.000319588696584105517.3547649383544920.002098222495988011419.6887111663818360.00479562859982252117.621114730834960.00597749743610620520.3152608871459960.01366340555250644717.432624816894530.01140321046113967919.8587894439697270.01945823244750499714.3554697036743160.001511160167865455214.311940193176270.00059721054276451473672.82558584952271.038431302274454False3867.35072054737841.1383626801766957415.04388981738640.8020865681928796False48.3632562119226960.21361746403410067324.753699900756261.7879245437479179False27.157866250860070.3417671243715156386.32256262437154.057447350642506False41.350829163330290.74107692294961646573.7338751124119.149519692429063False6842.6436382839533.7638045993631266False3False-1nannannannannannannannannannannannannannanFalsenannanFalsenannanFalsenannannannannannannanFalse0
812009667337.33184507774105-3.03204120280156970.998626232147216815.2508983612060550.0003027703496627509615.2918519973754880.0003198306076228618617.3395423889160160.00192318926565349119.6777439117431640.004708655178546905517.5405426025390620.00411444669589400320.2255640029907230.01449568383395671817.0824165344238280.00592108070850372319.960069656372070.01988654583692550714.0837974548339840.000989286112599074814.1024522781372070.000453401589766144752881.6461811487830.8035810338157697False2774.97580618841680.8174381533401076420.90399167626940.7455568259721391False48.854259542284090.21187270091918534349.770323732010641.3254705392471822False29.4967657207267560.39381185608266506533.37589698985952.9087744520328234False37.667963199181140.68993340505856438442.6934018576057.692696714714607False8298.872431285073.4655949917865243False3False-1nannannannannannannannannannannannannannanFalsenannanFalsenannanFalsenannannannannannannanFalse0
911206599035.57481807774105-2.119847202801570.999845087528228815.060573577880860.0003254586190450936614.9913558959960940.0003212920564692467517.7544250488281250.003108100732788443620.1559772491455080.00856275483965873717.5717964172363280.00448564626276493119.9845666885375980.01168164331465959517.4591579437255860.0078662550076842319.9381484985351560.02414585463702678714.520510673522950.00150599749758839614.5645503997802730.00065052893478423363433.76499407282561.029300126677901False3659.8024336722521.0830121027857411287.230120531797870.822244062776437False31.4491636434323320.24802661734118936339.845429132728551.4040485823594377False36.8275921251118350.3962351015449104376.996069642660362.7313699291850435False38.4362138107069460.85478887726485975646.7132048736127.832414465752702False5422.2537787811713.248793730357447False3False-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.char.array(master_catalogue['des_id'].astype(str)) \n", " + np.char.array(master_catalogue['decals_id'].astype(str) )), \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": { "collapsed": true }, "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
0g147109314710931484375148437517277314274581732357430954
1r150393115039311505413150541317833504361591756613418542
2i00000000
3z148989114898911502365150236517848004536971657504378961
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(\"{}/xmm-lss_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
08821889833.22824207774105-3.0703912028015717.550184249877930.00468100514262914720.1605577468872070.01321648340672254613.8476161956787110.00237594149075448513.853844642639160.0012575738364830613346.678014059642631.494655478501944False31.3167655667498370.381213696891846310494.3011244802422.96492034515749False10434.27174164915612.08568627217851False-1False30.999468266963958788218898-13975.21321838408950.857647853750847414.9015989303588870.0002342463849345222False3109.73395768334830.800518249916082715.1681919097900390.0002794938918668777450.64830097468030.96087160958179917.2654056549072270.0023150050546973944False43.037138104994240.3133169101421366419.8153915405273440.007904324680566788635.07432376266273.168483279356423516.89293861389160.005416904576122761False24.4896050387589060.57210110640537420.427545547485350.02536385878920555
111749383236.85647907774105-6.9075552028015717.3662700653076170.00278971693478524719.6503515243530270.00777488294988870614.3034200668334960.001118108280934393414.3385000228881840.0004964201943948865410.669050299259771.0551830170084795False50.102499255997360.358780581788781646896.55133510557.102177420148214False6677.2861938802623.0529880977255974False-1False30.9988089203834534117493832-12494.97540576985560.694689944550385915.4073343276977540.0003023075987584889False2564.2890626061440.691662134691493315.3775825500488280.0002928541216533631364.45070438977830.73991652115496817.495903015136720.002204287564381957False45.7517183142813550.2137726769783715219.7489814758300780.005073049571365118497.943798988545152.310333126790783617.157049179077150.005037541035562754False50.365521055934890.641067380170832919.644666671752930.013819574378430843
211207886436.00836007774105-2.3679092028015717.250026702880860.003218095283955335619.795563697814940.00999093055725097713.9780282974243160.000917025841772556314.0133342742919920.0004429612308740616457.076948006348231.3547647801904192False43.8303078363195550.40332592758399789306.5492728867417.86042331789787False9008.786409238643.675426037217616False-1False30.9992783069610596112078864-12306.4730237616890.690321462233286815.4926290512084960.0003249580622650683False2311.94139961341170.628563700871530215.4900579452514650.00029518670635297894308.71071014006160.819567555368466417.676120758056640.0028824207838624716False33.5457858325424350.290566033978569620.0859050750732420.00940440222620964661.4887476198952.615839904104238416.848693847656250.004293515346944332False60.910766021665480.71682084249953219.4382648468017580.012777352705597878
39436465934.64591607774105-6.947408202801570517.7020854949951170.005838424433022737522.2413682937622070.03655680269002914413.9499626159667970.000871613738127052814.173132896423340.0005524715525098145301.415652879403751.6208288022030564False4.6073656751718060.15513027673751579550.254688607777.66680999742217False7775.8315079710453.956693795819863False-1False30.999887526035308894364659-13579.32171719302320.953348910446219515.0154981613159180.0002891847980208695False3776.58269704751771.044091619016193714.9572525024414060.00030016768141649663737.66087684236361.240728445925945816.7303581237792970.0018261830555275083False85.258754338033980.3246027842048049319.0731525421142580.004133686888962984595.58387650393073.07274308756846816.9626426696777340.0056015425361692905False64.145649339642671.10464759317923319.3820819854736330.018697384744882584
49436550434.62076507774105-6.96865320280156917.2819671630859380.003388271667063236219.6915636062622070.0065034232102334513.4329881668090820.000558770436327904513.7376356124877930.000382722559152171443.826403153404271.385055062462681False48.2363633039396760.2889297449171623315374.6321336078847.912502012946044False11613.03553650694.0936008770630865False-1False30.991078555583953994365504-13829.3232141635371.074361851338334614.9421949386596680.000304616114590317False3854.41304017281071.117250529431716314.9351043701171880.0003147144161630422782.73839637658981.196352025476799916.6659584045410160.0016594595508649945False82.569694682565160.36079966776012219.1079483032226560.0047442740760743621062.67422383470332.725780389276552616.3339996337890620.00278493482619524False97.481686611790220.543871754140411318.9276924133300780.006057560909539461
59086213733.58497207774105-6.3809972028015717.6717643737792970.00392187386751174920.957434654235840.01503781136125326213.8674116134643550.000931858783587813413.9963550567626950.0005043012788519263309.951862584462451.1196017087109982False15.0323243642331580.2082027449391979410304.7000450684658.84425259759478False9150.7771129627784.2503405342222145False-1False30.9998275041580290862137-13302.87440339772460.927809258044083415.102769851684570.0003049937658943236False3276.27713183926150.950657011927566415.111548423767090.0003150413394905627438.845866133470960.852545060681043717.2942199707031250.00210925773717463False44.496464021598430.292979159852017519.7791862487792970.00714883953332901802.13494451410432.271078926077107616.6393814086914060.003074037143960595False74.851777492636190.61399940616086219.2144947052001950.008906153030693531
69085370433.34062307774105-6.2153602028015717.9346008300781250.003194617340341210420.8327856063842770.01651099696755409214.4314298629760740.000800543639343231914.491736412048340.0005902209668420255243.309837104709570.7159030170348388False16.8610943056356320.25640986800473466129.542417861464.519482884700024False5798.3634645234693.1520692366475074False-1False30.997185707092285290853704-12978.3276483224120.722861674672692115.2150688171386720.00026351603446528316False2985.2892679179630.874962208501619215.2125339508056640.0003182197979185732118.0559284245170.727528496236623115.5851564407348630.0003729382297024131False1622.43131734434470.702033368561721215.8745841979980470.00046980296610854566506.01958705848061.1531678330484617.139581680297850.0024742837995290756False64.945829719943960.4736779512329448719.3686218261718750.00791874248534441
713036733537.82393607774105-3.842917202801569717.621114730834960.00597749743610620520.3152608871459960.01366340555250644714.3554697036743160.001511160167865455214.311940193176270.0005972105427645147324.753699900756261.7879245437479179False27.157866250860070.34176712437151566573.7338751124119.149519692429063False6842.6436382839533.7638045993631266False-1False30.9998703598976135130367335-13672.82558584952271.03843130227445414.9874992370605470.00030697413603775203False3867.35072054737841.138362680176695714.9314661026000980.0003195886965841055415.04388981738640.802086568192879617.3547649383544920.0020982224959880114False48.3632562119226960.2136174640341006719.6887111663818360.004795628599822521386.32256262437154.05744735064250617.432624816894530.011403210461139679False41.350829163330290.741076922949616419.8587894439697270.019458232447504997
812009667337.33184507774105-3.032041202801569717.5405426025390620.00411444669589400320.2255640029907230.01449568383395671814.0837974548339840.000989286112599074814.1024522781372070.00045340158976614475349.770323732010641.3254705392471822False29.4967657207267560.393811856082665068442.6934018576057.692696714714607False8298.872431285073.4655949917865243False-1False30.9986262321472168120096673-12881.6461811487830.803581033815769715.2508983612060550.00030277034966275096False2774.97580618841680.817438153340107615.2918519973754880.00031983060762286186420.90399167626940.745556825972139117.3395423889160160.001923189265653491False48.854259542284090.2118727009191853419.6777439117431640.0047086551785469055533.37589698985952.908774452032823417.0824165344238280.005921080708503723False37.667963199181140.689933405058564319.960069656372070.019886545836925507
911206599035.57481807774105-2.1198472028015717.5717964172363280.00448564626276493119.9845666885375980.01168164331465959514.520510673522950.00150599749758839614.5645503997802730.0006505289347842336339.845429132728551.4040485823594377False36.8275921251118350.39623510154491045646.7132048736127.832414465752702False5422.2537787811713.248793730357447False-1False30.9998450875282288112065990-13433.76499407282561.02930012667790115.060573577880860.00032545861904509366False3659.8024336722521.083012102785741114.9913558959960940.00032129205646924675287.230120531797870.82224406277643717.7544250488281250.0031081007327884436False31.4491636434323320.2480266173411893620.1559772491455080.008562754839658737376.996069642660362.731369929185043517.4591579437255860.00786625500768423False38.4362138107069460.854788877264859719.9381484985351560.024145854637026787
\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_xmm-lss.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 }