{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Lockman-SWIRE check HELP IDs\n", "\n", "Because the photo-zs were computed from an early version of the masterlist, there is some concern that the HELP IDs may have changed. In this notebook we will check for differences and convert the old IDs to the new ones if required." ] }, { "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", "import os\n", "import time\n", "\n", "from astropy import units as u\n", "from astropy.coordinates import SkyCoord\n", "from astropy.table import join, Column, Table\n", "import numpy as np\n", "from pymoc import MOC\n", "\n", "from collections import Counter\n", "\n", "from herschelhelp_internal.masterlist import merge_catalogues, nb_merge_dist_plot, specz_merge\n", "from herschelhelp_internal.utils import coords_to_hpidx, ebv, gen_help_id, inMoc" ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "collapsed": true }, "outputs": [], "source": [ "\n", "OUT_DIR = os.environ.get('OUT_DIR', \"./data\")\n", "SUFFIX = os.environ.get('SUFFIX', time.strftime(\"_%Y%m%d\"))\n", "\n", "OLD_SUFFIX = \"20170710\"\n", "NEW_SUFFIX = \"20180219\"\n", "\n", "ML_FOLDER = \"../../dmu1/dmu1_ml_Lockman-SWIRE/\"\n", "\n", "try:\n", " os.makedirs(OUT_DIR)\n", "except FileExistsError:\n", " pass" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## I - Reading the prepared pristine catalogues" ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "collapsed": true }, "outputs": [], "source": [ "xid = Table.read(\"./data/dmu26_XID+SPIRE_Lockman-SWIRE_cat_20180220.fits\")\n", "master_catalogue = Table.read(\"{}data/master_catalogue_lockman-swire_{}.fits\".format(ML_FOLDER, NEW_SUFFIX))[\"help_id\",\"ra\",\"dec\"]\n" ] }, { "cell_type": "code", "execution_count": 6, "metadata": { "collapsed": true }, "outputs": [], "source": [ "xid.meta = None\n", "\n", "xid['RA'].name = 'xid_ra'\n", "xid['Dec'].name = 'xid_dec'" ] }, { "cell_type": "code", "execution_count": 7, "metadata": { "collapsed": true }, "outputs": [], "source": [ "merged_table = join(master_catalogue, xid, join_type='left')\n", "\n" ] }, { "cell_type": "code", "execution_count": 8, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Master catalogue length: 4366298\n", "Photoz length: 377857\n", "Merged length: 4366298\n", "Merged photozs length: 377857\n", "Nonnan photozs length: 377857\n" ] } ], "source": [ "print(\"Master catalogue length: {}\".format(len(master_catalogue)))\n", "print(\"XID length: {}\".format(len(xid)))\n", "print(\"Merged length: {}\".format(len(merged_table)))\n", "print(\"Merged photozs length: {}\".format(np.sum(~np.isnan(merged_table['F_SPIRE_250']))))\n", "print(\"Nonnan photozs length: {}\".format(np.sum(~np.isnan(xid['F_SPIRE_250']))))" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "XID+MIPS is OK" ] } ], "metadata": { "kernelspec": { "display_name": "Python (herschelhelp_internal)", "language": "python", "name": "helpint" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.6.4" } }, "nbformat": 4, "nbformat_minor": 2 }