{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Bootes Brown photo-z cross\n", "\n", "The photometric redshifts are calculated for the Brown aperture matched catalogue. Since in the manufacture of the masterlist we take the Brown aperture matched catalogue and add in some other obejcts. We here asign the Brown objects with their help id" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 1. Load catalogues and join on IRAC ID" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "from astropy.table import Table, join, Column\n", "import numpy as np" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "photo_z = Table.read('./data/Bootes_opt_spitzer_merged_vac_opt3as_irac4as_all_public.fits')[\n", " 'ID',\n", " 'ID_OPTICAL', \n", " 'z1_median'\n", "]\n", "cross_ids = Table.read('../../dmu1/dmu1_ml_Bootes/data/'\n", " + 'master_list_cross_ident_bootes_20190701.fits')[\n", " 'help_id', \n", " 'brown_i_id'\n", "]\n", "cross_ids['brown_i_id'].name = 'ID'\n", "\n", "\n", "photo_z['ID'].fill_value = -99\n", "photo_z = photo_z.filled()" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "WARNING: MergeConflictWarning: Cannot merge meta key 'EXTNAME' types and , choosing EXTNAME='master_list_cross_ident_bootes_20190701.fits' [astropy.utils.metadata]\n", "WARNING: MergeConflictWarning: Cannot merge meta key 'DATE-HDU' types and , choosing DATE-HDU='2019-07-08T09:28:51' [astropy.utils.metadata]\n", "WARNING: MergeConflictWarning: Cannot merge meta key 'STILVERS' types and , choosing STILVERS='3.2-2' [astropy.utils.metadata]\n" ] } ], "source": [ "new_cat = join(photo_z, cross_ids, join_type='left')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 2. Replace bad photo-zs with nans" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [], "source": [ "new_cat[new_cat['z1_median']<0]['z1_median'] = np.nan" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [], "source": [ "new_cat['help_id'].fill_value = ''\n", "new_cat = new_cat.filled()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 3. Remove objects with duplicate help_ids\n", "\n", "There seem to be a number of objects with duplicate ids which becaome duplicate help_ids. As far as I can tell these are totally identical so I remove the duplicates." ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "556961" ] }, "execution_count": 6, "metadata": {}, "output_type": "execute_result" } ], "source": [ "np.sum(new_cat['help_id'] == '')" ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "2214845" ] }, "execution_count": 7, "metadata": {}, "output_type": "execute_result" } ], "source": [ "len(new_cat)" ] }, { "cell_type": "code", "execution_count": 8, "metadata": {}, "outputs": [], "source": [ "new_cat = new_cat[~(new_cat['help_id'] == '')]" ] }, { "cell_type": "code", "execution_count": 9, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "1657884" ] }, "execution_count": 9, "metadata": {}, "output_type": "execute_result" } ], "source": [ "len(new_cat)" ] }, { "cell_type": "code", "execution_count": 10, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "dtype('S27')" ] }, "execution_count": 10, "metadata": {}, "output_type": "execute_result" } ], "source": [ "new_cat['help_id'].dtype" ] }, { "cell_type": "code", "execution_count": 11, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "1657470" ] }, "execution_count": 11, "metadata": {}, "output_type": "execute_result" } ], "source": [ "len(np.unique(new_cat['help_id']))" ] }, { "cell_type": "code", "execution_count": 12, "metadata": {}, "outputs": [ { "data": { "text/html": [ "<Column name='help_id' dtype='bytes27' length=414>\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "
HELP_J142437.818+334207.903
HELP_J142439.779+341546.007
HELP_J142441.422+334445.487
HELP_J142442.081+322823.807
HELP_J142451.435+351158.274
HELP_J142452.724+344704.613
HELP_J142454.282+341933.772
HELP_J142458.833+341759.494
HELP_J142459.227+330212.781
HELP_J142500.137+333627.582
HELP_J142500.994+341654.105
HELP_J142501.405+345539.632
...
HELP_J143810.214+344207.844
HELP_J143813.854+335004.234
HELP_J143815.391+351417.437
HELP_J143820.081+340007.888
HELP_J143820.578+345428.284
HELP_J143820.647+343914.009
HELP_J143835.865+345302.179
HELP_J143839.148+343338.859
HELP_J143839.153+342306.249
HELP_J143842.636+350220.263
HELP_J143845.209+351724.989
HELP_J143845.664+351103.565
" ], "text/plain": [ "\n", "HELP_J142437.818+334207.903\n", "HELP_J142439.779+341546.007\n", "HELP_J142441.422+334445.487\n", "HELP_J142442.081+322823.807\n", "HELP_J142451.435+351158.274\n", "HELP_J142452.724+344704.613\n", "HELP_J142454.282+341933.772\n", "HELP_J142458.833+341759.494\n", "HELP_J142459.227+330212.781\n", "HELP_J142500.137+333627.582\n", "HELP_J142500.994+341654.105\n", "HELP_J142501.405+345539.632\n", " ...\n", "HELP_J143810.214+344207.844\n", "HELP_J143813.854+335004.234\n", "HELP_J143815.391+351417.437\n", "HELP_J143820.081+340007.888\n", "HELP_J143820.578+345428.284\n", "HELP_J143820.647+343914.009\n", "HELP_J143835.865+345302.179\n", "HELP_J143839.148+343338.859\n", "HELP_J143839.153+342306.249\n", "HELP_J143842.636+350220.263\n", "HELP_J143845.209+351724.989\n", "HELP_J143845.664+351103.565" ] }, "execution_count": 12, "metadata": {}, "output_type": "execute_result" } ], "source": [ "new_cat.sort('help_id')\n", "new_cat['help_id'][:-1][new_cat['help_id'][1:] == new_cat['help_id'][:-1]]" ] }, { "cell_type": "code", "execution_count": 13, "metadata": {}, "outputs": [ { "data": { "text/html": [ "Table length=2\n", "\n", "\n", "\n", "\n", "\n", "
IDID_OPTICALz1_medianhelp_id
int64int64float64bytes27
6915496915500.3343HELP_J142437.818+334207.903
6915496915500.3343HELP_J142437.818+334207.903
" ], "text/plain": [ "\n", " ID ID_OPTICAL z1_median help_id \n", "int64 int64 float64 bytes27 \n", "------ ---------- --------- ---------------------------\n", "691549 691550 0.3343 HELP_J142437.818+334207.903\n", "691549 691550 0.3343 HELP_J142437.818+334207.903" ] }, "execution_count": 13, "metadata": {}, "output_type": "execute_result" } ], "source": [ "new_cat[new_cat['help_id']=='HELP_J142437.818+334207.903']" ] }, { "cell_type": "code", "execution_count": 14, "metadata": {}, "outputs": [], "source": [ "is_duplicate = new_cat['help_id'][1:] == new_cat['help_id'][:-1]\n", "#np.append(is_duplicate,False)\n", "new_cat = new_cat[~np.append(is_duplicate,False)]" ] }, { "cell_type": "code", "execution_count": 15, "metadata": {}, "outputs": [ { "data": { "text/html": [ "Table length=1\n", "
\n", "\n", "\n", "\n", "
IDID_OPTICALz1_medianhelp_id
int64int64float64bytes27
6915496915500.3343HELP_J142437.818+334207.903
" ], "text/plain": [ "\n", " ID ID_OPTICAL z1_median help_id \n", "int64 int64 float64 bytes27 \n", "------ ---------- --------- ---------------------------\n", "691549 691550 0.3343 HELP_J142437.818+334207.903" ] }, "execution_count": 15, "metadata": {}, "output_type": "execute_result" } ], "source": [ "new_cat[new_cat['help_id']=='HELP_J142437.818+334207.903']" ] }, { "cell_type": "code", "execution_count": 16, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "1657470" ] }, "execution_count": 16, "metadata": {}, "output_type": "execute_result" } ], "source": [ "len(new_cat)" ] }, { "cell_type": "code", "execution_count": 17, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "True" ] }, "execution_count": 17, "metadata": {}, "output_type": "execute_result" } ], "source": [ "len(new_cat) == len(np.unique(new_cat['help_id']))" ] }, { "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", "
idxIDID_OPTICALz1_medianhelp_id
0178858017885810.7797HELP_J142433.597+352308.103
1189109918911002.5117HELP_J142433.602+353326.121
2199788819978890.2227HELP_J142433.609+354416.174
3177660617766070.8996HELP_J142433.611+352156.195
4178040917804100.8052HELP_J142433.614+352219.215
5200363920036400.1278HELP_J142433.614+354452.719
6172999917300000.3376HELP_J142433.625+351736.189
7188811018881110.5268HELP_J142433.629+353308.009
8200081220008130.1662HELP_J142433.635+354435.055
9202954920295501.9393HELP_J142433.641+354736.024
\n", "\n" ], "text/plain": [ "" ] }, "execution_count": 18, "metadata": {}, "output_type": "execute_result" } ], "source": [ "new_cat[:10].show_in_notebook()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 4. Write catalogue\n", "This will be the catalogues that is used in dmu32 to merge photozs" ] }, { "cell_type": "code", "execution_count": 19, "metadata": {}, "outputs": [], "source": [ "new_cat.write('./data/Bootes_opt_spitzer_merged_vac_opt3as_irac4as_all_public_with_help_id.fits', overwrite=True)" ] } ], "metadata": { "anaconda-cloud": {}, "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.6.8" } }, "nbformat": 4, "nbformat_minor": 2 }