{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Make VO table of extreme starbursts\n", "\n", "Reprocessing the manually made csv file from https://docs.google.com/spreadsheets/d/1hF9ls8AMzzY--2I5tukqBmJf6xf7LO8lB4NTr3sFu08/edit#gid=0" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "from astropy.table import Table, Column\n", "from astropy.coordinates import SkyCoord\n", "\n", "import numpy as np\n", "\n", "import yaml\n", "\n", "from pymoc import MOC\n", "\n", "from herschelhelp_internal.utils import coords_to_hpidx, gen_help_id, inMoc" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "giants = Table.read('./data/Known_Monsters_Sheet1.csv')" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "data": { "text/html": [ "Table masked=True length=130\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", "
NameRADecRedshiftRedshift sourceLbol/Lsun intrinsicLensed?Original surveyReferenceNotes
str24str22str13str10str14str11str9str17str106str152
9io902h09m41.3s00d15m58.6s2.553CO, H-alpha1.00E+13Y mu~10Planck/ACT/VICS82http://adsabs.harvard.edu/abs/2015MNRAS.452..502G--
WISE J132934.18+224327.313h29m34.18s22d43m27.3s2.0439H-alpha1.30E+13Y mu~11WISE/Planckhttp://adsabs.harvard.edu/abs/2017ApJ...843L..22D--
Orochi02h18m30.7s-05d31m31s3.4CO~1.30e13Y mu~5AzTEC-ASTEhttp://adsabs.harvard.edu/abs/2011MNRAS.415.3081I--
MMJ154506.4−34431815h45m06.35s-34d43m18.2s04-Mayest>1e13?AzTEC-ASTEhttp://adsabs.harvard.edu/abs/2015ApJ...808..121T--
MMJ154132.7−35032015h41m32.71s-35d03m23.3s3est13.7-13.9Y mu~1.2AzTEC-ASTEhttp://adsabs.harvard.edu/abs/2015ApJ...808..121T--
GN2012h37m12s62d22m12.100s4.06CO2.90E+13NGOODS-Nhttp://adsabs.harvard.edu/abs/2009ApJ...694.1517D--
SPT0103-4515.797917-45.6483063.0917ALMA 3mm CO1.67E+13mu = 5.34SPT-SZhttps://ui.adsabs.harvard.edu/#abs/2016ApJ...826..112S/abstractContact: jspilker@utexas.edu
SPT0125-4721.2795-47.3988892.5148ALMA 3mm CO3.33E+13mu = 5.47SPT-SZhttps://ui.adsabs.harvard.edu/#abs/2016ApJ...826..112S/abstractContact: jspilker@utexas.edu
SPT0243-4940.786708-46.356755.699ALMA 3mm CO1.63E+13mu = 5.09SPT-SZhttps://ui.adsabs.harvard.edu/#abs/2016ApJ...826..112S/abstractContact: jspilker@utexas.edu
SPT0300-4645.018208-46.356753.5954ALMA 3mm CO1.26E+13mu = 6.30SPT-SZhttps://ui.adsabs.harvard.edu/#abs/2016ApJ...826..112S/abstractContact: jspilker@utexas.edu
..............................
--138.1584672.013064243.04128003spec-z1.32E+13--HELPhttps://github.com/StevenDuivenvoorden/FIR-group/blob/master/Ian/plotting_tools/HELP_ULIRG_selection.ipynbSources selected from the HELP databse using the code on GITHUB
--9.17275683-43.3438780.13801spec-z1.99E+13--HELPhttps://github.com/StevenDuivenvoorden/FIR-group/blob/master/Ian/plotting_tools/HELP_ULIRG_selection.ipynbSources selected from the HELP databse using the code on GITHUB
--8.32921426-45.3885950.13500001spec-z1.12E+13--HELPhttps://github.com/StevenDuivenvoorden/FIR-group/blob/master/Ian/plotting_tools/HELP_ULIRG_selection.ipynbSources selected from the HELP databse using the code on GITHUB
--8.68245338-45.1894480.57800001spec-z1.39E+13--HELPhttps://github.com/StevenDuivenvoorden/FIR-group/blob/master/Ian/plotting_tools/HELP_ULIRG_selection.ipynbSources selected from the HELP databse using the code on GITHUB
--242.82498954.34024050.59622699spec-z2.30E+13--HELPhttps://github.com/StevenDuivenvoorden/FIR-group/blob/master/Ian/plotting_tools/HELP_ULIRG_selection.ipynbSources selected from the HELP databse using the code on GITHUB
--240.81124854.37387271.75600004spec-z1.37E+13--HELPhttps://github.com/StevenDuivenvoorden/FIR-group/blob/master/Ian/plotting_tools/HELP_ULIRG_selection.ipynbSources selected from the HELP databse using the code on GITHUB
--245.19498555.46954920.60170501spec-z1.78E+13--HELPhttps://github.com/StevenDuivenvoorden/FIR-group/blob/master/Ian/plotting_tools/HELP_ULIRG_selection.ipynbSources selected from the HELP databse using the code on GITHUB
--242.83041656.53438973.49065995spec-z1.56E+13--HELPhttps://github.com/StevenDuivenvoorden/FIR-group/blob/master/Ian/plotting_tools/HELP_ULIRG_selection.ipynbSources selected from the HELP databse using the code on GITHUB
--241.41494754.76306192.44812989spec-z1.24E+13--HELPhttps://github.com/StevenDuivenvoorden/FIR-group/blob/master/Ian/plotting_tools/HELP_ULIRG_selection.ipynbSources selected from the HELP databse using the code on GITHUB
--------phot-z----HELPhttps://github.com/StevenDuivenvoorden/FIR-group/blob/master/Ian/plotting_tools/HELP_ULIRG_selection.ipynbThere are an additional ~1900 sources whose solar luminosity is >10^13 solar luminosities in the HELP databse but which only have photometric redshifts.
" ], "text/plain": [ "\n", " Name ...\n", " str24 ...\n", "------------------------ ...\n", " 9io9 ...\n", "WISE J132934.18+224327.3 ...\n", " Orochi ...\n", " MMJ154506.4−344318 ...\n", " MMJ154132.7−350320 ...\n", " GN20 ...\n", " SPT0103-45 ...\n", " SPT0125-47 ...\n", " SPT0243-49 ...\n", " SPT0300-46 ...\n", " ... ...\n", " -- ...\n", " -- ...\n", " -- ...\n", " -- ...\n", " -- ...\n", " -- ...\n", " -- ...\n", " -- ...\n", " -- ...\n", " -- ..." ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "giants" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 1. Insist on RA Dec\n", "We will also convert all RA Dec to decimal degrees" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [], "source": [ "giants['RA'].fill_value = ''\n", "giants['Dec'].fill_value = ''\n", "giants = giants.filled()\n", "giants = giants[(giants['RA'] != '' ) & (giants['Dec'] != '')]" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [], "source": [ "giants.add_column(Column(np.full(len(giants), np.nan, dtype='float64'),\n", " name=\"sfr\"))" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "02h09m41.3s\n", "32.42208333333333 0.2662777777777778\n", "13h29m34.18s\n", "202.39241666666663 22.724249999999998\n", "02h18m30.7s\n", "34.62791666666666 -5.525277777777777\n", "15h45m06.35s\n", "236.2764583333333 -34.721722222222226\n", "15h41m32.71s\n", "235.38629166666664 -35.05647222222222\n", "12h37m12s\n", "189.29999999999998 62.37002777777778\n", "logSFR= will not transform to SFR\n", "logSFR= will not transform to SFR\n", "logSFR= will not transform to SFR\n", "logSFR= will not transform to SFR\n", "logSFR= will not transform to SFR\n" ] }, { "name": "stderr", "output_type": "stream", "text": [ "/Users/rs548/anaconda/envs/herschelhelp_internal/lib/python3.6/site-packages/astropy/table/row.py:54: StringTruncateWarning: truncated right side string(s) longer than 13 character(s) during assignment\n", " self._table.columns[item][self._index] = val\n", "/Users/rs548/anaconda/envs/herschelhelp_internal/lib/python3.6/site-packages/astropy/table/row.py:54: StringTruncateWarning: truncated right side string(s) longer than 13 character(s) during assignment\n", " self._table.columns[item][self._index] = val\n", "/Users/rs548/anaconda/envs/herschelhelp_internal/lib/python3.6/site-packages/astropy/table/row.py:54: StringTruncateWarning: truncated right side string(s) longer than 13 character(s) during assignment\n", " self._table.columns[item][self._index] = val\n", "/Users/rs548/anaconda/envs/herschelhelp_internal/lib/python3.6/site-packages/astropy/table/row.py:54: StringTruncateWarning: truncated right side string(s) longer than 13 character(s) during assignment\n", " self._table.columns[item][self._index] = val\n", "/Users/rs548/anaconda/envs/herschelhelp_internal/lib/python3.6/site-packages/astropy/table/row.py:54: StringTruncateWarning: truncated right side string(s) longer than 13 character(s) during assignment\n", " self._table.columns[item][self._index] = val\n", "/Users/rs548/anaconda/envs/herschelhelp_internal/lib/python3.6/site-packages/astropy/table/row.py:54: StringTruncateWarning: truncated right side string(s) longer than 13 character(s) during assignment\n", " self._table.columns[item][self._index] = val\n" ] } ], "source": [ "for gal in giants:\n", " if 'h' in gal['RA']:\n", " print(gal['RA'])\n", " hours = gal['RA'].split('h')[0]\n", " minutes = gal['RA'].split('h')[1].split('m')[0]\n", " seconds = gal['RA'].split('h')[1].split('m')[1].split('s')[0]\n", " coords = SkyCoord(gal['RA'].replace(' ', ''), gal['Dec'].replace(' ', ''))\n", " print(coords.ra.value, coords.dec.value)\n", " gal['RA'] = str(coords.ra.value)\n", " gal['Dec'] = str(coords.dec.value)\n", " \n", " gal['Lensed?'] = gal['Lensed?'].replace('m', '')\n", " gal['Lensed?'] = gal['Lensed?'].replace('u', '')\n", " gal['Lensed?'] = gal['Lensed?'].replace(' ', '')\n", " gal['Lensed?'] = gal['Lensed?'].replace('N', '')\n", " gal['Lensed?'] = gal['Lensed?'].replace('Y', '')\n", " gal['Lensed?'] = gal['Lensed?'].replace('~', '')\n", " gal['Lensed?'] = gal['Lensed?'].replace('?', '')\n", " gal['Lensed?'] = gal['Lensed?'].replace('=', '')\n", " gal['Lensed?'] = gal['Lensed?'].replace('A', '')\n", " gal['Lensed?'] = gal['Lensed?'].replace('/', '')\n", " gal['Lensed?'] = gal['Lensed?'].replace('nlensed', '')\n", " \n", " if 'logSFR' in gal['Lbol/Lsun intrinsic']:\n", " try:\n", " gal['sfr'] = 10**float(gal['Lbol/Lsun intrinsic'].replace('logSFR=', ''))\n", " except:\n", " print('{} will not transform to SFR'.format(gal['Lbol/Lsun intrinsic']))\n", " \n", " " ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [], "source": [ "giants['RA'] = giants['RA'].astype(float)\n", "giants['Dec'] = giants['Dec'].astype(float)\n", "\n", "giants['Lbol/Lsun intrinsic'] = giants['Lbol/Lsun intrinsic'].astype('', '')\n", " gal['Lbol/Lsun intrinsic'] = gal['Lbol/Lsun intrinsic'].split('-')[0]\n", " if 'logFIR~' in gal['Lbol/Lsun intrinsic']:\n", " gal['Lbol/Lsun intrinsic'] = gal['Lbol/Lsun intrinsic'].replace('logFIR~', '') \n", " if 'log' in gal['Lbol/Lsun intrinsic']:\n", " gal['Lbol/Lsun intrinsic'] = '-99'\n", " #gal['Lbol/Lsun intrinsic'] = gal['Lbol/Lsun intrinsic'].replace('logSFR', '')\n", " #gal['Lbol/Lsun intrinsic'] = gal['Lbol/Lsun intrinsic'].replace('logFIR', '')\n", " #gal['Lbol/Lsun intrinsic'] = gal['Lbol/Lsun intrinsic'].replace('=', '')\n", " #gal['Lbol/Lsun intrinsic'] = gal['Lbol/Lsun intrinsic'].replace('~', '')\n", " elif not (('e' in gal['Lbol/Lsun intrinsic']) \n", " or ('E' in gal['Lbol/Lsun intrinsic'])):\n", " gal['Lbol/Lsun intrinsic'] = str(10** float(gal['Lbol/Lsun intrinsic']) )\n", "\n", "\n", "giants['Redshift'] = giants['Redshift'].astype(float)\n", "giants['Redshift'][giants['Redshift'] < 0] =np.nan\n", "\n", "giants['Lbol/Lsun intrinsic'][giants['Lbol/Lsun intrinsic'] == ''] = '-99'\n", "giants['Lbol/Lsun intrinsic'] = giants['Lbol/Lsun intrinsic'].astype(float)\n", "giants['Lbol/Lsun intrinsic'][giants['Lbol/Lsun intrinsic'] < 0] =np.nan\n", "\n", "giants['Lensed?'][giants['Lensed?'] == ''] = '-99'\n", "giants['Lensed?'] = giants['Lensed?'].astype(float)\n", "giants['Lensed?'][giants['Lensed?'] < 0] = np.nan" ] }, { "cell_type": "code", "execution_count": 8, "metadata": {}, "outputs": [], "source": [ "for gal in giants['Lbol/Lsun intrinsic'] :\n", " try:\n", " test = float(gal)\n", " except:\n", " print(gal)\n", " " ] }, { "cell_type": "code", "execution_count": 9, "metadata": {}, "outputs": [ { "data": { "text/html": [ "<Column name='Lbol/Lsun intrinsic' dtype='float64' length=105>\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", "
10000000000000.0
10100000000000.0
10200000000000.0
10600000000000.0
10700000000000.0
10800000000000.0
11000000000000.0
11100000000000.0
11200000000000.0
11300000000000.0
11500000000000.0
11600000000000.0
...
nan
nan
nan
nan
nan
nan
nan
nan
nan
nan
nan
nan
" ], "text/plain": [ "\n", "10000000000000.0\n", "10100000000000.0\n", "10200000000000.0\n", "10600000000000.0\n", "10700000000000.0\n", "10800000000000.0\n", "11000000000000.0\n", "11100000000000.0\n", "11200000000000.0\n", "11300000000000.0\n", "11500000000000.0\n", "11600000000000.0\n", " ...\n", " nan\n", " nan\n", " nan\n", " nan\n", " nan\n", " nan\n", " nan\n", " nan\n", " nan\n", " nan\n", " nan\n", " nan" ] }, "execution_count": 9, "metadata": {}, "output_type": "execute_result" } ], "source": [ "np.unique(giants['Lbol/Lsun intrinsic'])" ] }, { "cell_type": "code", "execution_count": 10, "metadata": {}, "outputs": [], "source": [ "giants['RA'].name = 'ra'\n", "giants['Dec'].name = 'dec'\n", "giants['Redshift'].name = 'redshift'\n", "giants['Lbol/Lsun intrinsic'].name = 'lbol_intrinsic'\n", "giants['Lensed?'].name = 'mu_lens'" ] }, { "cell_type": "code", "execution_count": 11, "metadata": {}, "outputs": [], "source": [ "giants.add_column(Column(gen_help_id(giants['ra'], giants['dec']),\n", " name=\"help_id\"))\n", "giants.add_column(Column(np.full(len(giants), \"\", dtype='Table length=10\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "
idxhelp_idhp_idxfieldradecredshiftlbol_intrinsicmu_lenssfr
0HELP_rare_J020941.300+001558.600291882535Herschel-Stripe-8232.422083333333330.266277777772.55310000000000000.010.0nan
1HELP_rare_J132934.180+224327.300167978479202.3924166666666322.72424999992.043913000000000000.011.0nan
2HELP_rare_J021830.700-053131.000289810432XMM-LSS34.62791666666666-5.52527777773.413000000000000.05.0nan
3HELP_rare_J154506.350-344318.200700199708236.2764583333333-34.721722222nan10000000000000.0nannan
4HELP_rare_J154132.710-350323.300700044386235.38629166666664-35.0564722223.050118723362727.151.2nan
5HELP_rare_J123712.000+622212.100184354581HDF-N189.2999999999999862.37002777774.0629000000000000.0nannan
6HELP_rare_J010311.500-453853.90257993961715.797917-45.6483063.091716700000000000.05.34nan
7HELP_rare_J012507.080-472356.00057401751121.2795-47.3988892.514833300000000000.05.47nan
8HELP_rare_J024308.810-462124.30055336492040.786708-46.356755.69916300000000000.05.09nan
9HELP_rare_J030004.370-462124.30055343556645.018208-46.356753.595412600000000000.06.3nan
\n", "\n" ], "text/plain": [ "" ] }, "execution_count": 14, "metadata": {}, "output_type": "execute_result" } ], "source": [ "giants['help_id', \n", " 'hp_idx',\n", " 'field', \n", " 'ra', \n", " 'dec', \n", " 'redshift', \n", " 'lbol_intrinsic',\n", " 'mu_lens', \n", " 'sfr'][:10].show_in_notebook()" ] }, { "cell_type": "code", "execution_count": 15, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "116" ] }, "execution_count": 15, "metadata": {}, "output_type": "execute_result" } ], "source": [ "len(giants)" ] }, { "cell_type": "code", "execution_count": 16, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "0" ] }, "execution_count": 16, "metadata": {}, "output_type": "execute_result" } ], "source": [ "np.sum(giants['lbol_intrinsic'] == np.nan)" ] }, { "cell_type": "code", "execution_count": 17, "metadata": {}, "outputs": [], "source": [ "giants['help_id', \n", " 'hp_idx',\n", " 'field', \n", " 'ra', \n", " 'dec', \n", " 'redshift', \n", " 'lbol_intrinsic',\n", " 'mu_lens',\n", " 'sfr'].write('./data/rare_objects.csv', overwrite=True)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "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 }