{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# UKIRT Hemisphere Survey (UHS)\n", "\n", "This notebook takes in the downloaded survey and filters it per field creating new fits files for each field." ] }, { "cell_type": "code", "execution_count": 1, "metadata": { "collapsed": true }, "outputs": [], "source": [ "import subprocess\n", "\n", "from astropy.table import Table\n", "from astropy import units as u\n", "\n", "import numpy as np\n", "\n", "from pymoc import MOC\n", "\n", "from herschelhelp_internal.utils import inMoc" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "collapsed": true }, "outputs": [], "source": [ "#TODO: Maybe check for edge effects and add add extra leeway\n", "fields= [\n", "# Field RAtyp DECtyp RAmin RAmax DECmin DECmax\n", "['AKARI-NEP', 274.65, 65.796, 263.6, 266.5, 68.48, 69.51 ],\n", "['AKARI-SEP', 72.231, -54.380, 66.1, 75.5, -55.96, -51.61 ],\n", "['Bootes', 216.43, 32.401, 215.7, 220.7, 32.12, 36.18 ],\n", "['CDFS-SWIRE', 51.022, -29.818, 50.7, 55.5, -30.50, -25.92 ],\n", "['COSMOS', 149.29, 1.0821, 148.6, 151.6, 0.72, 3.71 ],\n", "['EGS', 217.27, 53.644, 212.3, 217.6, 51.08, 54.31 ],\n", "['ELAIS-N1', 247.09, 55.175, 237.9, 247.9, 52.37, 57.59 ],\n", "['ELAIS-N2', 248.42, 39.127, 246.1, 252.3, 39.02, 43.02 ],\n", "['ELAIS-S1', 7.1062, -43.863, 6.3, 11.3, -45.60, -41.53 ],\n", "['GAMA-09', 129.07, -2.2317, 127.1, 142.2, -2.53, 3.55 ],\n", "['GAMA-12', 172.84, -0.482, 172.2, 187.4, -3.54, 2.59 ],\n", "['GAMA-15', 211.75, -2.2857, 209.9, 225.3, -2.57, 3.5 ],\n", "['HDF-N', 190.25, 62.205, 188.0, 190.4, 61.69, 62.78 ],\n", "['Herschel-Stripe-82', 353.75, -7.1089, 348.3, 19.1, -9.5, 9.25 ],\n", "['Lockman-SWIRE', 161.94, 59.056, 154.7, 167.8, 54.95, 60.89 ],\n", "['NGP', 192.89, 22.099, 189.8, 209.3, 21.62, 36.16 ],\n", "['SA13', 197.89, 42.440, 197.5, 198.6, 42.34, 43.09 ],\n", "['SGP', 334.29, -34.503, 333.5, 28.2, -37.1, -26.0 ],\n", "['SPIRE-NEP', 266.33, 68.790, 264.6, 275.4, 64.41, 68.63 ],\n", "['SSDF', 341.57, -59.186, 340.5, 2.8, -61.2, -48.6 ],\n", "['xFLS', 261.38, 58.018, 255.6, 262.5, 57.85, 60.84 ],\n", "['XMM-13hr', 203.31, 37.474, 202.8, 204.4, 37.31, 38.52 ],\n", "['XMM-LSS', 32.941, -6.0229, 32.1, 38.2, -7.53, -1.52 ]]\n", " \n", " \n", "#Has a field been removed? ( RA BETWEEN 13.4 AND 36.3 AND DEC BETWEEN -2.32 AND 2.49 )\n" ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "collapsed": true }, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "WARNING: UnitsWarning: 'RADIANS' did not parse as fits unit: At col 0, Unit 'RADIANS' not supported by the FITS standard. [astropy.units.core]\n" ] } ], "source": [ "uhs = Table.read(\"data/UHS-DR1_HELP.fits\")" ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "collapsed": true }, "outputs": [], "source": [ "uhs[\"RA\"].unit = u.rad\n", "uhs[\"DEC\"].unit = u.rad\n", "uhs[\"RA\"].convert_unit_to(u.deg)\n", "uhs[\"DEC\"].convert_unit_to(u.deg)" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "data": { "text/html": [ "<Table masked=True length=10>\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "
idxSOURCEIDCUEVENTIDFRAMESETIDRADECCXCYCZHTMIDLBLAMBDAETAPRIORSECMERGEDCLASSSTATMERGEDCLASSPSTARPGALAXYPNOISEPSATURATEDEBVAJJHALLMAGJHALLMAGERRJPETROMAGJPETROMAGERRJPSFMAGJPSFMAGERRJSERMAG2DJSERMAG2DERRJAPERMAG3JAPERMAG3ERRJAPERMAG4JAPERMAG4ERRJAPERMAG6JAPERMAG6ERRJGAUSIGJELLJPAJERRBITSJDEBLENDJCLASSJCLASSSTATJPPERRBITSJSEQNUMJXIJETA
degdeg
045959827533646557459561520602249.09139571241.8277092465-0.265929128626-0.6960858675580.6668929175921532090522053266.087577009642.276433478942.087119453531.4778183978459561576148-2.10839-10.9938650.003067490.003067490.00.007535580.0066991317.83180.04640517.79340.0700357-9.99999e+08-9.99999e+08-9.99999e+08-9.99999e+0817.73710.037734717.75350.047478217.87460.09651071.223270.185815105.9970---1-1.49085419430410.00.0
145959827533746557459561520602249.09048452941.7588548997-0.266226030817-0.6968297862420.6659969590931532072151599865.99451543142.276156423342.14236129231.4224044753459561576148-11.013100.003067490.003067490.9938650.00.006645290.0059076717.6020.02969317.50660.0626612-9.99999e+08-9.99999e+08-9.99999e+08-9.99999e+0817.43640.029387517.44450.036310917.44650.0654621.301370.16955162.14150--0-7.78744419430420.00.0
245959827533846557459561520602249.08937496141.6795933398-0.266568101206-0.6976846071740.6649643872651532073474954965.887387937342.275791446142.205891960631.35844367034595615761483.9355310.003067490.9938650.003067490.00.005868790.0052173618.66990.13264218.82910.241219-9.99999e+08-9.99999e+08-9.99999e+08-9.99999e+0818.79080.096027418.77260.1200518.82960.2357831.064490.08988859.31550--12.78284419430430.00.0
345959827533946557459561520602249.08922455341.6707234215-0.266606671154-0.6977800616230.6648487561081532073461622565.875399288542.275764124942.212987631531.35125650694595615761480.675435-10.9938650.003067490.003067490.00.005830520.0051833415.85680.010270815.820.014632-9.99999e+08-9.99999e+08-9.99999e+08-9.99999e+0815.80350.0088192615.79490.0098146615.79960.01565221.593170.0841488170.5740---10.477605419430440.00.0
445959827534046557459561520602249.08930782741.7307409658-0.26635694576-0.6971295032890.6656308534681532073287790965.956505619742.276622520242.164555169631.3990957442459561576148-1.94055-10.9938650.003067490.003067490.00.006424040.0057109714.20940.0036423814.19720.0039325-9.99999e+08-9.99999e+08-9.99999e+08-9.99999e+0814.16870.0033144914.17470.0033726214.17660.004269591.702040.0480872135.190---1-1.37217419430450.00.0
545959827534146557459561520602249.08878322541.8386617913-0.265915361617-0.6959546434290.6670353474481532090523230766.102343687442.278524925842.077120288431.48438660854595615761482.1236510.003067490.9938650.003067490.00.007667150.006816119.47870.33116519.47870.331165-9.99999e+08-9.99999e+08-9.99999e+08-9.99999e+0819.57370.19016119.45020.21773119.3990.3899350.8144820.060881746.16160--11.50165419430460.00.0
645959827534246557459561520602249.08896462641.8271266834-0.265961083771-0.6960809175270.66688534111532090495806566.086757064442.278237087242.086523722831.4753831739459561576148-5.07346-10.9938650.003067490.003067490.00.007528750.0066930616.7790.02039616.77230.0292268-9.99999e+08-9.99999e+08-9.99999e+08-9.99999e+0816.69170.016305916.7110.019605916.77320.0357731.438560.0924337106.4480---1-3.58748419430470.00.0
745959827534346557459561520602249.08817248841.6673778105-0.266633339987-0.6978114295240.664805137491532073462947865.870861399942.276496940642.215225204531.347734619459561576148-0.125998-10.9938650.003067490.003067490.00.00581140.0051663318.06460.071128718.08190.0991237-9.99999e+08-9.99999e+08-9.99999e+08-9.99999e+0817.95710.046505517.97650.059108218.10060.1214311.353220.0117524168.4760---1-0.0890941419430480.00.0
845959827534446557459561520602249.08772698941.8419330134-0.265914597489-0.6959141652650.6670778825791532090527380266.106750658342.279354654942.074012776831.4861242174459561651413-1.45288-10.9938650.003067490.003067490.00.007705350.0068500519.83310.3983919.78440.365981-9.99999e+08-9.99999e+08-9.99999e+08-9.99999e+0819.59490.19399419.63730.25840920.09030.736550.9871710.037955897.35240---1-1.027343276890.00.0
945959827534546557459561520602249.08753269841.7413018145-0.266334746293-0.697006630740.6657683978841532072149367265.970751027742.278102982142.155243596231.40605086754595615761480.174297-10.9938650.003067490.003067490.00.006518530.0057949716.94610.025419916.90340.0353545-9.99999e+08-9.99999e+08-9.99999e+08-9.99999e+0816.89730.019143516.89250.022829416.86460.03893211.504940.055068362.22920---10.12324732768100.00.0
\n", "\n" ], "text/plain": [ "" ] }, "execution_count": 5, "metadata": {}, "output_type": "execute_result" } ], "source": [ "uhs[:10].show_in_notebook()" ] }, { "cell_type": "code", "execution_count": 6, "metadata": { "collapsed": true }, "outputs": [], "source": [ "log_file = open('log.txt', 'a')\n", "for field in fields:\n", " field_moc = MOC(filename=\"../../dmu2/dmu2_field_coverages/{}_MOC.fits\".format(field[0]))\n", " field_mask= inMoc(uhs[\"RA\"],uhs[\"DEC\"],field_moc)\n", " if not np.all( np.logical_not(field_mask)):\n", " uhs[field_mask].write(\"data/UHS-DR1_{}.fits\".format(field[0]), overwrite=True)\n", " \n", " subprocess.call([\"stilts\", \n", " \"pixfoot\", \n", " \"in=./data/UHS-DR1_{}.fits\".format(field[0]), \n", " \"out=./data/UHS-DR1_{}_MOC.fits\".format(field[0]),\n", " \"ra=RA\",\n", " \"dec=DEC\",\n", " \"order=10\"], \n", " stdout=log_file)\n" ] } ], "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 }