Skip to content

Commit

Permalink
Working on HDF-N
Browse files Browse the repository at this point in the history
Still have to choose between irac and wircam fluxes from Ultradeep and candels - will probably just take candels first then ultradeep where there are no candels #21
  • Loading branch information
raphaelshirley committed Dec 11, 2017
1 parent 2a2f1e1 commit 4c98eca
Show file tree
Hide file tree
Showing 7 changed files with 1,334 additions and 1,776 deletions.
234 changes: 19 additions & 215 deletions dmu1/dmu1_ml_HDF-N/1.1_CANDELS-3D-HST.ipynb

Large diffs are not rendered by default.

152 changes: 70 additions & 82 deletions dmu1/dmu1_ml_HDF-N/1.2_GOODS-ACS.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -7,32 +7,20 @@
"# HDF-N master catalogue\n",
"## Preparation of GOODS-ACS data\n",
"\n",
"The catalogue comes from `dmu0_CANDELS-3D-HST`.\n",
"\n",
"In the catalogue, we keep:\n",
"\n",
"- The identifier (it's unique in the catalogue);\n",
"- The position;\n",
"- The stellarity;\n",
"- The kron magnitude, there doesn't appear to be aperture magnitudes. This may mean the survey is unusable.\n",
"\n"
"The catalogue comes from GOODS-ACS but has been superseeded by CANDELS-GOODS-N so is not used here\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"cell_type": "markdown",
"metadata": {},
"outputs": [],
"source": [
"from herschelhelp_internal import git_version\n",
"print(\"This notebook was run with herschelhelp_internal version: \\n{}\".format(git_version()))"
]
},
{
"cell_type": "code",
"execution_count": null,
"cell_type": "markdown",
"metadata": {},
"outputs": [],
"source": [
"%matplotlib inline\n",
"#%config InlineBackend.figure_format = 'svg'\n",
Expand All @@ -45,7 +33,7 @@
"\n",
"from astropy import units as u\n",
"from astropy.coordinates import SkyCoord\n",
"from astropy.table import Column, Table\n",
"from astropy.table import Column, Table, join\n",
"import numpy as np\n",
"\n",
"from herschelhelp_internal.flagging import gaia_flag_column\n",
Expand All @@ -54,12 +42,10 @@
]
},
{
"cell_type": "code",
"execution_count": null,
"cell_type": "markdown",
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"OUT_DIR = os.environ.get('TMP_DIR', \"./data_tmp\")\n",
"try:\n",
Expand All @@ -79,53 +65,75 @@
]
},
{
"cell_type": "code",
"execution_count": null,
"cell_type": "markdown",
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"b_catalogue = Table.read(\"../../dmu0/dmu0_GOODS-ACS/data/h_goods_nb_r2.0z_cat.fits\") #[list(imported_columns)]\n",
"i_catalogue = Table.read(\"../../dmu0/dmu0_GOODS-ACS/data/h_goods_ni_r2.0z_cat.fits\") #[list(imported_columns)]\n",
"v_catalogue = Table.read(\"../../dmu0/dmu0_GOODS-ACS/data/h_goods_nv_r2.0z_cat.fits\") #[list(imported_columns)]\n",
"z_catalogue = Table.read(\"../../dmu0/dmu0_GOODS-ACS/data/h_goods_nz_r2.0z_cat.fits\") #[list(imported_columns)]\n",
"\n",
"for column in b_catalogue.colnames:\n",
" if not b_catalogue[column].name == 'ID_IAU':\n",
" b_catalogue[column].name = 'b_' + b_catalogue[column].name \n",
"\n",
"for column in i_catalogue.colnames:\n",
" if not i_catalogue[column].name == 'ID_IAU':\n",
" i_catalogue[column].name = 'i_' + i_catalogue[column].name \n",
"\n",
"for column in v_catalogue.colnames:\n",
" if not v_catalogue[column].name == 'ID_IAU':\n",
" v_catalogue[column].name = 'v_' + v_catalogue[column].name \n",
" \n",
"for column in z_catalogue.colnames:\n",
" if not z_catalogue[column].name == 'ID_IAU':\n",
" z_catalogue[column].name = 'z_' + z_catalogue[column].name \n",
" \n",
"epoch = 2012 #Year of publication\n",
"\n",
"catalogue = b_catalogue\n",
"\n",
"catalogue = join(b_catalogue,i_catalogue, keys='ID_IAU')\n",
"catalogue = join(catalogue,v_catalogue, keys='ID_IAU')\n",
"catalogue = join(catalogue,z_catalogue, keys='ID_IAU')"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"catalogue[:10].show_in_notebook()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"imported_columns = OrderedDict({\n",
" 'ID': \"acs_id\",\n",
" 'RAJ2000': \"acs_ra\",\n",
" 'DEJ2000': \"acs_dec\",\n",
" 'S/G': \"acs_stellarity\",\n",
" 'F140Wap': \"f_ap_candels_f140w\",\n",
" 'e_F140Wap': \"ferr_ap_candels_f140w\",\n",
" 'F140W': \"f_candels_f140w\",\n",
" 'ID_IAU': \"acs_id\",\n",
" 'b_ALPHA_J2000': \"acs_ra\",\n",
" 'b_DELTA_J2000': \"acs_dec\",\n",
" 'b_MAG_AUTO': \"m_acs_b\",\n",
" 'b_MAGERR_AUTO': \"merr_acs_b\",\n",
" 'b_FLUX_AUTO': \"f_acs_b\",\n",
" 'b_FLUXERR_AUTO': \"ferr_acs_b\",\n",
" 'e_F140W': \"ferr_candels_f140w\",\n",
" 'F160Wap': \"f_ap_candels_f160w\",\n",
" 'e_F160Wap': \"ferr_ap_candels_f160w\",\n",
" 'F160W': \"f_candels_f160w\",\n",
" 'e_F160W': \"ferr_candels_f160w\",\n",
" 'F606W': \"f_candels_f606w\",\n",
" 'e_F606W': \"ferr_candels_f606w\",\n",
" 'F814W': \"f_candels_f814w\",\n",
" 'e_F814W': \"ferr_candels_f814w\",\n",
" 'F125W': \"f_candels_f125w\",\n",
" 'e_F125W': \"ferr_candels_f125w\"\n",
"\n",
" })\n",
"\n",
" })\n",
"catalogue = catalogue[list(imported_columns)]\n",
"\n",
"catalogue = Table.read(\"../../dmu0/dmu0_CANDELS-3D-HST/data/CANDELS-3D-HST_XMM-LSS.fits\")[list(imported_columns)]\n",
"for column in imported_columns:\n",
" catalogue[column].name = imported_columns[column]\n",
"\n",
"epoch = 2012 #Year of publication\n",
"\n",
"# Clean table metadata\n",
"catalogue.meta = None"
" catalogue[column].name = imported_columns[column]"
]
},
{
"cell_type": "code",
"execution_count": null,
"cell_type": "markdown",
"metadata": {},
"outputs": [],
"source": [
"# Adding flux and band-flag columns\n",
"\"Adding flux and band-flag columns\"\n",
"for col in catalogue.colnames:\n",
" if col.startswith('f_'):\n",
" \n",
Expand Down Expand Up @@ -160,14 +168,12 @@
" if \"ap\" not in col:\n",
" catalogue.add_column(Column(np.zeros(len(catalogue), dtype=bool), name=\"flag{}\".format(col[1:])))\n",
" \n",
"# TODO: Set to True the flag columns for fluxes that should not be used for SED fitting."
" TODO: Set to True the flag columns for fluxes that should not be used for SED fitting."
]
},
{
"cell_type": "code",
"execution_count": null,
"cell_type": "markdown",
"metadata": {},
"outputs": [],
"source": [
"catalogue[:10].show_in_notebook()"
]
Expand All @@ -187,10 +193,8 @@
]
},
{
"cell_type": "code",
"execution_count": null,
"cell_type": "markdown",
"metadata": {},
"outputs": [],
"source": [
"\n",
"SORT_COLS = ['merr_candels_f140w', \n",
Expand Down Expand Up @@ -221,32 +225,26 @@
]
},
{
"cell_type": "code",
"execution_count": null,
"cell_type": "markdown",
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"gaia = Table.read(\"../../dmu0/dmu0_GAIA/data/GAIA_XMM-LSS.fits\")\n",
"gaia_coords = SkyCoord(gaia['ra'], gaia['dec'])"
]
},
{
"cell_type": "code",
"execution_count": null,
"cell_type": "markdown",
"metadata": {},
"outputs": [],
"source": [
"nb_astcor_diag_plot(catalogue[RA_COL], catalogue[DEC_COL], \n",
" gaia_coords.ra, gaia_coords.dec)"
]
},
{
"cell_type": "code",
"execution_count": null,
"cell_type": "markdown",
"metadata": {},
"outputs": [],
"source": [
"delta_ra, delta_dec = astrometric_correction(\n",
" SkyCoord(catalogue[RA_COL], catalogue[DEC_COL]),\n",
Expand All @@ -258,22 +256,18 @@
]
},
{
"cell_type": "code",
"execution_count": null,
"cell_type": "markdown",
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"catalogue[RA_COL] += delta_ra.to(u.deg)\n",
"catalogue[DEC_COL] += delta_dec.to(u.deg)"
]
},
{
"cell_type": "code",
"execution_count": null,
"cell_type": "markdown",
"metadata": {},
"outputs": [],
"source": [
"nb_astcor_diag_plot(catalogue[RA_COL], catalogue[DEC_COL], \n",
" gaia_coords.ra, gaia_coords.dec)"
Expand All @@ -287,23 +281,19 @@
]
},
{
"cell_type": "code",
"execution_count": null,
"cell_type": "markdown",
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"catalogue.add_column(\n",
" gaia_flag_column(SkyCoord(catalogue[RA_COL], catalogue[DEC_COL]), epoch, gaia)\n",
")"
]
},
{
"cell_type": "code",
"execution_count": null,
"cell_type": "markdown",
"metadata": {},
"outputs": [],
"source": [
"GAIA_FLAG_NAME = \"candels_flag_gaia\"\n",
"\n",
Expand All @@ -326,12 +316,10 @@
]
},
{
"cell_type": "code",
"execution_count": null,
"cell_type": "markdown",
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"catalogue.write(\"{}/CANDELS.fits\".format(OUT_DIR), overwrite=True)"
]
Expand Down
Loading

0 comments on commit 4c98eca

Please sign in to comment.