{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Final Bootes master catalogue\n", "\n", "This notebook presents the combination of the HELP standard catalogue with the aperture matched photometry from Brown which gives superior photometric redhsifts." ] }, { "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-07-01 17:48:24.960298\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, join\n", "import numpy as np\n", "from pymoc import MOC\n", "\n", "from herschelhelp_internal.masterlist import merge_catalogues, nb_merge_dist_plot, specz_merge\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": [ "brown_catalogue_name =\"master_catalogue_bootes_brown_20180517.fits\"\n", "help_catalogue_name =\"master_catalogue_bootes_help_20190131.fits\"\n", "\n", "brown_cross_id_name = \"master_list_cross_ident_bootes_brown_20180517.fits\"\n", "help_cross_id_name = \"master_list_cross_ident_bootes_help_20190131.fits\"" ] }, { "cell_type": "code", "execution_count": 5, "metadata": { "collapsed": true }, "outputs": [], "source": [ "brown_catalogue = Table.read(\"{}/{}\".format(OUT_DIR, brown_catalogue_name))\n", "help_catalogue = Table.read(\"{}/{}\".format(OUT_DIR, help_catalogue_name))" ] }, { "cell_type": "code", "execution_count": 6, "metadata": { "collapsed": true }, "outputs": [], "source": [ "brown_cross_id = Table.read(\"{}/{}\".format(OUT_DIR,brown_cross_id_name))['full_help_id', 'help_id']\n", "brown_cross_id['help_id'].name = 'brown_help_id'\n", "brown_cross_id['full_help_id'].name = 'help_help_id'" ] }, { "cell_type": "code", "execution_count": 7, "metadata": { "collapsed": true }, "outputs": [], "source": [ "in_brown = set(brown_catalogue.colnames)\n", "in_help = set(help_catalogue.colnames)\n", "in_both = in_help.intersection(in_brown)\n", "only_in_brown = in_brown - in_help\n", "only_in_help = in_help - in_brown\n", "\n", "for col in brown_catalogue.colnames:\n", " brown_catalogue[col].name = \"brown_{}\".format(col)\n", " \n", "for col in help_catalogue.colnames:\n", " help_catalogue[col].name = \"help_{}\".format(col)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 2 - Join the two catalogues taking brown if both are available" ] }, { "cell_type": "code", "execution_count": 8, "metadata": {}, "outputs": [], "source": [ "master_catalogue = join(brown_cross_id, brown_catalogue, join_type='left')\n", "master_catalogue = join(master_catalogue, help_catalogue, join_type='left')\n", " \n", "\n" ] }, { "cell_type": "code", "execution_count": 9, "metadata": { "collapsed": true }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "brown_stellarity_origin is not a column of floats\n", "brown_field is not a column of floats\n" ] } ], "source": [ "in_both.remove('help_id')\n", "for col in in_both:\n", " has_brown = (master_catalogue['brown_help_id'] != '-1')\n", " \n", " try:\n", " has_brown = has_brown & ~np.isnan(master_catalogue[\"brown_{}\".format(col)])\n", " except TypeError:\n", " print(\"brown_{} is not a column of floats\".format(col))\n", " master_catalogue[\"help_{}\".format(col)][has_brown] = master_catalogue[\"brown_{}\".format(col)][has_brown]\n", " master_catalogue[\"help_{}\".format(col)].name = col\n", " master_catalogue.remove_column(\"brown_{}\".format(col))\n", " \n", "#Deal with ids seperately\n", "has_brown = (master_catalogue['brown_help_id'] != '-1')\n", "master_catalogue[\"help_help_id\"][has_brown] = master_catalogue[\"brown_help_id\"][has_brown]\n", "master_catalogue[\"help_help_id\"].name = \"help_id\"\n", "master_catalogue.remove_column('brown_help_id')\n", " \n", "for col in only_in_brown:\n", " master_catalogue[\"brown_{}\".format(col)].name = col\n", " \n", "for col in only_in_help:\n", " master_catalogue[\"help_{}\".format(col)].name = col" ] }, { "cell_type": "code", "execution_count": 10, "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": "markdown", "metadata": {}, "source": [ "## 3 - Crop to HELP area\n", "\n", "The Bootes Brown catalogue slightly goes outside the HELP Bootes field." ] }, { "cell_type": "code", "execution_count": 11, "metadata": { "collapsed": true }, "outputs": [], "source": [ "help_bootes_moc = MOC(filename=\"../../dmu2/dmu2_field_coverages/Bootes_MOC.fits\")\n", "in_HELP_mask = inMoc(\n", " master_catalogue['ra'], master_catalogue['dec'],\n", " help_bootes_moc \n", ")\n", "\n", "master_catalogue = master_catalogue[in_HELP_mask]" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 4 - Check and save" ] }, { "cell_type": "code", "execution_count": 12, "metadata": { "collapsed": true }, "outputs": [ { "data": { "text/html": [ "Table length=10\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "
idxhelp_idf_ap_lbc_uferr_ap_lbc_um_ap_lbc_umerr_ap_lbc_uf_lbc_uferr_lbc_um_lbc_umerr_lbc_uf_ap_suprime_zferr_ap_suprime_zm_ap_suprime_zmerr_ap_suprime_zf_suprime_zferr_suprime_zm_suprime_zmerr_suprime_zf_ap_lbc_yferr_ap_lbc_ym_ap_lbc_ymerr_ap_lbc_yf_lbc_yferr_lbc_ym_lbc_ymerr_lbc_yfieldradechp_idxf_ap_gpc1_gferr_ap_gpc1_gm_ap_gpc1_gmerr_ap_gpc1_gf_gpc1_gferr_gpc1_gm_gpc1_gmerr_gpc1_gf_ap_gpc1_rferr_ap_gpc1_rm_ap_gpc1_rmerr_ap_gpc1_rf_gpc1_rferr_gpc1_rm_gpc1_rmerr_gpc1_rf_ap_gpc1_iferr_ap_gpc1_im_ap_gpc1_imerr_ap_gpc1_if_gpc1_iferr_gpc1_im_gpc1_imerr_gpc1_if_ap_gpc1_zferr_ap_gpc1_zm_ap_gpc1_zmerr_ap_gpc1_zf_gpc1_zferr_gpc1_zm_gpc1_zmerr_gpc1_zf_ap_gpc1_yferr_ap_gpc1_ym_ap_gpc1_ymerr_ap_gpc1_yf_gpc1_yferr_gpc1_ym_gpc1_ymerr_gpc1_yf_ap_90prime_gferr_ap_90prime_gm_ap_90prime_gmerr_ap_90prime_gf_90prime_gferr_90prime_gm_90prime_gmerr_90prime_gf_ap_90prime_rferr_ap_90prime_rm_ap_90prime_rmerr_ap_90prime_rf_90prime_rferr_90prime_rm_90prime_rmerr_90prime_rf_ap_mosaic_zferr_ap_mosaic_zm_ap_mosaic_zmerr_ap_mosaic_zf_mosaic_zferr_mosaic_zm_mosaic_zmerr_mosaic_zf_ap_newfirm_jferr_ap_newfirm_jm_ap_newfirm_jmerr_ap_newfirm_jf_newfirm_jferr_newfirm_jm_newfirm_jmerr_newfirm_jf_ap_newfirm_hferr_ap_newfirm_hm_ap_newfirm_hmerr_ap_newfirm_hf_newfirm_hferr_newfirm_hm_newfirm_hmerr_newfirm_hf_ap_newfirm_kferr_ap_newfirm_km_ap_newfirm_kmerr_ap_newfirm_kf_newfirm_kferr_newfirm_km_newfirm_kmerr_newfirm_kf_ap_mosaic_rferr_ap_mosaic_rm_ap_mosaic_rmerr_ap_mosaic_rf_mosaic_rferr_mosaic_rm_mosaic_rmerr_mosaic_rf_ap_mosaic_iferr_ap_mosaic_im_ap_mosaic_imerr_ap_mosaic_if_mosaic_iferr_mosaic_im_mosaic_imerr_mosaic_if_ap_mosaic_bferr_ap_mosaic_bm_ap_mosaic_bmerr_ap_mosaic_bf_mosaic_bferr_mosaic_bm_mosaic_bmerr_mosaic_bf_ap_tifkam_ksferr_ap_tifkam_ksm_ap_tifkam_ksmerr_ap_tifkam_ksf_tifkam_ksferr_tifkam_ksm_tifkam_ksmerr_tifkam_ksf_ap_ukidss_jferr_ap_ukidss_jm_ap_ukidss_jmerr_ap_ukidss_jf_ukidss_jferr_ukidss_jm_ukidss_jmerr_ukidss_jf_ap_90prime_zferr_ap_90prime_zm_ap_90prime_zmerr_ap_90prime_zf_90prime_zferr_90prime_zm_90prime_zmerr_90prime_zf_ap_irac_i1ferr_ap_irac_i1m_ap_irac_i1merr_ap_irac_i1f_irac_i1ferr_irac_i1m_irac_i1merr_irac_i1f_ap_irac_i2ferr_ap_irac_i2m_ap_irac_i2merr_ap_irac_i2f_irac_i2ferr_irac_i2m_irac_i2merr_irac_i2f_ap_irac_i3ferr_ap_irac_i3m_ap_irac_i3merr_ap_irac_i3f_irac_i3ferr_irac_i3m_irac_i3merr_irac_i3f_ap_irac_i4ferr_ap_irac_i4m_ap_irac_i4merr_ap_irac_i4f_irac_i4ferr_irac_i4m_irac_i4merr_irac_i4stellarityflag_cleanedflag_mergedflag_gaiaflag_optnir_obsflag_optnir_detebvzspec_association_flagzspec_qualzspecstellarity_origin
uJyuJymaguJyuJymaguJyuJymagdegdeguJyuJyuJyuJyuJyuJymagmagmagmagmagmagmagmagmagmagmagmagmagmagmagmagmagmagmagmagmagmagmagmagmagmagmagmagmagmagmagmaguJyuJyuJyuJyuJyuJyuJyuJyuJyuJyuJyuJyuJyuJyuJyuJy
0HELP_J142948.065+344534.3060.0413978360593318940.0666415542364120525.79438591003418nan0.0413978360593318940.0666415542364120527.3575558991333241.74780024907883470.210588634014129640.1172290071845054624.77898597717285nan0.210588634014129640.1172290071845054625.591412681144980.60440003300239120.392517983913421630.603453218936920223.390090942382812nan0.392517983913421630.603453218936920224.9153511012112221.669199971795852Bootes217.4502703561619834.759529327634172259325nannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannan0.389654281.024329185485839822.932276nan0.389654281.024329185485839824.9233022.8542001022684110.2403111.122653365135192922.911413nan0.2403111.122653365135192925.4480675.0721998589314531.04021631.835862755775451722.217nan1.04021631.835862755775451723.8571911.91620013041894090.107553988695144650.1727820038795471224.759471893310547nan0.107553988695144650.1727820038795471226.3209336973574961.7442000935401160.97566455602645870.3350955247879028323.9267482757568360.372900009155273440.97566455602645870.3350955247879028323.9267486794686520.372900031129945850.108382813632488250.0618710741400718725.485694885253906nan0.108382813632488250.0618710741400718726.3125989470846160.6197999753810992-7.19824790954589810.97170829772949220.978374481201172nan-7.19824790954589810.971708297729492nan-1.6549000640965126nannannannannannannannan0.402437240.6614399623.307827nan0.402437240.6614399624.8882541.78450010.36381363868713380.660284519195556623.333898544311523nan0.36381363868713380.660284519195556624.9978025602158521.97050009042798060.59519225358963011.079061865806579622.80035972595215nan0.59519225358963011.079061865806579624.463356824389531.9684001729092289-5.1641416549682625.35089445114135722.04168701171875nan-5.1641416549682625.350894451141357nan-1.1250000913228737-3.7775690555572517.76468658447265621.22473907470703nan-3.7775690555572517.764686584472655nan-2.23170012761502920.0FalseFalse0770.013434495704859864False-991e+20Brown
1HELP_J142948.039+352002.2690.09117124974727630.0762212276458740225.433244705200195nan0.09117124974727630.0762212276458740226.50035522996310.90770003324111470.51007509231567380.1418315768241882324.630914688110350.30189999938011170.51007509231567380.1418315768241882324.6309147079038770.30190001483282247nannannannannannannannanBootes217.45016205616235.333963627634172328708nannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannan-0.0609087460.629610598087310823.703575nan-0.0609087460.6296105980873108nan-11.2231997278555580.0879291451.278286933898925822.84414nan0.0879291451.278286933898925826.53966715.784099937156924-0.078625534.6224656105041521.494514nan-0.078625534.62246561050415nan-63.831407791927370.350934356451034550.182879284024238624.261667251586914nan0.350934356451034550.182879284024238625.0369352807531340.56580000252288050.340864002704620360.304654538631439223.95549201965332nan0.340864002704620360.304654538631439225.0685471511680970.97040010066030390.101643756031990050.0657006725668907225.481399536132812nan0.101643756031990050.0657006725668907226.3822982372067760.7018001072331669-5.50891876220703113.06986522674560520.61370849609375nan-5.50891876220703113.069865226745605nan-2.5759003682061796nannannannannannannannan-0.831491.879654622.733639nan-0.831491.8796546nan-2.45440.25402638316154480.910435616970062323.107507705688477nan0.25402638316154480.910435616970062325.3878029381112143.8913001836391231.47576379776000981.2407040596008322.406538009643555nan1.47576379776000981.2407040596008323.4774578690505460.9128000828748289-5.6264977455139164.06750583648681622.901458740234375nan-5.6264977455139164.067505836486816nan-0.784900047860121-6.23752880096435556.52284669876098621.817424774169922nan-6.23752880096435556.522846698760986nan-1.1354000991285070.06FalseFalse0770.011423117693219943False-991e+20Brown
2HELP_J142947.985+325945.370-0.072493337094783780.0892031639814376826.337627410888672nan-0.072493337094783780.08920316398143768nan-1.33600008766311950.260132491588592530.16697089374065424.465396881103516nan0.260132491588592530.16697089374065425.3620134982459650.69690004262043690.97539258003234860.644490480422973623.01262855529785nan0.97539258003234860.644490480422973623.9270513811990.7174000115871048Bootes217.4499368561619732.995936227634004149861382nannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannan1.23049410.746635854244232222.812075nan1.23049410.746635854244232223.67480.6588000310862481.11473992.21143794059753422.041693nan1.11473992.21143794059753423.7820662.15389997948273941.8244132.51699113845825221.809443nan1.8244132.51699113845825223.2471921.49790014270812330.116666428744792940.0739819109439849925.343400955200195nan0.116666428744792940.0739819109439849926.2326352401005140.68850002587107760.5254129171371460.1684536784887313824.598747253417970.34810000658035280.5254129171371460.1684536784887313824.5987481360102650.3481000401673810.0514280907809734340.0387225411832332626.12459373474121nan0.0514280907809734340.0387225411832332627.1219989953745330.8175000134056749nannannannannannannannannannannannannannannannan-0.129281971.054463723.158531nan-0.129281971.0544637nan-8.85560.418446034193038940.518405675888061523.49264907836914nan0.418446034193038940.518405675888061524.8459013594899221.34510012061464580.230259180068969730.968935430049896223.059785842895508nan0.230259180068969730.968935430049896225.49445761538134.568800584467257-3.3042888641357424.22175264358520522.122756958007812nan-3.3042888641357424.221752643585205nan-1.3872000545789747-1.86162757873535167.97333669662475621.02810287475586nan-1.86162757873535167.973336696624757nan-4.6501998698004630.2FalseFalse0770.00574837151509407False-991e+20Brown
3HELP_J142947.968+330131.9360.067046761512756350.0868546888232231125.446056365966797nan0.067046761512756350.0868546888232231126.8340554864066621.40650015124791340.07861665636301040.1600447744131088324.898366928100586nan0.07861665636301040.1600447744131088326.66121357764362.210300132331981-0.37237447500228880.629452049732208324.030765533447266nan-0.37237447500228880.6294520497322083nan-1.8353000149896752Bootes217.4498674561619733.025537727634149861403nannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannan0.388186160.606232464313507123.389257nan0.388186160.606232464313507124.92741.69560022571665542.4182071.467090249061584522.07863nan2.4182071.467090249061584522.9412670.65870003893672054.9842942.012564897537231422.155990.4384000003337864.9842942.012564897537231422.155990.438400022350454330.03570315241813660.0799142643809318525.67195701599121nan0.03570315241813660.0799142643809318527.518233590156622.43020025511571220.323072552680969240.177643805742263824.321348190307617nan0.323072552680969240.1776438057422637725.126749842077040.5969999922458818-0.0069842641241848470.0325773507356643726.988243103027344nan-0.0069842641241848470.03257735073566437nan-5.064300049354571nannannannannannannannannannannannannannannannan0.227225830.838135423.201118nan0.227225830.838135425.5088564.00480.447053372859954830.716200411319732723.214920043945312nan0.447053372859954830.716200411319732724.7741015604317521.73940017823351110.82599413394927981.007866501808166522.76604461669922nan0.82599413394927981.007866501808166524.1075575923603721.32480014760400830.44238203763961795.02539396286010721.347732543945312nan0.44238203763961795.02539396286010724.78550628830206612.3338013400422674.1443147659301767.986042976379394520.641124725341797nan4.1443147659301767.986042976379394522.356368166992052.09220015417032770.52FalseFalse0770.0055402196624478005False-991e+20Brown
4HELP_J142947.946+341414.7570.53953236341476440.05426450446248054524.5699558258056640.109200000762939450.53953236341476440.05426450446248054524.569956248486540.1092000056405920.434585213661193850.1370517015457153324.8048114776611330.34240001440048220.434585213661193850.1370517015457153324.804812635527660.3424000394267810.93768960237503050.569400608539581323.106674194335938nan0.93768960237503050.569400608539581323.9698522491614130.6593001075589154Bootes217.4497769561619734.237432627634172251563nannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannan1.10611361.06420528888702422.625473nan1.10611361.06420528888702423.79051.04459999450928140.56272061.362415432929992722.607819nan0.56272061.362415432929992724.5242672.628700228658089-1.12306031.840363502502441422.88039nan-1.12306031.8403635025024414nan-1.77920028280083020.5817635059356690.13084822893142724.488132476806640.244200006127357480.5817635059356690.13084822893142724.4881338138922970.244200019474992760.78101778030395510.2292549014091491724.1683464050292970.318699985742568970.78101778030395510.2292549014091491724.168347697637110.31869997438636840.4439770281314850.0322005674242973324.7815990447998050.078745789825916290.4439770281314850.0322005674242973324.781598750466990.078745790099664693.8165097236633312.61230659484863320.24246597290039nan3.8165097236633312.61230659484863322.445834066975163.5880002638622526nannannannannannannannan0.33199930.728007423.269072nan0.33199930.728007425.0971572.38080.37830239534378050.783513128757476823.17751693725586nan0.37830239534378050.783513128757476824.955402272056982.2486999322916031.67809808254241941.012822270393371622.478397369384766nan1.67809808254241941.012822270393371623.3379566471144460.65530008012723757.8465347290039064.02901077270507820.896194458007812nan7.8465347290039064.02901077270507821.663305246779750.5574999686315991.54615139961242687.75556373596191420.82022476196289nan1.54615139961242687.75556373596191523.42686995522135.4461007754828090.0FalseFalse0770.0127156433322154False-991e+20Brown
5HELP_J142947.894+323958.8640.089334122836589810.072817601263523125.472471237182617nan0.089334122836589810.072817601263523126.522456556333730.8850000819962867-0.35842213034629820.3962417840957641624.806121826171875nan-0.35842213034629820.3962417840957641nan-1.2002999100950136-0.0188286509364843370.664344668388366723.606937408447266nan-0.0188286509364843370.6643446683883668nan-38.30880190728971Bootes217.4495587561619632.666351027634149854234nannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannan1.48511430.63276314735412623.47060.46259999275207521.48511430.63276314735412623.47060.462599977294069152.82418081.1283861398696922.7727680.433800011873245242.82418081.1283861398696922.7727680.4338000127415895.6504532.78271770477294922.019790.53469997644424445.6504532.78271770477294922.0197930.53470001630194970.247666001319885250.0790397152304649425.4153327941894530.34650000929832460.247666001319885250.0790397152304649425.4153340191893380.34650004434257430.321203649044036870.213862359523773224.213899612426758nan0.321203649044036870.213862359523773225.133048823873430.72289996474518840.153405606746673580.0452275052666664125.9353961944580080.320100009441375730.153405606746673580.0452275052666664125.9353969181996080.3201000338924932nannannannannannannannannannannannannannannannan-0.755888940.747648624.227789nan-0.755888940.7476486nan-1.07393.77954483032226560.822929561138153122.456399917602540.236399993300437933.77954483032226560.822929561138153122.4564012474849970.236400005451774924.3225145339965820.990120291709899922.3106575012207030.248699992895126344.3225145339965820.990120291709899922.310658844456150.24870001924115423.62976145744323735.53890466690063520.98114776611328nan3.62976145744323735.53890466690063522.5003047880434441.6568001512126451-6.6211357116699227.578346729278564521.57192039489746nan-6.6211357116699227.5783467292785645nan-1.24270001016379680.6FalseFalse0770.005856889470692392False-991e+20Brown
6HELP_J142947.870+335547.9170.104668810963630680.0563575066626071925.556930541992188nan0.104668810963630680.056357506662607226.3504567734600740.58459998570874790.12585619091987610.1741665750741958624.710121154785156nan0.12585619091987610.1741665750741958626.1503135411470071.50250023327946920.75207078456878660.588433980941772523.186702728271484nan0.75207078456878660.588433980941772524.2093532047014080.8494999278355869Bootes217.4494598561619833.929977027634172246836nannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannan-0.81989741.122308969497680723.515675nan-0.81989741.1223089694976807nan-1.48619993356564570.882374641.153298497200012222.640873nan0.882374641.153298497200012224.0358681.41910008568490251.25373022.069503784179687522.070477nan1.25373022.069503784179687523.654491.79219996775422530.214973941445350650.196196541190147424.44137191772461nan0.214973941445350650.196196541190147425.5690354522153530.99090004391353010.53277081251144410.2748901546001434323.813879013061523nan0.53277081251144410.2748901546001434324.5836489392886150.56019996999089380.080850206315517430.094981126487255125.318328857421875nan0.080850206315517430.094981126487255126.630797168782431.2755001192388016nannannannannannannannannannannannannannannannan-0.144629660.4777801624.12754nan-0.144629660.47778016nan-3.58670020.66142201423645020.6602424979209923.157291412353516nan0.66142201423645020.6602424979209924.3488033861869231.08380000738302941.15254247188568120.992319107055664122.65865135192871nan1.15254247188568120.992319107055664123.745857654074150.93480006809715027.3464608192443855.08896493911743220.790891647338867nan7.3464608192443855.08896493911743221.7348045831914550.7521000404263836-5.09532642364501957.488571166992187521.41290855407715nan-5.09532642364501957.488571166992188nan-1.59570009100514070.0FalseFalse0770.00975239105709547False-991e+20Brown
7HELP_J142948.286+341759.2990.05730304867029190.0507619380950927725.897689819335938nan0.05730304867029190.0507619380950927727.004555679572640.96180003145463330.178959295153617860.1341531872749328624.77358627319336nan0.178959295153617860.1341531872749328625.768114348534390.8139000116370743-0.06431895494461060.4638547003269195624.059480667114258nan-0.06431895494461060.46385470032691956nan-7.83009988775274Bootes217.4511924561619834.299805227634172251959nannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannan0.754953860.996072053909301822.802814nan0.754953860.996072053909301624.2051981.43250011292839790.480013581.092406749725341822.835827nan0.480013581.092406749725341824.6968672.47090001213759923.24939972.061745166778564521.730906nan3.24939972.061745166778564522.6204930.68889998319458720.14057435095310210.1324646174907684324.88001251220703nan0.14057435095310210.1324646174907684326.030234782495661.02310008962549270.37454196810722350.143574818968772924.966247558593750.416200011968612670.37454196810722350.143574818968772924.966248779382660.41620003182491020.095736980438232420.03552652150392532326.447299957275390.402900010347366330.095736980438232420.03552652150392532326.447300685912430.4029000126112825-12.67263889312744111.34511852264404321.398090362548828nan-12.67263889312744111.345118522644043nan-0.9720000728488228nannannannannannannannan0.437338380.7004753423.238966nan0.437338380.7004753424.7979561.7390.56524854898452760.654567003250122123.217853546142578nan0.56524854898452760.654567003250122224.5194013595808761.25730016493707651.0901759862899780.895647585391998322.75096321105957nan1.0901759862899780.895647585391998323.8062584714207120.8920000278795632-6.8883919715881355.14915037155151422.56814193725586nan-6.8883919715881355.149150371551514nan-0.81160000841942834.9110312461853036.74413156509399420.73799705505371nan4.9110312461853036.74413156509399522.172068256707911.49100004516614910.69FalseFalse0770.011075927398448043False-991e+20Brown
8HELP_J142948.285+351026.767-0.036205772310495380.083303526043891926.11179542541504nan-0.036205772310495380.08330352604389189nan-2.49810039775471541.57483208179473880.248901337385177623.406913757324220.171599999070167541.57483208179473880.248901337385177623.4069143663331330.171600005191555581.083973765373230.941768765449523922.719018936157227nan1.083973765373230.941768765449523923.8124530714579020.9432999928802217Bootes217.45118555616235.174101927634172327960nannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannan3.34163780.632480204105377222.5901010.205500006675720213.34163780.632480204105377222.5901010.205500023418016075.5372341.265305161476135322.0417670.248099997639656075.5372341.265305161476135322.0417670.248099983887883822.3442464.22757673263549821.316502nan2.3442464.22757673263549822.9749931.95799983959594350.64319932460784910.1988715380430221624.3791351318359380.335700005292892460.64319932460784910.1988715380430221624.3791360507269060.33570002437562861.82566463947296140.4440839290618896523.246446609497070.264099985361099241.82566463947296140.4440839290618896523.2464474900635380.26409998271803370.064008951187133790.0588600933551788325.75143814086914nan0.064008951187133790.0588600933551788326.8843982220969120.998399961035554125.3761940002441411.84276390075683620.3889331817626950.506699979305267325.3761940002441411.84276390075683620.388933785453680.5067000012425268nannannannannannannannan2.22544981.34502322.171082nan2.22544981.34502323.0314560.65620.26477649807929990.944940388202667223.06655502319336nan0.26477649807929990.944940388202667225.34280141522063.8748000606253432.10579800605773930.900903284549713123.091457366943360.46450001001358032.10579800605773930.900903284549713123.091458224687550.46450006610668180.68636971712112435.82879590988159221.171363830566406nan0.68636971712112435.82879590988159324.3086047149136639.2203000680866954.0369377136230475.88918876647949220.902305603027344nan4.0369377136230475.88918876647949222.3848698782939341.58389995437484930.13FalseFalse0770.011826240546781514False-991e+20Brown
9HELP_J142948.260+322835.2940.079362832009792330.05871791392564773625.66494369506836nan0.079362832009792330.05871791392564773626.65095710767020.80330002600059810.53500092029571530.349953979253768923.67091178894043nan0.53500092029571530.349953979253768924.5791136772880140.71020009659978740.89046972990036010.674247741699218823.02488136291504nan0.89046972990036010.674247741699218824.0259520977468740.822100021548361Bootes217.4510844561619632.476470527634149849869nannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannannan1.94410370.64890825748443623.1782020.362399995326995851.94410370.64890825748443623.1782020.36240000071251827-0.725392161.070313692092895523.522928nan-0.725392161.0703136920928955nan-1.60200011186813080.442836643.280234813690185521.786741nan0.442836643.280234813690185524.7843918.0424006448808340.26697209477424620.0779472514986991925.333835601806640.317000001668930050.26697209477424620.0779472514986991925.3338353271027260.316999996142252270.76994580030441280.1443112790584564224.1838493347167970.203500002622604370.76994580030441280.1443112790584564224.1838496138778470.203500013074649880.168904334306716920.0363092534244060525.830898284912110.233400002121925350.168904334306716920.0363092534244060525.8308980143001680.23339999634957867nannannannannannannannannannannannannannannannan1.25273260.720323222.824257nan1.25273260.720323223.6553540.62431.9893844127655030.558299005031585723.1532020568847660.304699987173080441.9893844127655030.558299005031585723.153203222918030.3047000061695391-0.43468827009201050.83619755506515523.668455123901367nan-0.43468827009201050.836197555065155nan-2.0886000896051216.5457324981689454.49148797988891620.922161102294922nan6.5457324981689454.49148797988891621.86010436701050.74500006139350861.5883001089096077.47545480728149420.85371208190918nan1.5883001089096077.47545480728149423.3976685858031675.1100997133789420.0FalseFalse0770.007416890749520779False-991e+20Brown
\n", "\n" ], "text/plain": [ "" ] }, "execution_count": 12, "metadata": {}, "output_type": "execute_result" } ], "source": [ "master_catalogue[:10].show_in_notebook()" ] }, { "cell_type": "code", "execution_count": 13, "metadata": { "collapsed": true }, "outputs": [], "source": [ "columns = [\"help_id\", \"field\", \"ra\", \"dec\", \"hp_idx\"]\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", " ] \n", " \n", "columns += [\"stellarity\", \"flag_cleaned\", \"flag_merged\", \"flag_gaia\", \"flag_optnir_obs\", \n", " \"flag_optnir_det\", \"ebv\", 'zspec_association_flag', 'zspec_qual', 'zspec', \"stellarity_origin\"] " ] }, { "cell_type": "code", "execution_count": 14, "metadata": { "collapsed": true }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "['help_id', 'field', 'ra', 'dec', 'hp_idx', 'f_ap_lbc_u', 'ferr_ap_lbc_u', 'm_ap_lbc_u', 'merr_ap_lbc_u', 'f_lbc_u', 'ferr_lbc_u', 'm_lbc_u', 'merr_lbc_u', 'f_ap_suprime_z', 'ferr_ap_suprime_z', 'm_ap_suprime_z', 'merr_ap_suprime_z', 'f_suprime_z', 'ferr_suprime_z', 'm_suprime_z', 'merr_suprime_z', 'f_ap_lbc_y', 'ferr_ap_lbc_y', 'm_ap_lbc_y', 'merr_ap_lbc_y', 'f_lbc_y', 'ferr_lbc_y', 'm_lbc_y', 'merr_lbc_y', 'f_ap_gpc1_g', 'ferr_ap_gpc1_g', 'm_ap_gpc1_g', 'merr_ap_gpc1_g', 'f_gpc1_g', 'ferr_gpc1_g', 'm_gpc1_g', 'merr_gpc1_g', 'f_ap_gpc1_r', 'ferr_ap_gpc1_r', 'm_ap_gpc1_r', 'merr_ap_gpc1_r', 'f_gpc1_r', 'ferr_gpc1_r', 'm_gpc1_r', 'merr_gpc1_r', 'f_ap_gpc1_i', 'ferr_ap_gpc1_i', 'm_ap_gpc1_i', 'merr_ap_gpc1_i', 'f_gpc1_i', 'ferr_gpc1_i', 'm_gpc1_i', 'merr_gpc1_i', 'f_ap_gpc1_z', 'ferr_ap_gpc1_z', 'm_ap_gpc1_z', 'merr_ap_gpc1_z', 'f_gpc1_z', 'ferr_gpc1_z', 'm_gpc1_z', 'merr_gpc1_z', 'f_ap_gpc1_y', 'ferr_ap_gpc1_y', 'm_ap_gpc1_y', 'merr_ap_gpc1_y', 'f_gpc1_y', 'ferr_gpc1_y', 'm_gpc1_y', 'merr_gpc1_y', 'f_ap_90prime_g', 'ferr_ap_90prime_g', 'm_ap_90prime_g', 'merr_ap_90prime_g', 'f_90prime_g', 'ferr_90prime_g', 'm_90prime_g', 'merr_90prime_g', 'f_ap_90prime_r', 'ferr_ap_90prime_r', 'm_ap_90prime_r', 'merr_ap_90prime_r', 'f_90prime_r', 'ferr_90prime_r', 'm_90prime_r', 'merr_90prime_r', 'f_ap_mosaic_z', 'ferr_ap_mosaic_z', 'm_ap_mosaic_z', 'merr_ap_mosaic_z', 'f_mosaic_z', 'ferr_mosaic_z', 'm_mosaic_z', 'merr_mosaic_z', 'f_ap_newfirm_j', 'ferr_ap_newfirm_j', 'm_ap_newfirm_j', 'merr_ap_newfirm_j', 'f_newfirm_j', 'ferr_newfirm_j', 'm_newfirm_j', 'merr_newfirm_j', 'f_ap_newfirm_h', 'ferr_ap_newfirm_h', 'm_ap_newfirm_h', 'merr_ap_newfirm_h', 'f_newfirm_h', 'ferr_newfirm_h', 'm_newfirm_h', 'merr_newfirm_h', 'f_ap_newfirm_k', 'ferr_ap_newfirm_k', 'm_ap_newfirm_k', 'merr_ap_newfirm_k', 'f_newfirm_k', 'ferr_newfirm_k', 'm_newfirm_k', 'merr_newfirm_k', 'f_ap_mosaic_r', 'ferr_ap_mosaic_r', 'm_ap_mosaic_r', 'merr_ap_mosaic_r', 'f_mosaic_r', 'ferr_mosaic_r', 'm_mosaic_r', 'merr_mosaic_r', 'f_ap_mosaic_i', 'ferr_ap_mosaic_i', 'm_ap_mosaic_i', 'merr_ap_mosaic_i', 'f_mosaic_i', 'ferr_mosaic_i', 'm_mosaic_i', 'merr_mosaic_i', 'f_ap_mosaic_b', 'ferr_ap_mosaic_b', 'm_ap_mosaic_b', 'merr_ap_mosaic_b', 'f_mosaic_b', 'ferr_mosaic_b', 'm_mosaic_b', 'merr_mosaic_b', 'f_ap_tifkam_ks', 'ferr_ap_tifkam_ks', 'm_ap_tifkam_ks', 'merr_ap_tifkam_ks', 'f_tifkam_ks', 'ferr_tifkam_ks', 'm_tifkam_ks', 'merr_tifkam_ks', 'f_ap_ukidss_j', 'ferr_ap_ukidss_j', 'm_ap_ukidss_j', 'merr_ap_ukidss_j', 'f_ukidss_j', 'ferr_ukidss_j', 'm_ukidss_j', 'merr_ukidss_j', 'f_ap_90prime_z', 'ferr_ap_90prime_z', 'm_ap_90prime_z', 'merr_ap_90prime_z', 'f_90prime_z', 'ferr_90prime_z', 'm_90prime_z', 'merr_90prime_z', 'f_ap_irac_i1', 'ferr_ap_irac_i1', 'm_ap_irac_i1', 'merr_ap_irac_i1', 'f_irac_i1', 'ferr_irac_i1', 'm_irac_i1', 'merr_irac_i1', 'f_ap_irac_i2', 'ferr_ap_irac_i2', 'm_ap_irac_i2', 'merr_ap_irac_i2', 'f_irac_i2', 'ferr_irac_i2', 'm_irac_i2', 'merr_irac_i2', 'f_ap_irac_i3', 'ferr_ap_irac_i3', 'm_ap_irac_i3', 'merr_ap_irac_i3', 'f_irac_i3', 'ferr_irac_i3', 'm_irac_i3', 'merr_irac_i3', 'f_ap_irac_i4', 'ferr_ap_irac_i4', 'm_ap_irac_i4', 'merr_ap_irac_i4', 'f_irac_i4', 'ferr_irac_i4', 'm_irac_i4', 'merr_irac_i4', 'stellarity', 'flag_cleaned', 'flag_merged', 'flag_gaia', 'flag_optnir_obs', 'flag_optnir_det', 'ebv', 'zspec_association_flag', 'zspec_qual', 'zspec', 'stellarity_origin']\n" ] } ], "source": [ "master_catalogue = master_catalogue.filled()\n", "print(columns)\n", "master_catalogue[columns].write(\"{}/master_catalogue_bootes{}.fits\".format(OUT_DIR, SUFFIX), overwrite=True)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 5 - Make final cross ID catalogue" ] }, { "cell_type": "code", "execution_count": 15, "metadata": {}, "outputs": [], "source": [ "brown_cross_id = Table.read(\"{}/{}\".format(OUT_DIR,brown_cross_id_name))\n", "brown_cross_id['help_id'].name = 'brown_help_id'\n", "brown_cross_id['full_help_id'].name = 'help_help_id'\n", "\n", "\n", "help_cross_id = Table.read(\"{}/{}\".format(OUT_DIR,help_cross_id_name))\n", "help_cross_id.remove_columns(['specz_id', 'sdss_id'])\n", "help_cross_id['help_id'].name = 'help_help_id'\n", "\n", "final_cross_id = join(brown_cross_id, help_cross_id, join_type='left')\n", "\n", "\n", "\n", "\n", "\n", "for col in final_cross_id.colnames:\n", " final_cross_id[col].fill_value = -1\n", "final_cross_id = final_cross_id.filled()\n", "\n", "final_cross_id['specz_id'][final_cross_id['specz_id'] == ''] = '-1'\n", "\n", "final_cross_id.add_column(Column(data=final_cross_id['help_help_id'], name = 'help_id'))\n", "have_brown_id = (final_cross_id['brown_help_id'] != '-1')\n", "final_cross_id['help_id'][have_brown_id] = final_cross_id['brown_help_id'][have_brown_id]" ] }, { "cell_type": "code", "execution_count": 16, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "['brown_i_id',\n", " 'brown_irac_id',\n", " 'help_help_id',\n", " 'brown_help_id',\n", " 'specz_id',\n", " 'sdss_id',\n", " 'ps1_id',\n", " 'legacy_id',\n", " 'ibis_id',\n", " 'ndwfs_id',\n", " 'uhs_id',\n", " 'zbootes_id',\n", " 'datafusion_intid',\n", " 'help_id']" ] }, "execution_count": 16, "metadata": {}, "output_type": "execute_result" } ], "source": [ "final_cross_id.colnames" ] }, { "cell_type": "code", "execution_count": 17, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "set()\n" ] } ], "source": [ "columns = ['help_id',\n", " 'brown_help_id',\n", " 'help_help_id',\n", " 'brown_i_id',\n", " 'brown_irac_id',\n", " 'specz_id',\n", " 'sdss_id',\n", " 'ps1_id',\n", " 'legacy_id',\n", " 'ibis_id',\n", " 'ndwfs_id',\n", " 'uhs_id',\n", " 'zbootes_id',\n", " 'datafusion_intid']\n", "print(set(columns) - set(final_cross_id.colnames))\n", "final_cross_id = final_cross_id[columns]" ] }, { "cell_type": "code", "execution_count": 18, "metadata": {}, "outputs": [ { "data": { "text/html": [ "Table length=10\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "
idxhelp_idbrown_help_idhelp_help_idbrown_i_idbrown_irac_idspecz_idsdss_idps1_idlegacy_idibis_idndwfs_iduhs_idzbootes_iddatafusion_intid
0HELP_J142500.285+331035.838HELP_J142500.285+331035.838-1394263-1-1-1-1-1-1-1-1-1-1
1HELP_J143318.051+332158.118HELP_J143318.051+332158.118-1473154-1-1-1-1-1-1-1-1-1-1
2HELP_J142939.235+354635.105HELP_J142939.235+354635.105-12019839-1-1-1-1-1-1-1-1-1-1
3HELP_J142446.142+331756.854HELP_J142446.142+331756.854-1445407-1-1-1-1-1-1-1-1-1-1
4HELP_J142639.609+354724.470HELP_J142639.609+354724.470-12027735-1-1-1-1-1-1-1-1-1-1
5HELP_J142446.456+324136.432HELP_J142446.456+324136.432-1161462-1-1-1-1-1-1-1-1-1-1
6HELP_J142440.580+354503.991HELP_J142440.580+354503.991-12005436-1-1-1-1-1-1-1-1-1-1
7HELP_J142742.433+325234.332HELP_J142742.433+325234.332-1242716-1-1-1-1-1-1-1-1-1-1
8HELP_J142510.784+344929.132HELP_J142510.784+344929.132-11446199-1-1-1-1-1-1-1-1-1-1
9HELP_J143221.937+354511.185HELP_J143221.937+354511.185-12006597-1-1-1-1-1-1-1-1-1-1
\n", "\n" ], "text/plain": [ "" ] }, "execution_count": 18, "metadata": {}, "output_type": "execute_result" } ], "source": [ "final_cross_id[:10].show_in_notebook()" ] }, { "cell_type": "code", "execution_count": 19, "metadata": {}, "outputs": [], "source": [ "\n", "final_cross_id.write(\"data/master_list_cross_ident_bootes{}.fits\".format(SUFFIX), 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 }