{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Herschel Stripe 82 master catalogue\n", "## Preparation of Spitzer SHELA data\n", "\n", "The Spitzer/HETDEX Exploratory Large-Area (SHELA) survey covers ~24 sq. deg at 3.6 and 4.5 microns. The Spitzer/SHELA catalogues are available in `dmu0_SHELA`.\n", "\n", "In the catalouge, we keep:\n", "\n", "- The internal identifier;\n", "- The position;\n", "- The fluxes in 4 arcsecond apertures;\n", "- The “auto” flux;\n" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "This notebook was run with herschelhelp_internal version: \n", "33f5ec7 (Wed Dec 6 16:56:17 2017 +0000)\n" ] } ], "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": 2, "metadata": {}, "outputs": [], "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", "from collections import OrderedDict\n", "import os\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", "\n", "from herschelhelp_internal.flagging import gaia_flag_column\n", "from herschelhelp_internal.masterlist import nb_astcor_diag_plot, remove_duplicates\n", "from herschelhelp_internal.utils import astrometric_correction, flux_to_mag" ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "collapsed": true }, "outputs": [], "source": [ "OUT_DIR = os.environ.get('TMP_DIR', \"./data_tmp\")\n", "try:\n", " os.makedirs(OUT_DIR)\n", "except FileExistsError:\n", " pass\n", "\n", "RA_COL = \"shela_ra\"\n", "DEC_COL = \"shela_dec\"" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## I - Column selection" ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "collapsed": true }, "outputs": [], "source": [ "#IRAC1 = 3.6 um\n", "#IRAC2 = 4.5 um\n", "#No stelarity \n", "\n", "imported_columns = OrderedDict({\n", " 'ID': \"shela_intid\",\n", " 'RA': \"shela_ra\",\n", " 'DEC': \"shela_dec\",\n", " 'F3P6_AUTO': \"f_shela_irac1\",\n", " 'F3P6ERR_AUTO': \"ferr_shela_irac1\",\n", " 'F3P6_4ARCS': \"f_ap_shela_irac1\",\n", " 'F3P6ERR_4ARCS': \"ferr_ap_shela_irac1\",\n", " 'F4P5_AUTO': \"f_shela_irac2\",\n", " 'F4P5ERR_AUTO': \"ferr_shela_irac2\",\n", " 'F4P5_4ARCS': \"f_ap_shela_irac2\",\n", " 'F4P5ERR_4ARCS': \"ferr_ap_shela_irac2\"\n", " })\n", "\n", "\n", "catalogue = Table.read(\"../../dmu0/dmu0_SHELA/data/shela_irac_v1.3_flux_cat.fits\")[list(imported_columns)]\n", "for column in imported_columns:\n", " catalogue[column].name = imported_columns[column]\n", "\n", "epoch = 2009\n", "\n", "# Clean table metadata\n", "catalogue.meta = None" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "/opt/herschelhelp_internal/herschelhelp_internal/utils.py:76: RuntimeWarning: invalid value encountered in log10\n", " magnitudes = 2.5 * (23 - np.log10(fluxes)) - 48.6\n" ] } ], "source": [ "# Adding magnitude and band-flag columns\n", "for col in catalogue.colnames:\n", " if col.startswith('f_'):\n", " errcol = \"ferr{}\".format(col[1:])\n", " \n", " # Note that some fluxes are 0.\n", " catalogue[col][np.isclose(catalogue[col], 0.)] = np.nan\n", " catalogue[errcol][np.isclose(catalogue[errcol], 0.)] = np.nan\n", " \n", " magnitude, error = flux_to_mag(\n", " np.array(catalogue[col])/1.e6, np.array(catalogue[errcol])/1.e6)\n", " \n", " \n", " catalogue.add_column(Column(magnitude, name=\"m{}\".format(col[1:])))\n", " catalogue.add_column(Column(error, name=\"m{}\".format(errcol[1:])))\n", " \n", " # Band-flag column\n", " if \"ap\" not in col:\n", " catalogue.add_column(Column(np.zeros(len(catalogue), dtype=bool), name=\"flag{}\".format(col[1:])))\n" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [ { "data": { "text/html": [ "<Table length=10>\n", "
idx | shela_intid | shela_ra | shela_dec | f_shela_irac1 | ferr_shela_irac1 | f_ap_shela_irac1 | ferr_ap_shela_irac1 | f_shela_irac2 | ferr_shela_irac2 | f_ap_shela_irac2 | ferr_ap_shela_irac2 | m_shela_irac1 | merr_shela_irac1 | flag_shela_irac1 | m_ap_shela_irac1 | merr_ap_shela_irac1 | m_shela_irac2 | merr_shela_irac2 | flag_shela_irac2 | m_ap_shela_irac2 | merr_ap_shela_irac2 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | 1 | 15.4756838087 | -1.36443322375 | nan | nan | nan | nan | 11.1052 | 0.452289 | 14.0416 | 2.15102 | nan | nan | False | nan | nan | 21.2862 | 0.0442196 | False | 21.0315 | 0.166323 |
1 | 2 | 15.4740823478 | -1.36373876082 | nan | nan | nan | nan | 9.96681 | 0.42848 | 13.6084 | 1.69246 | nan | nan | False | nan | nan | 21.4036 | 0.0466766 | False | 21.0655 | 0.135032 |
2 | 3 | 15.4764671284 | -1.36319564707 | nan | nan | nan | nan | 9.22456 | 0.412217 | 12.2394 | 1.66885 | nan | nan | False | nan | nan | 21.4876 | 0.0485182 | False | 21.1806 | 0.148041 |
3 | 4 | 14.6648752838 | -1.36060981938 | nan | nan | nan | nan | -0.0952322 | nan | -1.22805 | 4.53532 | nan | nan | False | nan | nan | nan | nan | False | nan | -4.00973 |
4 | 5 | 14.669433439 | -1.36236619592 | nan | nan | nan | nan | 31.999 | 0.767752 | 22.2785 | 1.71998 | nan | nan | False | nan | nan | 20.1372 | 0.0260501 | False | 20.5303 | 0.0838229 |
5 | 6 | 15.4684264607 | -1.36181616808 | nan | nan | nan | nan | 6.0504 | 0.333845 | 10.9947 | 1.65931 | nan | nan | False | nan | nan | 21.9455 | 0.0599081 | False | 21.297 | 0.163858 |
6 | 7 | 14.677735725 | -1.36068860967 | nan | nan | nan | nan | 28.2057 | 0.720811 | 35.4973 | 2.39602 | nan | nan | False | nan | nan | 20.2742 | 0.0277465 | False | 20.0245 | 0.0732857 |
7 | 8 | 16.2727708794 | -1.36338582978 | nan | nan | nan | nan | 24.0789 | 0.665996 | 29.4516 | 2.37547 | nan | nan | False | nan | nan | 20.4459 | 0.0300302 | False | 20.2272 | 0.087572 |
8 | 9 | 16.2775800352 | -1.36178700509 | nan | nan | nan | nan | 29.4416 | 0.736433 | 28.0638 | 2.37078 | nan | nan | False | nan | nan | 20.2276 | 0.0271579 | False | 20.2796 | 0.0917209 |
9 | 10 | 14.6715473473 | -1.36114361198 | nan | nan | nan | nan | 68.9906 | 1.12732 | 61.2276 | 1.91793 | nan | nan | False | nan | nan | 19.303 | 0.0177412 | False | 19.4326 | 0.0340102 |