{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "## EGS master catalogue\n", "## Preparation of AEGIS data\n", "\n", "This resource contains the near-infrared catalogue of Extended Groth Strip observations with the WIRC instrument at the Palomar Observatory.: the catalogue comes from `dmu0_AEGIS`.\n", "\n", "In the catalogue, we keep:\n", "\n", "- The identifier (it's unique in the catalogue);\n", "- The position;\n", "- The magnitude for each band in 2 arcsecond aperture.\n", "- The auto magnitude to be used as total magnitude.\n", "\n", "We don't know when the maps have been observed. We will use the year of the reference paper." ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "This notebook was run with herschelhelp_internal version: \n", "0246c5d (Thu Jan 25 17:01:47 2018 +0000) [with local modifications]\n", "This notebook was executed on: \n", "2018-02-07 19:28:01.897812\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": { "collapsed": true }, "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, mag_to_flux" ] }, { "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 = \"aegis_ra\"\n", "DEC_COL = \"aegis_dec\"" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## I - Column selection" ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "collapsed": true }, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "WARNING: UnitsWarning: 'vega' did not parse as fits unit: At col 0, Unit 'vega' not supported by the FITS standard. [astropy.units.core]\n" ] } ], "source": [ "imported_columns = OrderedDict({\n", " 'id': \"aegis_id\",\n", " 'ra': \"aegis_ra\",\n", " 'dec': \"aegis_dec\",\n", " 'kmag_auto': \"m_aegis_k\", \n", " 'kerr2_auto': \"merr_aegis_k\", \n", " 'kmag_d2': \"m_ap_aegis_k\", \n", " 'kerr2_d2': \"merr_ap_aegis_k\",\n", " #'jmag_auto': \"m_aegis_j\", \n", " #'jerr2_auto': \"merr_aegis_j\", \n", " 'jmag_d2': \"m_ap_aegis_j\", \n", " 'jerr2_d2': \"merr_ap_aegis_j\"\n", " })\n", "\n", "\n", "catalogue = Table.read(\"../../dmu0/dmu0_AEGIS/data/EGS_Palomar_20160804.fits\")[list(imported_columns)]\n", "for column in imported_columns:\n", " catalogue[column].name = imported_columns[column]\n", "\n", "epoch = 2011\n", "\n", "# Clean table metadata\n", "catalogue.meta = None" ] }, { "cell_type": "code", "execution_count": 5, "metadata": { "collapsed": true }, "outputs": [], "source": [ "#AB correction\n", "#Values from http://svo2.cab.inta-csic.es/svo/theory/fps/index.php?id=P200/WIRC.Ks&&mode=browse&gname=P200&gname2=WIRC#filter\n", "j_vega_to_ab = -2.5 * np.log10 (1564.9/3631) # = +0.85 (WIRC.J_ori)\n", "ks_vega_to_ab = -2.5 * np.log10 (676.92/3631) # = +1.82 (WIRC.Ks) #The K band in AEGIS is Ks\n" ] }, { "cell_type": "code", "execution_count": 6, "metadata": { "collapsed": true }, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "/opt/anaconda3/envs/herschelhelp_internal/lib/python3.6/site-packages/astropy/table/column.py:1096: MaskedArrayFutureWarning: setting an item on a masked array which has a shared mask will not copy the mask and also change the original mask array in the future.\n", "Check the NumPy 1.11 release notes for more information.\n", " ma.MaskedArray.__setitem__(self, index, value)\n" ] } ], "source": [ "# Adding flux and band-flag columns\n", "for col in catalogue.colnames:\n", " if col.startswith('m_'):\n", " \n", " errcol = \"merr{}\".format(col[1:])\n", " catalogue[errcol].unit = u.mag\n", " \n", " # Some object have a magnitude to 0, we suppose this means missing value\n", " catalogue[col][catalogue[col] <= 0] = np.nan\n", " catalogue[errcol][catalogue[errcol] <= 0] = np.nan \n", " \n", " #TODO convert Vega to AB\n", " if col.endswith('j') :\n", " catalogue[col] += j_vega_to_ab\n", " catalogue[col].unit = u.mag\n", " if col.endswith('k') :\n", " catalogue[col] += ks_vega_to_ab\n", " catalogue[col].unit = u.mag\n", "\n", " flux, error = mag_to_flux(np.array(catalogue[col]), np.array(catalogue[errcol]))\n", " \n", " # Fluxes are added in µJy\n", " catalogue.add_column(Column(flux * 1.e6, name=\"f{}\".format(col[1:])))\n", " catalogue.add_column(Column(error * 1.e6, name=\"f{}\".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", "\n", "#Add nans for total J which is absent\n", "catalogue.add_column(Column(np.full(len(catalogue), np.nan), name=\"m_aegis_j\"))\n", "catalogue.add_column(Column(np.full(len(catalogue), np.nan), name=\"merr_aegis_j\")) \n", "catalogue.add_column(Column(np.full(len(catalogue), np.nan), name=\"f_aegis_j\"))\n", "catalogue.add_column(Column(np.full(len(catalogue), np.nan), name=\"ferr_aegis_j\")) \n", "catalogue.add_column(Column(np.zeros(len(catalogue), dtype=bool), name=\"flag_aegis_j\"))\n", "\n", "# TODO: Set to True the flag columns for fluxes that should not be used for SED fitting." ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [ { "data": { "text/html": [ "<Table masked=True length=10>\n", "
idx | aegis_id | aegis_ra | aegis_dec | m_aegis_k | merr_aegis_k | m_ap_aegis_k | merr_ap_aegis_k | m_ap_aegis_j | merr_ap_aegis_j | f_aegis_k | ferr_aegis_k | flag_aegis_k | f_ap_aegis_k | ferr_ap_aegis_k | f_ap_aegis_j | ferr_ap_aegis_j | m_aegis_j | merr_aegis_j | f_aegis_j | ferr_aegis_j | flag_aegis_j |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
deg | deg | mag | mag | mag | mag | mag | mag | ||||||||||||||
0 | 13007537 | 215.331927681 | 52.8902605162 | 19.0342 | 0.01 | 19.09 | 0.01 | nan | nan | 88.3712 | 0.813928 | False | 83.9442 | 0.773155 | nan | nan | nan | nan | nan | nan | False |
1 | 13007941 | 215.330088169 | 52.8904931474 | 17.4222 | 0.01 | 17.4919 | 0.01 | nan | nan | 390.042 | 3.59242 | False | 365.789 | 3.36904 | nan | nan | nan | nan | nan | nan | False |
2 | 14032571 | 216.085718666 | 53.5785295298 | 20.3126 | 0.0964289 | 21.36 | 0.119386 | nan | nan | 27.2239 | 2.41787 | False | 10.3751 | 1.14083 | nan | nan | nan | nan | nan | nan | False |
3 | 14032744 | 216.090181416 | 53.5741556058 | 14.3728 | 0.01 | 14.7506 | 0.01 | nan | nan | 6469.51 | 59.5863 | False | 4568.26 | 42.0753 | nan | nan | nan | nan | nan | nan | False |
4 | 14032720 | 216.084020352 | 53.5729820348 | 19.9368 | 0.0697616 | 20.7002 | 0.0617199 | nan | nan | 38.4832 | 2.47265 | False | 19.0507 | 1.08296 | nan | nan | nan | nan | nan | nan | False |
5 | 14032727 | 216.090451274 | 53.5634705069 | 20.6986 | 0.130853 | 21.0305 | 0.0868168 | nan | nan | 19.0788 | 2.29938 | False | 14.0537 | 1.12375 | nan | nan | nan | nan | nan | nan | False |
6 | 14032681 | 216.089690047 | 53.5692761667 | 22.027 | 0.344351 | 21.9173 | 0.214116 | nan | nan | 5.61294 | 1.78019 | False | 6.2097 | 1.2246 | nan | nan | nan | nan | nan | nan | False |
7 | 14032829 | 216.089977317 | 53.5669255661 | 21.5342 | 0.265994 | 21.5749 | 0.157 | nan | nan | 8.83712 | 2.165 | False | 8.51198 | 1.23085 | nan | nan | nan | nan | nan | nan | False |
8 | 14032725 | 216.081357189 | 53.5677022584 | 21.2824 | 0.213335 | 21.5295 | 0.149057 | nan | nan | 11.1437 | 2.18962 | False | 8.87547 | 1.21848 | nan | nan | nan | nan | nan | nan | False |
9 | 14032575 | 216.079916033 | 53.5725773797 | 20.9343 | 0.157849 | 21.7104 | 0.180707 | nan | nan | 15.3557 | 2.23248 | False | 7.5133 | 1.25049 | nan | nan | nan | nan | nan | nan | False |