{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# XMM-LSS master catalogue\n", "## Preparation of VIMOS Public Extragalactic Redshift Survey (VIPERS) - Multi Lambda Survey (MLS) data\n", "\n", "This catalogue comes from `dmu0_VIPERS`.\n", "\n", "In the catalogue, we keep:\n", "\n", "- The `ident` as unique object identifier;\n", "- The position which is given for all the sources;\n", "- The ugrizy ks total magnitude.\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": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "/Users/rs548/anaconda/envs/herschelhelp_internal/lib/python3.6/site-packages/seaborn/apionly.py:6: UserWarning: As seaborn no longer sets a default style on import, the seaborn.apionly module is deprecated. It will be removed in a future version.\n", " warnings.warn(msg, UserWarning)\n" ] } ], "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 = \"vipers_ra\"\n", "DEC_COL = \"vipers_dec\"" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## I - Column selection" ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "collapsed": true }, "outputs": [], "source": [ "imported_columns = OrderedDict({\n", " \"ident\": \"vipers_id\",\n", " \"ra\": \"vipers_ra\",\n", " \"dec\": \"vipers_dec\",\n", " \"u\": \"m_vipers_u\",\n", " \"err_u\": \"merr_vipers_u\",\n", " \"g\": \"m_vipers_g\",\n", " \"err_g\": \"merr_vipers_g\",\n", " \"r\": \"m_vipers_r\",\n", " \"err_r\": \"merr_vipers_r\",\n", " \"i\": \"m_vipers_i\",\n", " \"err_i\": \"merr_vipers_i\",\n", " \"y\": \"m_vipers_y\",\n", " \"err_y\": \"merr_vipers_y\",\n", " \"z\": \"m_vipers_z\",\n", " \"err_z\": \"merr_vipers_z\",\n", " \"ks\": \"m_vipers_ks\",\n", " \"err_ks\": \"merr_vipers_ks\",\n", " \n", " })\n", "\n", "\n", "catalogue = Table.read(\"../../dmu0/dmu0_VIPERS-MLS/data/VIPERS-MLS_20160502.fits\")[list(imported_columns)]\n", "for column in imported_columns:\n", " catalogue[column].name = imported_columns[column]\n", "\n", "epoch = 2012\n", "\n", "# Clean table metadata\n", "catalogue.meta = None" ] }, { "cell_type": "code", "execution_count": 5, "metadata": { "collapsed": true }, "outputs": [], "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", " # -99.0 is used for missing values\n", " catalogue[col][catalogue[col] < -90.] = np.nan\n", " catalogue[errcol][catalogue[errcol] < -90.] = np.nan \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", " \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 | vipers_id | vipers_ra | vipers_dec | m_vipers_u | merr_vipers_u | m_vipers_g | merr_vipers_g | m_vipers_r | merr_vipers_r | m_vipers_i | merr_vipers_i | m_vipers_y | merr_vipers_y | m_vipers_z | merr_vipers_z | m_vipers_ks | merr_vipers_ks | f_vipers_u | ferr_vipers_u | flag_vipers_u | f_vipers_g | ferr_vipers_g | flag_vipers_g | f_vipers_r | ferr_vipers_r | flag_vipers_r | f_vipers_i | ferr_vipers_i | flag_vipers_i | f_vipers_y | ferr_vipers_y | flag_vipers_y | f_vipers_z | ferr_vipers_z | flag_vipers_z | f_vipers_ks | ferr_vipers_ks | flag_vipers_ks |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
deg | deg | mag | mag | mag | mag | mag | mag | mag | mag | mag | mag | mag | mag | mag | mag | |||||||||||||||||||||||
0 | 1812806 | 32.8595944 | -5.9970134 | 24.188 | 0.065 | 23.92 | 0.037 | 23.741 | 0.06 | 23.453 | 0.057 | nan | nan | 23.681 | 0.171 | 22.26 | 0.129 | 0.767008 | 0.0459186372836 | False | 0.981747 | 0.0334562336661 | False | 1.15771 | 0.0639775 | False | 1.50939 | 0.0792411 | False | nan | nan | False | 1.22349 | 0.19269548261 | False | 4.52897 | 0.538102527571 | False |
1 | 1813277 | 32.8597219 | -5.9948804 | 25.602 | 0.225 | 24.979 | 0.093 | 24.673 | 0.136 | 24.307 | 0.12 | nan | nan | 23.534 | 0.145 | 21.73 | 0.081 | 0.208545 | 0.0432173592912 | False | 0.370169 | 0.0317072486666 | False | 0.490682 | 0.0614631 | False | 0.687385 | 0.0759726 | False | nan | nan | False | 1.40088 | 0.187086810115 | False | 7.37904 | 0.55050432411 | False |
2 | 1812941 | 32.8600604 | -5.9963977 | nan | nan | 26.516 | 0.386 | 25.212 | 0.267 | 24.184 | 0.136 | nan | nan | 23.313 | 0.147 | 20.421 | 0.028 | nan | nan | False | 0.0898668 | 0.0319493793199 | False | 0.298676 | 0.0734491 | False | 0.769839 | 0.0964305 | False | nan | nan | False | 1.71712 | 0.232483890613 | False | 24.6377 | 0.635380434687 | False |
3 | 1811506 | 32.8788779 | -6.003889 | 23.404 | 0.037 | 23.239 | 0.023 | 23.129 | 0.041 | 22.974 | 0.049 | nan | nan | 22.989 | 0.114 | 22.71 | 0.281 | 1.57907 | 0.0538117875521 | False | 1.83823 | 0.0389406355907 | False | 2.03423 | 0.0768174 | False | 2.34639 | 0.105894 | False | nan | nan | False | 2.31419 | 0.242985527166 | False | 2.99227 | 0.774430237925 | False |
4 | 1811916 | 32.8799722 | -6.0009717 | 26.682 | 0.437 | 25.222 | 0.086 | 24.741 | 0.11 | 24.823 | 0.161 | nan | nan | 24.386 | 0.249 | 22.617 | 0.161 | 0.0771259 | 0.0310425543191 | False | 0.295938 | 0.0234408921642 | False | 0.460893 | 0.0466948 | False | 0.427366 | 0.0633726 | False | nan | nan | False | 0.639146 | 0.14658015823 | False | 3.25987 | 0.483394129787 | False |
5 | 1813015 | 32.8814126 | -5.9962031 | 24.863 | 0.089 | 24.871 | 0.065 | 24.456 | 0.088 | 24.164 | 0.092 | nan | nan | 24.095 | 0.199 | 22.701 | 0.198 | 0.411907 | 0.0337648779691 | False | 0.408884 | 0.0244787329962 | False | 0.599239 | 0.0485689 | False | 0.784152 | 0.0664452 | False | nan | nan | False | 0.835603 | 0.153154117299 | False | 3.01717 | 0.550225646293 | False |
6 | 1804587 | 32.9401338 | -6.0372741 | 23.084 | 0.033 | 22.548 | 0.015 | 22.053 | 0.018 | 21.968 | 0.025 | nan | nan | 21.709 | 0.046 | 21.447 | 0.1 | 2.12031 | 0.0644450244636 | False | 3.47376 | 0.0479917468965 | False | 5.48025 | 0.0908549 | False | 5.92652 | 0.136463 | False | nan | nan | False | 7.52315 | 0.318737741509 | False | 9.57634 | 0.882013955561 | False |
7 | 1804344 | 32.9387962 | -6.0360274 | 24.733 | 0.096 | 24.255 | 0.04 | 24.164 | 0.071 | 24.198 | 0.099 | nan | nan | 23.846 | 0.165 | 22.667 | 0.171 | 0.464301 | 0.0410531920352 | False | 0.721108 | 0.026566597171 | False | 0.784152 | 0.0512784 | False | 0.759976 | 0.0692964 | False | nan | nan | False | 1.05099 | 0.159720036663 | False | 3.11315 | 0.490310992063 | False |
8 | 1803664 | 32.9445865 | -6.0411299 | 22.174 | 0.019 | 21.18 | 0.006 | 20.754 | 0.007 | 20.437 | 0.008 | nan | nan | 20.402 | 0.016 | 19.961 | 0.033 | 4.9023 | 0.0857885684127 | False | 12.2462 | 0.0676747658872 | False | 18.1301 | 0.116889 | False | 24.2773 | 0.178881 | False | nan | nan | False | 25.0726 | 0.369483575923 | False | 37.6357 | 1.14390326416 | False |
9 | 1804307 | 32.9500148 | -6.039433 | 22.935 | 0.029 | 22.74 | 0.018 | 22.385 | 0.025 | 21.992 | 0.025 | nan | nan | 21.489 | 0.039 | 20.581 | 0.046 | 2.4322 | 0.0649641594919 | False | 2.91072 | 0.0482556233692 | False | 4.03645 | 0.0929428 | False | 5.79695 | 0.13348 | False | nan | nan | False | 9.21297 | 0.330933013174 | False | 21.2618 | 0.900810628082 | False |