{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# AKARI-NEP master catalogue\n", "## Preparation of AKARI-NEP-OptNIR data\n", "\n", "This product contains the 8-band (u*, g', r', i', z', Y, J, Ks) optical to\n", "near-infrared catalogue from Oi et al., 2014.\n", "\n", "- The identifier (it's unique in the catalogue);\n", "- The position;\n", "- The stellarity;\n", "- The total magnitude for each band (u*, g', r', i', z', Y, J, Ks).\n", "- There are no aperture mags so we put empty columns in the masterlist.\n", "\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-15 20:31:07.859038\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": {}, "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 = \"akari_ra\"\n", "DEC_COL = \"akari_dec\"" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## I - Column selection" ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "collapsed": true }, "outputs": [], "source": [ "imported_columns = OrderedDict({\n", " 'OBJID': \"akari_id\",\n", " 'RAJ2000': \"akari_ra\",\n", " 'DEJ2000': \"akari_dec\",\n", " 'stl': \"akari_stellarity\",\n", " 'umag': \"m_megacam_u\",\n", " 'e_umag': \"merr_megacam_u\",\n", " 'gmag': \"m_megacam_g\",\n", " 'e_gmag': \"merr_megacam_g\",\n", " 'rmag': \"m_megacam_r\",\n", " 'e_rmag': \"merr_megacam_r\",\n", " 'imag': \"m_megacam_i\",\n", " 'e_imag': \"merr_megacam_i\",\n", " 'zmag': \"m_megacam_z\",\n", " 'e_zmag': \"merr_megacam_z\",\n", " 'Ymag': \"m_wircam_y\",\n", " 'e_Ymag': \"merr_wircam_y\",\n", " 'Jmag': \"m_wircam_j\",\n", " 'e_Jmag': \"merr_wircam_j\",\n", " 'Kmag': \"m_wircam_ks\",\n", " 'e_Kmag': \"merr_wircam_ks\"\n", " })\n", "\n", "\n", "catalogue = Table.read(\"../../dmu0/dmu0_AKARI-NEP-OptNIR/data/AKARI-NEP_OptNIR.fits\")[list(imported_columns)]\n", "for column in imported_columns:\n", " catalogue[column].name = imported_columns[column]\n", "\n", "epoch = 2014 #This is the paper year. The observations are multi-epoch\n", "\n", "# Clean table metadata\n", "catalogue.meta = None" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "/opt/anaconda3/envs/herschelhelp_internal/lib/python3.6/site-packages/ipykernel/__main__.py:8: RuntimeWarning: invalid value encountered in less_equal\n", "/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", "/opt/anaconda3/envs/herschelhelp_internal/lib/python3.6/site-packages/ipykernel/__main__.py:9: RuntimeWarning: invalid value encountered in less_equal\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", " \n", " # Bad values = -99\n", " catalogue[col][catalogue[col] <= -90.] = np.nan\n", " catalogue[errcol][catalogue[errcol] <= -90.] = np.nan \n", " \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", " # We add nan filled aperture photometry for consistency\n", " #catalogue.add_column(Column(np.full(len(catalogue), np.nan), name=\"m_ap{}\".format(col[1:])))\n", " #catalogue.add_column(Column(np.full(len(catalogue), np.nan), name=\"merr_ap{}\".format(col[1:])))\n", " #catalogue.add_column(Column(np.full(len(catalogue), np.nan), name=\"f_ap{}\".format(col[1:])))\n", " #catalogue.add_column(Column(np.full(len(catalogue), np.nan), name=\"ferr_ap{}\".format(col[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", "# TODO: Set to True the flag columns for fluxes that should not be used for SED fitting." ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [ { "data": { "text/html": [ "<Table masked=True length=10>\n", "
idx | akari_id | akari_ra | akari_dec | akari_stellarity | m_megacam_u | merr_megacam_u | m_megacam_g | merr_megacam_g | m_megacam_r | merr_megacam_r | m_megacam_i | merr_megacam_i | m_megacam_z | merr_megacam_z | m_wircam_y | merr_wircam_y | m_wircam_j | merr_wircam_j | m_wircam_ks | merr_wircam_ks | f_megacam_u | ferr_megacam_u | flag_megacam_u | f_megacam_g | ferr_megacam_g | flag_megacam_g | f_megacam_r | ferr_megacam_r | flag_megacam_r | f_megacam_i | ferr_megacam_i | flag_megacam_i | f_megacam_z | ferr_megacam_z | flag_megacam_z | f_wircam_y | ferr_wircam_y | flag_wircam_y | f_wircam_j | ferr_wircam_j | flag_wircam_j | f_wircam_ks | ferr_wircam_ks | flag_wircam_ks |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
deg | deg | mag | mag | mag | mag | mag | mag | mag | mag | mag | mag | mag | mag | mag | mag | mag | mag | |||||||||||||||||||||||||||
0 | 1 | 269.229 | 66.0392 | 0.65 | nan | nan | nan | nan | 23.788 | 0.099 | nan | nan | 22.973 | 0.152 | nan | nan | nan | nan | nan | nan | nan | nan | False | nan | nan | False | 1.10866 | 0.101091 | False | nan | nan | False | 2.34855 | 0.328791 | False | nan | nan | False | nan | nan | False | nan | nan | False |
1 | 2 | 269.2702 | 66.0392 | 0.98 | nan | nan | nan | nan | 22.688 | 0.052 | nan | nan | 20.445 | 0.024 | nan | nan | nan | nan | nan | nan | nan | nan | False | nan | nan | False | 3.05351 | 0.146244 | False | nan | nan | False | 24.0991 | 0.532705 | False | nan | nan | False | nan | nan | False | nan | nan | False |
2 | 3 | 269.4974 | 66.0392 | 0.61 | nan | nan | nan | nan | 23.494 | 0.109 | nan | nan | 23.388 | 0.172 | nan | nan | nan | nan | nan | nan | nan | nan | False | nan | nan | False | 1.45345 | 0.145916 | False | nan | nan | False | 1.60251 | 0.253866 | False | nan | nan | False | nan | nan | False | nan | nan | False |
3 | 4 | 269.2482 | 66.0398 | 0.93 | nan | nan | 24.064 | 0.111 | 23.096 | 0.078 | 22.434 | 0.091 | 22.444 | 0.129 | nan | nan | nan | nan | nan | nan | nan | nan | False | 0.859805 | 0.087902 | False | 2.09701 | 0.15065 | False | 3.85834 | 0.323383 | False | 3.82296 | 0.454219 | False | nan | nan | False | nan | nan | False | nan | nan | False |
4 | 5 | 269.215 | 66.0398 | 0.74 | nan | nan | 23.649 | 0.075 | 23.042 | 0.067 | 23.11 | 0.132 | 22.689 | 0.143 | nan | nan | nan | nan | nan | nan | nan | nan | False | 1.26009 | 0.0870436 | False | 2.20394 | 0.136004 | False | 2.07014 | 0.25168 | False | 3.05071 | 0.401802 | False | nan | nan | False | nan | nan | False | nan | nan | False |
5 | 6 | 269.6501 | 66.0388 | 0.95 | nan | nan | nan | nan | 23.088 | 0.064 | nan | nan | 21.875 | 0.086 | nan | nan | nan | nan | nan | nan | nan | nan | False | nan | nan | False | 2.11252 | 0.124525 | False | nan | nan | False | 6.45654 | 0.511416 | False | nan | nan | False | nan | nan | False | nan | nan | False |
6 | 7 | 268.6354 | 66.0399 | 0.9 | nan | nan | nan | nan | 24.56 | 0.174 | 23.538 | 0.159 | 22.796 | 0.159 | nan | nan | nan | nan | nan | nan | nan | nan | False | nan | nan | False | 0.544503 | 0.087262 | False | 1.39572 | 0.204396 | False | 2.76439 | 0.40483 | False | nan | nan | False | nan | nan | False | nan | nan | False |
7 | 8 | 268.5935 | 66.0396 | 0.59 | nan | nan | 22.933 | 0.038 | 22.277 | 0.034 | 21.918 | 0.059 | 22.114 | 0.071 | nan | nan | nan | nan | nan | nan | nan | nan | False | 2.43669 | 0.0852823 | False | 4.45861 | 0.139622 | False | 6.20583 | 0.337231 | False | 5.18084 | 0.338793 | False | nan | nan | False | nan | nan | False | nan | nan | False |
8 | 9 | 269.4868 | 66.0395 | 0.75 | nan | nan | 23.847 | 0.085 | 22.776 | 0.074 | 22.639 | 0.109 | 22.57 | 0.131 | nan | nan | nan | nan | nan | nan | nan | nan | False | 1.05003 | 0.0822043 | False | 2.81579 | 0.191914 | False | 3.19448 | 0.320702 | False | 3.40408 | 0.410721 | False | nan | nan | False | nan | nan | False | nan | nan | False |
9 | 10 | 269.4819 | 66.0394 | 0.97 | nan | nan | 24.752 | 0.131 | 23.29 | 0.065 | 22.614 | 0.062 | 21.96 | 0.066 | nan | nan | nan | nan | nan | nan | nan | nan | False | 0.456247 | 0.0550487 | False | 1.75388 | 0.105 | False | 3.26888 | 0.186667 | False | 5.97035 | 0.362927 | False | nan | nan | False | nan | nan | False | nan | nan | False |