{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# AKARI-NEP master catalogue\n", "## Preparation of Spitzer datafusion SERVS data\n", "\n", "The Spitzer catalogues are available in `dmu0_NEP-Spitzer`.\n", "\n", "In the catalouge, we keep:\n", "\n", "- The internal identifier (this one is only in HeDaM data);\n", "- The position;\n", "- The fluxes in aperture 2 (1.9 arcsec); CHECK!\n", "- The “auto” flux (which seems to be the Kron flux);\n", "- The stellarity in each band\n", "\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()))\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 = \"nep_ra\"\n", "DEC_COL = \"nep_dec\"" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## I - Column selection" ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "collapsed": true }, "outputs": [], "source": [ "imported_columns = OrderedDict({\n", " 'nep_id': \"nep_id\",\n", " 'ra': \"nep_ra\",\n", " 'dec': \"nep_dec\",\n", " 'm_irac_i1': \"m_irac_i1\",\n", " 'merr_irac_i1': \"merr_irac_i1\",\n", " 'm_ap2_irac_i1': \"m_ap_irac_i1\",\n", " 'merr_ap2_irac_i1': \"merr_ap_irac_i1\",\n", " 'm_irac_i2': \"m_irac_i2\",\n", " 'merr_irac_i2': \"merr_irac_i2\",\n", " 'm_ap2_irac_i2': \"m_ap_irac_i2\",\n", " 'merr_ap2_irac_i2': \"merr_ap_irac_i2\",\n", " 'irac_stellarity': \"irac_stellarity\",\n", " })\n", "\n", "\n", "catalogue = Table.read(\"../../dmu0/dmu0_NEP-Spitzer/data/NEP-Spitzer-APJ.fits\")[list(imported_columns)]\n", "for column in imported_columns:\n", " catalogue[column].name = imported_columns[column]\n", "\n", "epoch = 2017 #Paper year\n", "\n", "# Clean table metadata\n", "catalogue.meta = None" ] }, { "cell_type": "code", "execution_count": 5, "metadata": { "collapsed": true }, "outputs": [], "source": [ "# Adding magnitude and band-flag columns\n", "for col in catalogue.colnames:\n", " if col.startswith('m_'):\n", " errcol = \"merr{}\".format(col[1:])\n", " \n", " catalogue[col][catalogue[col] > 90.] = np.nan\n", " catalogue[errcol][catalogue[errcol] > 90.] = np.nan\n", " \n", " flux, error = mag_to_flux(\n", " np.array(catalogue[col]), np.array(catalogue[errcol]))\n", " # Note that some fluxes are 0.\n", " \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" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [ { "data": { "text/html": [ "<Table length=10>\n", "
idx | nep_id | nep_ra | nep_dec | m_irac_i1 | merr_irac_i1 | m_ap_irac_i1 | merr_ap_irac_i1 | m_irac_i2 | merr_irac_i2 | m_ap_irac_i2 | merr_ap_irac_i2 | irac_stellarity | f_irac_i1 | ferr_irac_i1 | flag_irac_i1 | f_ap_irac_i1 | ferr_ap_irac_i1 | f_irac_i2 | ferr_irac_i2 | flag_irac_i2 | f_ap_irac_i2 | ferr_ap_irac_i2 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | 1 | 273.7195508 | 67.6020944 | 20.0904 | 0.1119 | 20.686 | 0.074 | nan | nan | nan | nan | 0.87 | 33.4072 | 3.44306 | False | 19.3019 | 1.31555 | nan | nan | False | nan | nan |
1 | 2 | 273.7079238 | 67.5936062 | 21.4044 | 0.1481 | 21.3677 | 0.1263 | nan | nan | nan | nan | 0.17 | 9.95956 | 1.35853 | False | 10.302 | 1.19839 | nan | nan | False | nan | nan |
2 | 3 | 273.7080787 | 67.6001747 | 20.577 | 0.121 | 20.8622 | 0.0846 | nan | nan | nan | nan | 0.15 | 21.3403 | 2.37827 | False | 16.4104 | 1.27869 | nan | nan | False | nan | nan |
3 | 4 | 273.7103561 | 67.6041043 | 20.239 | 0.1054 | 21.0816 | 0.1006 | nan | nan | nan | nan | 0.21 | 29.134 | 2.82824 | False | 13.4079 | 1.24232 | nan | nan | False | nan | nan |
4 | 5 | 273.7118783 | 67.6008184 | 20.1982 | 0.0969 | 20.788 | 0.0799 | nan | nan | nan | nan | 0.03 | 30.2496 | 2.69972 | False | 17.5711 | 1.29307 | nan | nan | False | nan | nan |
5 | 6 | 273.7151038 | 67.5701698 | 21.1438 | 0.1157 | 21.3254 | 0.122 | nan | nan | nan | nan | 0.68 | 12.6613 | 1.34924 | False | 10.7112 | 1.20358 | nan | nan | False | nan | nan |
6 | 7 | 273.7144146 | 67.5716953 | 21.3467 | 0.1788 | 20.7915 | 0.0802 | nan | nan | nan | nan | 0.93 | 10.5031 | 1.72967 | False | 17.5146 | 1.29375 | nan | nan | False | nan | nan |
7 | 8 | 273.7058254 | 67.5949433 | 21.8841 | 0.278 | 21.597 | 0.1528 | nan | nan | nan | nan | 0.15 | 6.40265 | 1.63938 | False | 8.34065 | 1.17381 | nan | nan | False | nan | nan |
8 | 9 | 273.703809 | 67.5960837 | 21.118 | 0.1838 | 21.0088 | 0.0948 | nan | nan | nan | nan | 0.13 | 12.9658 | 2.19493 | False | 14.3377 | 1.25188 | nan | nan | False | nan | nan |
9 | 10 | 273.7027409 | 67.6027532 | 20.5699 | 0.1076 | 20.7601 | 0.0781 | nan | nan | nan | nan | 0.17 | 21.4803 | 2.12877 | False | 18.0285 | 1.29684 | nan | nan | False | nan | nan |