{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Generate hole region files\n", "This is currently producing the simplest possible hole regions. For every star brighter than 16 Mag it puts a 10 arcsec circle. It then goes on to produce varying size holes for individual pristine catalogues based on parameters computed by Seb Oliver's IDL code." ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "This notebook was run with herschelhelp_internal version: \n", "668d408 (Wed Aug 2 15:55:58 2017 +0100) [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": [], "source": [ "from herschelhelp_internal import starmask\n", "from pymoc import MOC" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "First we list all the fields including the ra and dec or the first star in the field. We do this because, due to a peculiarity of the pyregion code, we must supply an image header to produce mocs." ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [], "source": [ "#Field names plus ra dec of first circle\n", "fields= {\n", "# Field RA DEC\n", "'AKARI-NEP': [274.654402036, 65.7962520276 ],\n", "'AKARI-SEP': [72.2316923316, -54.380443672 ],\n", "'Bootes': [216.431700722, 32.401081899 ],\n", "'CDFS-SWIRE': [51.0227099923, -29.8185285737 ],\n", "'COSMOS': [149.295925951, 1.08212668291 ],\n", "'EGS': [217.276981956, 53.6441519854 ],\n", "'ELAIS-N1': [247.096600963, 55.1757687739 ],\n", "'ELAIS-N2': [248.424493154, 39.1274077489 ],\n", "'ELAIS-S1': [7.10625839472, -43.8632559768 ],\n", "'GAMA-09': [129.076050945, -2.23171513025 ],\n", "'GAMA-12': [172.84437099, -0.482115877707],\n", "'GAMA-15': [211.756497623, -2.28573712848 ],\n", "'HDF-N': [190.259734752, 62.205265532 ],\n", "'Herschel-Stripe-82': [353.751913281, -7.10891111165 ],\n", "'Lockman-SWIRE': [161.942787703, 59.0563805825 ],\n", "'NGP': [192.899559129, 22.0990890388 ],\n", "'SA13': [197.895801254, 42.4400105492 ],\n", "'SGP': [334.297748942, -34.5037863499 ],\n", "'SPIRE-NEP': [266.334305546, 68.7904496043 ],\n", "'SSDF': [341.577544902, -59.1868365369 ],\n", "'xFLS': [261.387059958, 58.0184602211 ],\n", "'XMM-13hr': [203.318355937, 37.4745777866 ],\n", "'XMM-LSS': [32.9413834032, -6.02293494708 ]}" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Then we generate a region file to define all the holes. At present this is very crude and simply puts a 10 arcsec hole over every star brighter than 16 Mag." ] }, { "cell_type": "code", "execution_count": null, "metadata": { "scrolled": false }, "outputs": [], "source": [ "starmask.create_holes('../../dmu0/dmu0_GAIA/data/GAIA_CDFS-SWIRE.fits',\n", " 'data/10_arcsec_holes_CDFS-SWIRE.reg',\n", " '../../dmu2/dmu2_field_coverages/CDFS-SWIRE_MOC.fits')\n", " \n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Then we convert the region files to MOC format. We recomend against using the MOC since, even at this high order, it doesn't capture shape that well. This will become increasingly significant if we have smaller or more detailed shapes in the future." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "ORDER=16\n", "starmask.reg2moc('data/holes_CDFS-SWIRE.reg',\n", " '../../dmu2/dmu2_field_coverages/CDFS-SWIRE_MOC.fits',\n", " 'data/10_arcsec_holes_CDFS-SWIRE_O' + str(ORDER) + '_MOC.fits',\n", " ra_typ=fields['CDFS-SWIRE'][1],\n", " dec_typ=fields['CDFS-SWIRE'][2],\n", " order=ORDER)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Produce magnitude varying holes\n", "Then we produce a varying hole parameterised by Seb's code. We define an annulus with a 1 arcsec circle at the centre and an outer radius r_50 (the radius at which the artefact density goes over 0.5 x background density) = 10^(A + B x mag)." ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [], "source": [ "# Run CDFS-SWIRE with parameters from IDL code.\n", "per_catalogue_params = [\n", "# Field Band A B magnitude limit\n", " ['CDFS-SWIRE', 'irac1', 2.65405, -0.106177, 18], #Using 18 as faint limit.\n", " ['CDFS-SWIRE', 'gpc1_r', 1.78775, -0.0679605, 13], # Using values from ELAIS-N1. \n", " ['CDFS-SWIRE', 'vhs_k', 2.79833, -0.101774, 18], # Using 18 as faint limit.\n", " ['CDFS-SWIRE', 'video_k', 1.95959, -0.0711362, 18], # Using 18 as faint limit.\n", " ['CDFS-SWIRE', 'atlas_r', 3.48990, -0.163769, 18], # Using 18 as faint limit.\n", " ['CDFS-SWIRE', 'combo_r', 3.00201, -0.128652, 18] # Using 18 as faint limit.\n", " \n", "] \n", "\n", "#Combine SERVS and SWIRE mocs because irac1 fluxes can be from either\n", "swire_moc = MOC(filename = '../../dmu0/dmu0_DataFusion-Spitzer/data/DF-SWIRE_CDFS-SWIRE_MOC.fits')\n", "servs_moc = MOC(filename = '../../dmu0/dmu0_DataFusion-Spitzer/data/DF-SERVS_CDFS-SWIRE_MOC.fits')\n", "irac1_moc = swire_moc + servs_moc\n", "irac1_moc.write('data/SERVS_SWIRE_COVERAGE_irac1_CDFS-SWIRE_MOC.fits', filetype='fits' ,overwrite=True)\n", "\n", "moc_files = {\n", " 'irac1' :'data/SERVS_SWIRE_COVERAGE_irac1_CDFS-SWIRE_MOC.fits',\n", " 'gpc1_r' :'../../dmu0/dmu0_PanSTARRS1-3SS/data/PanSTARRS1-3SS_CDFS-SWIRE_MOC.fits',\n", " 'vhs_k' :'../../dmu0/dmu0_VISTA-VHS/data/VHS_CDFS-SWIRE_MOC.fits',\n", " 'video_k':'../../dmu0/dmu0_VISTA-VIDEO-private/data/VIDEO-all_2016-04-14_fullcat_errfix_CDFS-SWIRE_MOC.fits',\n", " 'atlas_r':'../../dmu0/dmu0_ATLAS/data/ATLAS_CDFS-SWIRE_MOC.fits',\n", " 'combo_r':'../../dmu0/dmu0_COMBO-17/data/table3_MOC.fits'\n", "}" ] }, { "cell_type": "code", "execution_count": 8, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "There are 35443 GAIA stars in CDFS-SWIRE\n", "Starmask written to data/holes_CDFS-SWIRE_irac1.reg\n", "There are 35443 GAIA stars in CDFS-SWIRE\n", "Starmask written to data/holes_CDFS-SWIRE_gpc1_r.reg\n", "There are 35443 GAIA stars in CDFS-SWIRE\n", "Starmask written to data/holes_CDFS-SWIRE_vhs_k.reg\n", "There are 35443 GAIA stars in CDFS-SWIRE\n", "Starmask written to data/holes_CDFS-SWIRE_video_k.reg\n", "There are 35443 GAIA stars in CDFS-SWIRE\n", "Starmask written to data/holes_CDFS-SWIRE_atlas_r.reg\n", "There are 35443 GAIA stars in CDFS-SWIRE\n", "Starmask written to data/holes_CDFS-SWIRE_combo_r.reg\n" ] } ], "source": [ "for pristine_cat in per_catalogue_params:\n", " starmask.create_holes('../../dmu0/dmu0_GAIA/data/GAIA_' + pristine_cat[0] + '.fits', #GAIA catalogue\n", " 'data/holes_' + pristine_cat[0] + '_' + pristine_cat[1] + '.reg', #output file\n", " moc_files[pristine_cat[1]], #moc of survey region\n", " AB = [pristine_cat[2],pristine_cat[3]], #radius as f of mag params\n", " mag_lim = pristine_cat[4]) #upper magnitude limit" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Again we convert the region files to MOC format." ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "WARNING: The following header keyword is invalid or follows an unrecognized non-standard convention:\n", "\n", "WCSAXES = 2 / Number of coordinate axes\n", "CRPIX1 = [astropy.io.fits.card]\n", "WARNING: The following header keyword is invalid or follows an unrecognized non-standard convention:\n", " 0.5 / Pixel coordinate of reference point\n", "CRPIX2 = 0.5 / Pi [astropy.io.fits.card]\n", "WARNING: The following header keyword is invalid or follows an unrecognized non-standard convention:\n", "xel coordinate of reference point\n", "CDELT1 = 0.675 / [deg] Coordin [astropy.io.fits.card]\n", "WARNING: The following header keyword is invalid or follows an unrecognized non-standard convention:\n", "ate increment at reference point\n", "CDELT2 = 0.675 / [deg] Coordina [astropy.io.fits.card]\n", "WARNING: The following header keyword is invalid or follows an unrecognized non-standard convention:\n", "te increment at reference point\n", "RADECSYSa= 'ICRS ' / International [astropy.io.fits.card]\n", "WARNING: The following header keyword is invalid or follows an unrecognized non-standard convention:\n", "Celestial Ref. System\n", "CUNIT1 = 'deg ' / Units of coordinate [astropy.io.fits.card]\n", "WARNING: The following header keyword is invalid or follows an unrecognized non-standard convention:\n", "increment and value\n", "CUNIT2 = 'deg ' / Units of coordinate in [astropy.io.fits.card]\n", "WARNING: The following header keyword is invalid or follows an unrecognized non-standard convention:\n", "crement and value\n", "CTYPE1 = 'RA---TAN' / \n", "CTYPE2 = 'DEC--TAN' [astropy.io.fits.card]\n", "WARNING: The following header keyword is invalid or follows an unrecognized non-standard convention:\n", " / \n", "CRVAL1 = 51.0227099923 / [deg] Coordinate value at refer [astropy.io.fits.card]\n", "WARNING: The following header keyword is invalid or follows an unrecognized non-standard convention:\n", "ence point\n", "CRVAL2 = -29.8185285737 / [deg] Coordinate value at [astropy.io.fits.card]\n", "WARNING: The following header keyword is invalid or follows an unrecognized non-standard convention:\n", " reference point\n", "LONPOLE = 0.0 / [deg] Native longitude of cele [astropy.io.fits.card]\n", "WARNING: The following header keyword is invalid or follows an unrecognized non-standard convention:\n", "stial pole\n", "LATPOLE = 90.0 / [deg] Native latitude of celestial pole\n", " [astropy.io.fits.card]\n", "WARNING: FITSFixedWarning: 0.5 / Pixel coordinate of reference point\n", "a floating-point value was expected. [astropy.wcs.wcs]\n", "WARNING: FITSFixedWarning: / \n", "the RADECSYS keyword is deprecated, use RADESYSa. [astropy.wcs.wcs]\n" ] } ], "source": [ "ORDER=16\n", "for pristine_cat in per_catalogue_params:\n", " starmask.reg2moc('data/holes_' + pristine_cat[0] + '_' + pristine_cat[1] + '.reg',\n", " '../../dmu2/dmu2_field_coverages/' + pristine_cat[0] + '_MOC.fits',\n", " 'data/holes_' + pristine_cat[0] + '_' + pristine_cat[1] + '_O' + str(ORDER) + '_MOC.fits',\n", " ra_typ=fields['CDFS-SWIRE'][0],\n", " dec_typ=fields['CDFS-SWIRE'][1],\n", " order=ORDER)" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python [conda env:herschelhelp_internal]", "language": "python", "name": "conda-env-herschelhelp_internal-py" }, "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.1" } }, "nbformat": 4, "nbformat_minor": 2 }