{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# SSDF master catalogue\n", "## Preparation of SSDF data\n", "\n", "This catalogue comes from `dmu0_SSDF`.\n", "\n", "The SSDF data consists in two catalogue of IRAC Ch1 and Ch2 fluxes: one for Ch1 detected sources and the other for Ch2 detected sources. For now, we are only using the Ch1 detected sources. **TODO** : We may find a way to merge the two catalogues and select the best flux for each source." ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "This notebook was run with herschelhelp_internal version: \n", "04829ed (Thu Nov 2 16:57:19 2017 +0000)\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 = \"ssdf_ra\"\n", "DEC_COL = \"ssdf_dec\"" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## I - Column selection" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "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": [ "#To begin lets take the irac_i1 selected sources. Perhaps we should merge in the irac_i2 slected sources.\n", "imported_columns = OrderedDict({\n", " \"cntr\": \"ssdf_id\",\n", " \"ra\": \"ssdf_ra\",\n", " \"dec\": \"ssdf_dec\",\n", " \"class_star\": \"ssdf_stellarity\",\n", " #\"mag_aut1\": \"m_irac_i1\",\n", " #\"magerr_aut1\": \"merr_irac_i1\",\n", " \"flux_aut1\": \"f_irac_i1\",\n", " \"fluxerr_aut1\": \"ferr_irac_i1\",\n", " #\"mag_ap1_4\": \"m_ap_irac_i1\", #Is this a 4 arcsec aperture (corrected) mag?\n", " #\"magerr_ap1_4\": \"merr_ap_irac_i1\",\n", " \"flux_ap1_4\": \"f_ap_irac_i1\",\n", " \"fluxerr_ap1_4\": \"ferr_ap_irac_i1\",\n", " #\"mag_aut2\": \"m_irac_i2\",\n", " #\"magerr_aut2\": \"merr_irac_i2\",\n", " \"flux_aut2\": \"f_irac_i2\",\n", " \"fluxerr_aut2\": \"ferr_irac_i2\",\n", " #\"mag_ap2_4\": \"m_ap_irac_i2\", #Is this a 4 arcsec aperture (corrected) mag?\n", " #\"magerr_ap2_4\": \"merr_ap_irac_i2\",\n", " \"flux_ap2_4\": \"f_ap_irac_i2\",\n", " \"fluxerr_ap2_4\": \"ferr_ap_irac_i2\"\n", " })\n", "\n", "\n", "catalogue = Table.read(\"../../dmu0/dmu0_SSDF/data/SSDF-I1_20160530.fits\")[list(imported_columns)]\n", "for column in imported_columns:\n", " catalogue[column].name = imported_columns[column]\n", "\n", "epoch = 2012 #TODO: Check?\n", "\n", "# Clean table metadata\n", "catalogue.meta = None\n", "#catalogue.add_column(Column([str(source) for source in catalogue['ssdf_ra', 'ssdf_dec']], dtype=str), name=\"ssdf_intid\")" ] }, { "cell_type": "code", "execution_count": 5, "metadata": { "collapsed": true }, "outputs": [], "source": [ "# band-flag columns\n", "for col in catalogue.colnames:\n", " if col.startswith('f_'):\n", " \n", " errcol = \"ferr{}\".format(col[1:])\n", " \n", " #We compute the magnitudes from the fluxes because the mags are Vega\n", " mag, error = flux_to_mag(catalogue[col]* 1.e-6, catalogue[errcol] * 1.e-6)\n", " catalogue.add_column(Column(mag , 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", " \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 | ssdf_id | ssdf_ra | ssdf_dec | ssdf_stellarity | f_irac_i1 | ferr_irac_i1 | f_ap_irac_i1 | ferr_ap_irac_i1 | 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 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
deg | deg | uJy | uJy | uJy | uJy | uJy | uJy | uJy | uJy | |||||||||||||
0 | 1143516 | 344.83935 | -59.774198 | 0.7 | 1.48 | 1.5 | nan | nan | nan | nan | nan | nan | 23.4743 | 1.10041 | False | nan | nan | nan | nan | False | nan | nan |
1 | 1143796 | 344.838913 | -59.773144 | 0.65 | 11.18 | 2.52 | 20.11 | 1.96 | nan | nan | nan | nan | 21.2789 | 0.244728 | False | 20.6415 | 0.10582 | nan | nan | False | nan | nan |
2 | 1143876 | 344.839952 | -59.771165 | 0.64 | 1.97 | 0.98 | nan | 315.14 | nan | nan | nan | nan | 23.1638 | 0.540112 | False | nan | nan | nan | nan | False | nan | nan |
3 | 1126474 | 344.937719 | -59.9316 | 0.09 | 28.97 | 2.96 | 40.24 | 2.18 | 1.78 | 3.58 | nan | 261.22 | 20.2451 | 0.110935 | False | 19.8884 | 0.0588197 | 23.2739 | 2.18367 | False | nan | nan |
4 | 1126450 | 344.942358 | -59.929494 | 0.27 | 10.34 | 2.06 | 17.96 | 1.94 | 12.34 | 1.9 | 15.3 | 1.8 | 21.3637 | 0.216307 | False | 20.7642 | 0.117279 | 21.1717 | 0.167172 | False | 20.9383 | 0.127734 |
5 | 1126794 | 344.936402 | -59.926379 | 0.29 | 8.67 | 2.22 | 18.51 | 1.96 | 7.57 | 2.02 | 11.39 | 1.76 | 21.555 | 0.278009 | False | 20.7315 | 0.114967 | 21.7023 | 0.289721 | False | 21.2587 | 0.16777 |
6 | 1127311 | 344.933348 | -59.923402 | 0.03 | 21.0 | 3.2 | 31.02 | 2.08 | 33.6 | 2.98 | 24.66 | 1.92 | 20.5945 | 0.165446 | False | 20.1709 | 0.0728024 | 20.0842 | 0.0962945 | False | 20.42 | 0.0845342 |
7 | 1127327 | 344.931642 | -59.921819 | 0.7 | 26.66 | 2.7 | 35.07 | 2.12 | 5.02 | 2.56 | 1.07 | 2.24 | 20.3354 | 0.109958 | False | 20.0377 | 0.0656333 | 22.1482 | 0.553682 | False | 23.8265 | 2.27294 |
8 | 1127176 | 344.936808 | -59.922759 | 0.87 | 6.66 | 1.82 | 13.19 | 1.9 | 20.68 | 1.76 | 23.33 | 1.9 | 21.8413 | 0.296703 | False | 21.0994 | 0.156399 | 20.6111 | 0.0924031 | False | 20.4802 | 0.0884226 |
9 | 1127168 | 344.944881 | -59.922919 | 1.0 | 2.42 | 1.22 | nan | 260.72 | 3.98 | 1.08 | 4.43 | 1.74 | 22.9405 | 0.547355 | False | nan | nan | 22.4003 | 0.294622 | False | 22.284 | 0.426452 |