{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# ELAIS-N1 master catalogue\n", "## Preparation of Spitzer datafusion SERVS data\n", "\n", "The Spitzer catalogues were produced by the datafusion team are available in `dmu0_DataFusion-Spitzer`.\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 2 (1.9 arcsec);\n", "- The “auto” flux (which seems to be the Kron flux);\n", "- The stellarity in each band\n", "\n", "A query of the position in the Spitzer heritage archive show that the SERVS-ELAIS-N1 images were observed in 2009. Let's take this as epoch." ] }, { "cell_type": "code", "execution_count": 1, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "This notebook was run with herschelhelp_internal version: \n", "284b2ef (Mon Aug 14 20:02:12 2017 +0100)\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 = \"servs_ra\"\n", "DEC_COL = \"servs_dec\"" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## I - Column selection" ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "collapsed": true }, "outputs": [], "source": [ "imported_columns = OrderedDict({\n", " 'internal_id': \"servs_intid\",\n", " 'ra_12': \"servs_ra\",\n", " 'dec_12': \"servs_dec\",\n", " 'flux_aper_2_1': \"f_ap_servs_irac_i1\",\n", " 'fluxerr_aper_2_1': \"ferr_ap_servs_irac_i1\",\n", " 'flux_auto_1': \"f_servs_irac_i1\",\n", " 'fluxerr_auto_1': \"ferr_servs_irac_i1\",\n", " 'class_star_1': \"servs_stellarity_irac_i1\",\n", " 'flux_aper_2_2': \"f_ap_servs_irac_i2\",\n", " 'fluxerr_aper_2_2': \"ferr_ap_servs_irac_i2\",\n", " 'flux_auto_2': \"f_servs_irac_i2\",\n", " 'fluxerr_auto_2': \"ferr_servs_irac_i2\",\n", " 'class_star_2': \"servs_stellarity_irac_i2\",\n", " })\n", "\n", "\n", "catalogue = Table.read(\"../../dmu0/dmu0_DataFusion-Spitzer/data/DF-SERVS_ELAIS-N1.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": { "collapsed": false }, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "/home/yroehlly/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", " 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": { "collapsed": false }, "outputs": [ { "data": { "text/html": [ "<Table masked=True length=10>\n", "
idx | servs_intid | servs_ra | servs_dec | f_ap_servs_irac_i1 | ferr_ap_servs_irac_i1 | f_servs_irac_i1 | ferr_servs_irac_i1 | servs_stellarity_irac_i1 | f_ap_servs_irac_i2 | ferr_ap_servs_irac_i2 | f_servs_irac_i2 | ferr_servs_irac_i2 | servs_stellarity_irac_i2 | m_ap_servs_irac_i1 | merr_ap_servs_irac_i1 | m_servs_irac_i1 | merr_servs_irac_i1 | flag_servs_irac_i1 | m_ap_servs_irac_i2 | merr_ap_servs_irac_i2 | m_servs_irac_i2 | merr_servs_irac_i2 | flag_servs_irac_i2 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
deg | deg | uJy | uJy | uJy | uJy | uJy | uJy | uJy | uJy | ||||||||||||||
0 | 1214684 | 244.3568301 | 54.2574598 | nan | nan | nan | nan | nan | 38.9957758098 | 2.42791861385 | 106.912439771 | 4.53019620398 | 0.96 | nan | nan | nan | nan | False | 19.9224560877 | 0.0675990946847 | 18.8274293991 | 0.0460058534243 | False |
1 | 1214933 | 244.3568698 | 54.2538341 | nan | nan | nan | nan | nan | 25.1660275731 | 2.08235665528 | 122.247397842 | 54.5416272661 | 0.63 | nan | nan | nan | nan | False | 20.3979633297 | 0.0898389706238 | 18.6819009412 | 0.48440965153 | False |
2 | 1214271 | 244.3514743 | 54.2607439 | nan | nan | nan | nan | nan | 7.28734324164 | 1.82887510241 | 5.88733841883 | 0.934112492637 | 0.95 | nan | nan | nan | nan | False | 21.7435769357 | 0.272482830412 | 21.9752024979 | 0.17226795547 | False |
3 | 1214094 | 244.3452857 | 54.2641577 | nan | nan | nan | nan | nan | 34.512143821 | 1.38085709273 | 30.5858798823 | 1.58805129013 | 0.97 | nan | nan | nan | nan | False | 20.0550701561 | 0.0434411303728 | 20.1861975534 | 0.0563725741206 | False |
4 | 1213761 | 244.3431446 | 54.2662732 | nan | nan | nan | nan | nan | 2.43876758685 | 1.08756823662 | 1.48506729451 | 0.688566605371 | 0.59 | nan | nan | nan | nan | False | 22.9320739643 | 0.484183985393 | 23.4706346656 | 0.50341267066 | False |
5 | 1215041 | 244.3255214 | 54.2452704 | nan | nan | nan | nan | nan | 38.1815619911 | 1.11539733225 | 37.3136575121 | 1.71677213549 | 0.11 | nan | nan | nan | nan | False | 19.945365772 | 0.0317175936018 | 19.9703304475 | 0.0499538717751 | False |
6 | 1214581 | 244.3514183 | 54.2559085 | nan | nan | nan | nan | nan | 2.29112550973 | 1.04469440763 | 2.26364444659 | 1.08170600649 | 0.69 | nan | nan | nan | nan | False | 22.9998777979 | 0.495067833019 | 23.0129794682 | 0.518830320688 | False |
7 | 1214777 | 244.3483154 | 54.252339 | nan | nan | nan | nan | nan | 0.299262982695 | 1.07796284811 | 0.762580899955 | 0.455500366747 | 0.5 | nan | nan | nan | nan | False | 25.2098674996 | 3.91088560649 | 24.1942851913 | 0.648525604939 | False |
8 | 1214571 | 244.3466707 | 54.2549296 | nan | nan | nan | nan | nan | 2.27500241674 | 0.807518764898 | 1.47208056865 | 1.32784765416 | 0.33 | nan | nan | nan | nan | False | 23.0075453441 | 0.385385242943 | 23.4801710498 | 0.979356906975 | False |
9 | 1214592 | 244.3469114 | 54.2568799 | nan | nan | nan | nan | nan | 9.47243362087 | 1.1995360092 | 8.16191421786 | 1.37144454991 | 0.2 | nan | nan | nan | nan | False | 21.4588460735 | 0.137491559849 | 21.620519935 | 0.182436002255 | False |