{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# AKARI-SEP master catalogue\n", "## Preparation of Spitzer SIMES data\n", "\n", "The Spitzer catalogues were produced by the datafusion team are available in `dmu0_SIMES`.\n", "Lucia told that the magnitudes are aperture corrected.\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 1 (4.8 arcsec);\n", "- The total flux;\n", "- The stellarity in each band\n", "\n", "Paper descirbing data:\n", "http://irsa.ipac.caltech.edu/data/SPITZER/SEP/documentation/baronchelli16.pdf\n" ] }, { "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" ] } ], "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": { "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, 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 = \"simes_ra\"\n", "DEC_COL = \"simes_dec\"" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## I - Column selection" ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "collapsed": true }, "outputs": [], "source": [ "imported_columns = OrderedDict({\n", " 'ID': \"simes_id\",\n", " 'ra': \"simes_ra\",\n", " 'dec': \"simes_dec\",\n", " 'FLUX_I1': \"f_irac_i1\",\n", " 'FLUXERR_I1': \"ferr_irac_i1\",\n", " 'AP1_FLUX_I1': \"f_ap_irac_i1\",\n", " 'AP1_FLUXERR_I1': \"ferr_ap_irac_i1\",\n", " 'CLASS_STAR_I1': \"simes_stellarity\",\n", " 'FLUX_I2': \"f_irac_i2\",\n", " 'FLUXERR_I2': \"ferr_irac_i2\",\n", " 'AP1_FLUX_I2': \"f_ap_irac_i2\",\n", " 'AP1_FLUXERR_I2': \"ferr_ap_irac_i2\"\n", " })\n", "\n", "\n", "catalogue = Table.read(\"../../dmu0/dmu0_SIMES/data/SEP_catalog7.2_mJy_HELP-coverage.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/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 magnitude and band-flag columns\n", "for col in catalogue.colnames:\n", " if col.startswith('f_'):\n", " errcol = \"ferr{}\".format(col[1:])\n", " \n", " mask = catalogue[col] <= 0.\n", " catalogue[col][mask] = np.nan\n", " catalogue[errcol][mask] = np.nan\n", " \n", " #Convert mJy to uJy\n", " catalogue[col] *= 1.e3\n", " catalogue[errcol] *= 1.e3\n", " \n", " magnitude, error = flux_to_mag(\n", " np.array(catalogue[col])/1.e6, np.array(catalogue[errcol])/1.e6)\n", " # Note that some fluxes are 0.\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 masked=True length=10>\n", "
idx | simes_id | simes_ra | simes_dec | f_irac_i1 | ferr_irac_i1 | f_ap_irac_i1 | ferr_ap_irac_i1 | simes_stellarity | f_irac_i2 | ferr_irac_i2 | f_ap_irac_i2 | ferr_ap_irac_i2 | m_irac_i1 | merr_irac_i1 | flag_irac_i1 | m_ap_irac_i1 | merr_ap_irac_i1 | m_irac_i2 | merr_irac_i2 | flag_irac_i2 | m_ap_irac_i2 | merr_ap_irac_i2 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | 1 | 70.7803779831 | -54.8582837548 | 451.444 | 4.24367 | 440.28 | 3.77786 | 0.999855 | 16.746 | 1.7879 | 12.4322 | 1.42991 | 17.2635 | 0.0102062 | False | 17.2907 | 0.00931625 | 20.8402 | 0.115919 | False | 21.1636 | 0.124878 |
1 | 2 | 70.7850447813 | -54.8544910149 | 54.6155 | 5.641 | 38.7848 | 2.61271 | 0.97121 | 41.4574 | 2.95775 | 33.8041 | 1.55074 | 19.5567 | 0.112141 | False | 19.9284 | 0.0731399 | 19.856 | 0.077461 | False | 20.0776 | 0.0498073 |
2 | 3 | 70.7786285052 | -54.8499898052 | 80.5811 | 2.60978 | 80.6626 | 2.59196 | 0.999445 | nan | nan | nan | nan | 19.1344 | 0.0351638 | False | 19.1333 | 0.0348883 | nan | nan | False | nan | nan |
3 | 4 | 70.7833559204 | -54.847604065 | 18.0771 | 2.90154 | 16.5914 | 2.76337 | 0.975636 | 12.9544 | 1.533 | 12.9091 | 1.46861 | 20.7572 | 0.17427 | False | 20.8503 | 0.180834 | 21.119 | 0.128485 | False | 21.1228 | 0.12352 |
4 | 5 | 70.7620588774 | -54.85473189 | 69.0304 | 5.03222 | 46.3869 | 2.62965 | 0.0768235 | 51.6178 | 2.46177 | 48.3133 | 1.68246 | 19.3024 | 0.0791486 | False | 19.734 | 0.0615497 | 19.618 | 0.0517811 | False | 19.6898 | 0.0378096 |
5 | 6 | 70.7671466824 | -54.8523208552 | 113.855 | 9.05542 | 57.0748 | 2.92553 | 0.0230752 | 94.3901 | 4.50715 | 44.9397 | 1.6219 | 18.7591 | 0.0863535 | False | 19.5089 | 0.0556526 | 18.9627 | 0.0518442 | False | 19.7684 | 0.0391848 |
6 | 7 | 70.7741778283 | -54.8497265983 | 35.9327 | 6.44254 | 34.3388 | 4.89015 | 0.973569 | 38.3311 | 3.33342 | 29.4544 | 2.76364 | 20.0113 | 0.194667 | False | 20.0605 | 0.154618 | 19.9411 | 0.0944199 | False | 20.2271 | 0.101872 |
7 | 8 | 70.7598959945 | -54.85460921 | 76.8332 | 2.92916 | 76.5848 | 2.91651 | 0.999446 | 5.62443 | 1.46108 | 5.47158 | 1.42676 | 19.1861 | 0.0413921 | False | 19.1896 | 0.0413472 | 22.0248 | 0.282046 | False | 22.0547 | 0.283115 |
8 | 9 | 70.7796735642 | -54.8478458361 | 33.8951 | 5.82533 | 30.146 | 2.62379 | 0.9779 | 26.8824 | 2.18263 | 24.6775 | 1.49448 | 20.0747 | 0.186598 | False | 20.2019 | 0.094498 | 20.3263 | 0.0881529 | False | 20.4193 | 0.0657527 |
9 | 10 | 70.764994688 | -54.8505399614 | 12.7881 | 1.92318 | 13.1865 | 2.34066 | 0.989471 | 15.7848 | 1.30739 | 17.1158 | 1.47631 | 21.133 | 0.163282 | False | 21.0997 | 0.192722 | 20.9044 | 0.0899273 | False | 20.8165 | 0.0936491 |