{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": true
},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"/home/mc741/anaconda3/lib/python3.6/site-packages/mpl_toolkits/axes_grid/__init__.py:12: MatplotlibDeprecationWarning: \n",
"The mpl_toolkits.axes_grid module was deprecated in Matplotlib 2.1 and will be removed two minor releases later. Use mpl_toolkits.axes_grid1 and mpl_toolkits.axisartist, which provide the same functionality instead.\n",
" obj_type='module')\n"
]
}
],
"source": [
"import pylab as plt\n",
"import pymoc\n",
"import xidplus\n",
"import numpy as np\n",
"%matplotlib inline\n",
"from astropy.table import Table, join"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"import seaborn as sns"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"This notebook uses all the raw data from the CIGALE predictions and photoz catalogue, maps, PSF and relevant MOCs to create XID+ prior object and relevant tiling scheme"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Read in MOCs\n",
"The selection functions required are the main MOC associated with the masterlist. "
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"Sel_func=pymoc.MOC()\n",
"Sel_func.read('../../dmu4/dmu4_sm_NGP/data/holes_NGP_ukidss_k_O16_20190204_MOC.fits')\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Read in CIGALE predictions catalogue"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"cigale=Table.read('../../dmu28/dmu28_NGP/data/NGP_results_Ldust_prediction.fits')\n"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"cigale['id'].name = 'help_id'\n"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"Table length=1473955\n",
"
\n",
"help_id | bayes.dust.luminosity | bayes.dust.luminosity_err | best.chi_square | best.reduced_chi_square |
\n",
"bytes27 | float64 | float64 | float64 | float64 |
\n",
"HELP_J124043.436+340454.964 | 2.6255726460825376e+38 | 2.3341106226548585e+38 | 13.6758146750549 | 1.9536878107221285 |
\n",
"HELP_J124044.261+340515.932 | 4.454774001790711e+36 | 1.1836721760690504e+36 | 40.1312554377252 | 5.01640692971565 |
\n",
"HELP_J124044.423+340508.303 | 7.425850359374088e+38 | 8.50041825482934e+38 | 1.997400689108806 | 0.3329001148514677 |
\n",
"HELP_J124047.274+340554.983 | 1.4016155289703243e+38 | 1.4433711696275098e+38 | 36.513319610044825 | 5.216188515720689 |
\n",
"HELP_J124047.353+340507.994 | 3.6873140591071903e+37 | 2.5681660957952962e+37 | 36.02051777349351 | 4.502564721686689 |
\n",
"HELP_J124048.661+340635.189 | 2.3995085208439427e+35 | 1.1545619603215568e+35 | 84.95623366011355 | 10.619529207514194 |
\n",
"HELP_J124049.481+340533.486 | 1.03643281738859e+37 | 3.722264512058079e+36 | 268.4185900808973 | 33.55232376011216 |
\n",
"HELP_J124049.705+340627.843 | 8.703772920561137e+36 | 7.527415818915938e+36 | 179.84914554202115 | 25.692735077431593 |
\n",
"HELP_J124050.462+340830.858 | 5.183459585477802e+38 | 5.7490736768374256e+38 | 7.275370250021841 | 1.0393386071459774 |
\n",
"HELP_J124050.879+340445.811 | 5.653579254171697e+39 | 3.2226817865027835e+39 | 178.69838887213336 | 22.33729860901667 |
\n",
"... | ... | ... | ... | ... |
\n",
"HELP_J135159.418+234354.890 | 7.461172966310608e+37 | 8.326149414968744e+37 | 9.752297763874548 | 1.2190372204843185 |
\n",
"HELP_J135159.427+233452.235 | 2.176014166381297e+38 | 2.9921560143277654e+38 | 2.9450782572408913 | 0.4908463762068152 |
\n",
"HELP_J135159.455+233704.417 | 7.191836237872661e+38 | 9.253222575607047e+38 | 14.827187098559502 | 1.8533983873199378 |
\n",
"HELP_J135159.631+233659.037 | 1.5629847355631444e+38 | 1.944873488930478e+38 | 13.952049864196784 | 1.9931499805995405 |
\n",
"HELP_J135159.634+234408.055 | 2.1001621135172227e+37 | 2.197789962569013e+37 | 14.77316623725598 | 1.8466457796569975 |
\n",
"HELP_J135159.652+233129.787 | 6.216848794517417e+37 | 6.093618868577244e+37 | 3.7780351955128224 | 0.4722543994391028 |
\n",
"HELP_J135159.729+233139.022 | 7.190633460347819e+37 | 7.105843237132505e+37 | 6.212953433143757 | 0.7766191791429696 |
\n",
"HELP_J135159.854+233206.672 | 3.053461116040867e+38 | 3.462232577245399e+38 | 3.5594572690851827 | 0.44493215863564783 |
\n",
"HELP_J135159.896+233644.734 | 5.153674999945474e+37 | 5.243524093406064e+37 | 12.683045162367128 | 1.585380645295891 |
\n",
"HELP_J135159.920+233945.349 | 1.4586030615052245e+38 | 1.5263739794240154e+38 | 12.885754955320973 | 1.6107193694151216 |
\n",
"
"
],
"text/plain": [
"\n",
" help_id bayes.dust.luminosity ... best.reduced_chi_square\n",
" bytes27 float64 ... float64 \n",
"--------------------------- ---------------------- ... -----------------------\n",
"HELP_J124043.436+340454.964 2.6255726460825376e+38 ... 1.9536878107221285\n",
"HELP_J124044.261+340515.932 4.454774001790711e+36 ... 5.01640692971565\n",
"HELP_J124044.423+340508.303 7.425850359374088e+38 ... 0.3329001148514677\n",
"HELP_J124047.274+340554.983 1.4016155289703243e+38 ... 5.216188515720689\n",
"HELP_J124047.353+340507.994 3.6873140591071903e+37 ... 4.502564721686689\n",
"HELP_J124048.661+340635.189 2.3995085208439427e+35 ... 10.619529207514194\n",
"HELP_J124049.481+340533.486 1.03643281738859e+37 ... 33.55232376011216\n",
"HELP_J124049.705+340627.843 8.703772920561137e+36 ... 25.692735077431593\n",
"HELP_J124050.462+340830.858 5.183459585477802e+38 ... 1.0393386071459774\n",
"HELP_J124050.879+340445.811 5.653579254171697e+39 ... 22.33729860901667\n",
" ... ... ... ...\n",
"HELP_J135159.418+234354.890 7.461172966310608e+37 ... 1.2190372204843185\n",
"HELP_J135159.427+233452.235 2.176014166381297e+38 ... 0.4908463762068152\n",
"HELP_J135159.455+233704.417 7.191836237872661e+38 ... 1.8533983873199378\n",
"HELP_J135159.631+233659.037 1.5629847355631444e+38 ... 1.9931499805995405\n",
"HELP_J135159.634+234408.055 2.1001621135172227e+37 ... 1.8466457796569975\n",
"HELP_J135159.652+233129.787 6.216848794517417e+37 ... 0.4722543994391028\n",
"HELP_J135159.729+233139.022 7.190633460347819e+37 ... 0.7766191791429696\n",
"HELP_J135159.854+233206.672 3.053461116040867e+38 ... 0.44493215863564783\n",
"HELP_J135159.896+233644.734 5.153674999945474e+37 ... 1.585380645295891\n",
"HELP_J135159.920+233945.349 1.4586030615052245e+38 ... 1.6107193694151216"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"cigale"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Read in photoz"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"photoz=Table.read('../../dmu24/dmu24_NGP/data/master_catalogue_ngp_20180501_photoz_20180601_r_optimised.fits')"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"Table length=3175339\n",
"\n",
"help_id | RA | DEC | id | z1_median | z1_min | z1_max | z1_area | z2_median | z2_min | z2_max | z2_area | za_hb | chi_r_eazy | chi_r_atlas | chi_r_cosmos | chi_r_stellar | stellar_type |
\n",
"bytes27 | float64 | float64 | int64 | float64 | float64 | float64 | float64 | float64 | float64 | float64 | float64 | float64 | float64 | float64 | float64 | float64 | bytes6 |
\n",
"HELP_J131410.500+302813.489 | 198.54375042943158 | 30.47041372674147 | 2020994 | 0.1631 | 0.1017 | 0.2345 | 0.784 | -99.0 | -99.0 | -99.0 | -99.0 | 0.15233281491278122 | 0.162043 | 0.4889565 | 0.74402625 | 0.10714735 | rg5iii |
\n",
"HELP_J133855.810+281107.598 | 204.73254078095655 | 28.18544379782179 | 2020995 | 0.7177 | 0.2645 | 1.1746 | 0.798 | -99.0 | -99.0 | -99.0 | -99.0 | 0.7266483072093366 | 0.096690075 | 0.40835875 | 0.058110825 | 1.23097825 | m0iii |
\n",
"HELP_J130324.552+285933.902 | 195.85230149733783 | 28.99275044788535 | 2020996 | 0.5396 | 0.1697 | 0.9004 | 0.796 | -99.0 | -99.0 | -99.0 | -99.0 | 0.5782503582578263 | 0.012402935 | 0.0416054 | 0.61970925 | 0.6092085 | g5ii |
\n",
"HELP_J125051.674+284236.699 | 192.71530874422427 | 28.710194027938023 | 2020997 | 0.6721 | 0.3466 | 1.0359 | 0.786 | 1.0625 | 1.0543 | 1.0728 | 0.005 | 0.6165284812310255 | 0.25206375 | 0.2741105 | 0.2977545 | 1.9183805 | m3v |
\n",
"HELP_J133040.559+290320.044 | 202.66899411411032 | 29.055567760898036 | 2020998 | 0.622 | 0.2721 | 0.9996 | 0.753 | 0.217 | 0.1803 | 0.2532 | 0.044 | 0.606872782679902 | 0.0116719175 | 0.03691225 | 0.1725548 | 0.57439175 | rf8v |
\n",
"HELP_J125342.104+271050.555 | 193.42543477062267 | 27.18070960590991 | 2020999 | 0.6738 | 0.2457 | 1.1167 | 0.795 | -99.0 | -99.0 | -99.0 | -99.0 | 0.8387533654647497 | 0.041452575 | 0.0949765 | 0.071398625 | 3.30642 | m2p5v |
\n",
"HELP_J130655.638+304710.237 | 196.7318269709398 | 30.78617683330146 | 2021000 | 0.4578 | 0.115 | 0.8609 | 0.797 | -99.0 | -99.0 | -99.0 | -99.0 | 0.37509586981766757 | 1.94464675 | 4.1566 | 3.7360075 | 5.64026 | a3iii |
\n",
"HELP_J132321.501+264200.206 | 200.83958711978946 | 26.700057193650885 | 2021001 | 0.191 | 0.1352 | 0.2419 | 0.789 | -99.0 | -99.0 | -99.0 | -99.0 | 0.19093536712258813 | 0.330772 | 0.031593175 | 0.011386015 | 0.71356825 | rk4iii |
\n",
"HELP_J130554.319+305415.277 | 196.4763310378609 | 30.904243743657744 | 2021002 | 0.4068 | 0.1697 | 0.6458 | 0.799 | -99.0 | -99.0 | -99.0 | -99.0 | 0.38335882089940193 | 0.59804725 | 0.215782625 | 0.4299075 | 0.5903925 | rk3iii |
\n",
"HELP_J133509.654+295231.029 | 203.79022411876866 | 29.875285928172218 | 2021003 | 0.6878 | 0.2645 | 1.1167 | 0.795 | -99.0 | -99.0 | -99.0 | -99.0 | 0.8498024344378273 | 0.00037110575 | 0.0084950725 | 0.0054490625 | 1.97335075 | m2p5v |
\n",
"... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
\n",
"HELP_J134135.307+344421.576 | 205.3971133074335 | 34.7393265997969 | 6081856 | 0.6246 | 0.1454 | 1.1295 | 0.797 | -99.0 | -99.0 | -99.0 | -99.0 | 0.5972747586551431 | -99.0 | -99.0 | -99.0 | -99.0 | |
\n",
"HELP_J124858.080+341216.830 | 192.2420010874335 | 34.2046748997969 | 6081857 | 0.7911 | 0.2721 | 1.3367 | 0.799 | -99.0 | -99.0 | -99.0 | -99.0 | 0.7632358947773135 | 0.0131332775 | 0.000813626 | 0.0046128825 | 0.155416775 | m5v |
\n",
"HELP_J134424.709+335630.506 | 206.10295449743347 | 33.9418071297969 | 6081858 | 0.4668 | 0.125 | 0.8223 | 0.798 | -99.0 | -99.0 | -99.0 | -99.0 | 0.4512751936257148 | -99.0 | -99.0 | -99.0 | -99.0 | |
\n",
"HELP_J133709.162+345604.772 | 204.28817473743348 | 34.9346589397969 | 6081859 | 0.5455 | 0.1838 | 0.9523 | 0.798 | -99.0 | -99.0 | -99.0 | -99.0 | 0.4084467818129748 | 0.34569975 | 1.33296925 | 0.81952125 | 2.979185 | f5iii |
\n",
"HELP_J134920.644+332452.682 | 207.3360167874335 | 33.4146339197969 | 6081860 | 0.7343 | 0.3875 | 1.079 | 0.798 | -99.0 | -99.0 | -99.0 | -99.0 | 0.7579620087510602 | 0.10483351428571429 | 0.13722192857142856 | 0.23014 | 3.830704285714286 | m3ii |
\n",
"HELP_J125306.685+333113.670 | 193.2778540874335 | 33.5204639597969 | 6081862 | 0.6199 | 0.2125 | 1.0481 | 0.798 | -99.0 | -99.0 | -99.0 | -99.0 | 0.517972022837197 | 0.000487424 | 0.019583675 | 0.071689425 | 1.0567145 | m1v |
\n",
"HELP_J124548.943+313103.543 | 191.45392821032934 | 31.5176509039592 | 6081863 | 0.5218 | 0.2569 | 0.7952 | 0.793 | -99.0 | -99.0 | -99.0 | -99.0 | 0.5362698216644108 | 0.48726766666666665 | 0.14310031666666667 | 0.13941498333333333 | 3.8422983333333334 | m2i |
\n",
"HELP_J125400.987+335609.752 | 193.50411202743348 | 33.9360422697969 | 6081868 | -99.0 | -99.0 | -99.0 | -99.0 | -99.0 | -99.0 | -99.0 | -99.0 | 0.0628029174171393 | -99.0 | -99.0 | -99.0 | -99.0 | |
\n",
"HELP_J132505.187+340052.360 | 201.271613098188 | 34.01454455049162 | 6081875 | 0.4392 | 0.1558 | 0.7422 | 0.66 | 0.8877 | 0.8333 | 0.964 | 0.131 | 0.4126721221584137 | 0.19716165 | 2.18888425 | 2.3407385 | 11.774875 | k0iv |
\n",
"HELP_J124622.195+335623.136 | 191.5924800774335 | 33.9397599497969 | 6081877 | 0.1264 | 0.0222 | 0.2017 | 0.797 | -99.0 | -99.0 | -99.0 | -99.0 | 0.12168143590239443 | 6.49939 | 16.357805 | 22.56374 | 27.0209 | f0v |
\n",
"
"
],
"text/plain": [
"\n",
" help_id RA ... stellar_type\n",
" bytes27 float64 ... bytes6 \n",
"--------------------------- ------------------ ... ------------\n",
"HELP_J131410.500+302813.489 198.54375042943158 ... rg5iii\n",
"HELP_J133855.810+281107.598 204.73254078095655 ... m0iii\n",
"HELP_J130324.552+285933.902 195.85230149733783 ... g5ii\n",
"HELP_J125051.674+284236.699 192.71530874422427 ... m3v\n",
"HELP_J133040.559+290320.044 202.66899411411032 ... rf8v\n",
"HELP_J125342.104+271050.555 193.42543477062267 ... m2p5v\n",
"HELP_J130655.638+304710.237 196.7318269709398 ... a3iii\n",
"HELP_J132321.501+264200.206 200.83958711978946 ... rk4iii\n",
"HELP_J130554.319+305415.277 196.4763310378609 ... rk3iii\n",
"HELP_J133509.654+295231.029 203.79022411876866 ... m2p5v\n",
" ... ... ... ...\n",
"HELP_J134135.307+344421.576 205.3971133074335 ... \n",
"HELP_J124858.080+341216.830 192.2420010874335 ... m5v\n",
"HELP_J134424.709+335630.506 206.10295449743347 ... \n",
"HELP_J133709.162+345604.772 204.28817473743348 ... f5iii\n",
"HELP_J134920.644+332452.682 207.3360167874335 ... m3ii\n",
"HELP_J125306.685+333113.670 193.2778540874335 ... m1v\n",
"HELP_J124548.943+313103.543 191.45392821032934 ... m2i\n",
"HELP_J125400.987+335609.752 193.50411202743348 ... \n",
"HELP_J132505.187+340052.360 201.271613098188 ... k0iv\n",
"HELP_J124622.195+335623.136 191.5924800774335 ... f0v"
]
},
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"photoz"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Join CIGALE and photoz tables"
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"prior=join(cigale,photoz,keys='help_id')"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"from astropy.cosmology import Planck15 as cosmo\n",
"from astropy import units as u\n",
"f_pred=prior['bayes.dust.luminosity']/(4*np.pi*cosmo.luminosity_distance(prior['z1_median']).to(u.cm))\n"
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"prior=prior[np.isfinite(f_pred.value)][np.log10(f_pred.value[np.isfinite(f_pred.value)])>8.5]"
]
},
{
"cell_type": "code",
"execution_count": 12,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"prior['DEC'].name='Dec'"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Read in Maps"
]
},
{
"cell_type": "code",
"execution_count": 13,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"\n",
"pswfits='../../dmu19/dmu19_HELP-SPIRE-maps/data/HATLAS-NGP_SPIRE250_v1.0.fits'#SPIRE 250 map\n",
"pmwfits='../../dmu19/dmu19_HELP-SPIRE-maps/data/HATLAS-NGP_SPIRE350_v1.0.fits'#SPIRE 350 map\n",
"plwfits='../../dmu19/dmu19_HELP-SPIRE-maps/data/HATLAS-NGP_SPIRE500_v1.0.fits'#SPIRE 500 map\n",
"\n",
"#output folder\n",
"output_folder='./'"
]
},
{
"cell_type": "code",
"execution_count": 14,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"from astropy.io import fits\n",
"from astropy import wcs\n",
"\n",
"#-----250-------------\n",
"hdulist = fits.open(pswfits)\n",
"im250phdu=hdulist[0].header\n",
"im250hdu=hdulist[1].header\n",
"\n",
"im250=hdulist[1].data*1.0E3 #convert to mJy\n",
"nim250=hdulist[3].data*1.0E3 #convert to mJy\n",
"w_250 = wcs.WCS(hdulist[1].header)\n",
"pixsize250=3600.0*w_250.wcs.cdelt #pixel size (in arcseconds)\n",
"hdulist.close()\n",
"#-----350-------------\n",
"hdulist = fits.open(pmwfits)\n",
"im350phdu=hdulist[0].header\n",
"im350hdu=hdulist[1].header\n",
"\n",
"im350=hdulist[1].data*1.0E3 #convert to mJy\n",
"nim350=hdulist[3].data*1.0E3 #convert to mJy\n",
"w_350 = wcs.WCS(hdulist[1].header)\n",
"pixsize350=3600.0*w_350.wcs.cdelt #pixel size (in arcseconds)\n",
"hdulist.close()\n",
"#-----500-------------\n",
"hdulist = fits.open(plwfits)\n",
"im500phdu=hdulist[0].header\n",
"im500hdu=hdulist[1].header\n",
"im500=hdulist[1].data*1.0E3 #convert to mJy\n",
"nim500=hdulist[3].data*1.0E3 #convert to mJy\n",
"w_500 = wcs.WCS(hdulist[1].header)\n",
"pixsize500=3600.0*w_500.wcs.cdelt #pixel size (in arcseconds)\n",
"hdulist.close()"
]
},
{
"cell_type": "code",
"execution_count": 15,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"## Set XID+ prior class"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"WARNING: AstropyDeprecationWarning: \n",
"Private attributes \"_naxis1\" and \"_naxis2\" have been deprecated since v3.1.\n",
"Instead use the \"pixel_shape\" property which returns a list of NAXISj keyword values.\n",
" [astropy.wcs.wcs]\n",
"WARNING: AstropyDeprecationWarning: \n",
"Private attributes \"_naxis1\" and \"_naxis2\" have been deprecated since v3.1.\n",
"Instead use the \"pixel_shape\" property which returns a list of NAXISj keyword values.\n",
" [astropy.wcs.wcs]\n"
]
}
],
"source": [
"#---prior250--------\n",
"prior250=xidplus.prior(im250,nim250,im250phdu,im250hdu, moc=Sel_func)#Initialise with map, uncertianty map, wcs info and primary header\n",
"prior250.prior_cat(prior['RA'] ,prior['Dec'] ,'NGP_results_Ldust_prediction.fits',ID=prior['help_id'] )#Set input catalogue\n",
"prior250.prior_bkg(-5.0,5)#Set prior on background (assumes Gaussian pdf with mu and sigma)\n",
"#---prior350--------\n",
"prior350=xidplus.prior(im350,nim350,im350phdu,im350hdu, moc=Sel_func)\n",
"prior350.prior_cat(prior['RA'] ,prior['Dec'] ,'NGP_results_Ldust_prediction.fits',ID=prior['help_id'] )\n",
"prior350.prior_bkg(-5.0,5)\n",
"\n",
"#---prior500--------\n",
"prior500=xidplus.prior(im500,nim500,im500phdu,im500hdu, moc=Sel_func)\n",
"prior500.prior_cat(prior['RA'] ,prior['Dec'] ,'NGP_results_Ldust_prediction.fits',ID=prior['help_id'] )\n",
"prior500.prior_bkg(-5.0,5)"
]
},
{
"cell_type": "code",
"execution_count": 17,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"#pixsize array (size of pixels in arcseconds)\n",
"pixsize=np.array([pixsize250,pixsize350,pixsize500])\n",
"#point response function for the three bands\n",
"prfsize=np.array([18.15,25.15,36.3])\n",
"#use Gaussian2DKernel to create prf (requires stddev rather than fwhm hence pfwhm/2.355)\n",
"from astropy.convolution import Gaussian2DKernel\n",
"\n",
"##---------fit using Gaussian beam-----------------------\n",
"prf250=Gaussian2DKernel(prfsize[0]/2.355,x_size=101,y_size=101)\n",
"prf250.normalize(mode='peak')\n",
"prf350=Gaussian2DKernel(prfsize[1]/2.355,x_size=101,y_size=101)\n",
"prf350.normalize(mode='peak')\n",
"prf500=Gaussian2DKernel(prfsize[2]/2.355,x_size=101,y_size=101)\n",
"prf500.normalize(mode='peak')\n",
"\n",
"pind250=np.arange(0,101,1)*1.0/pixsize[0,1] #get 250 scale in terms of pixel scale of map\n",
"pind350=np.arange(0,101,1)*1.0/pixsize[1,1] #get 350 scale in terms of pixel scale of map\n",
"pind500=np.arange(0,101,1)*1.0/pixsize[2,1] #get 500 scale in terms of pixel scale of map\n",
"\n",
"prior250.set_prf(prf250.array,pind250,pind250)#requires psf as 2d grid, and x and y bins for grid (in pixel scale)\n",
"prior350.set_prf(prf350.array,pind350,pind350)\n",
"prior500.set_prf(prf500.array,pind500,pind500)"
]
},
{
"cell_type": "code",
"execution_count": 18,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"----- There are 4959 tiles required for input catalogue and 102 large tiles\n",
"writing total_bytes=1588798331...\n",
"writing bytes [0, 1073741824)... done.\n",
"writing bytes [1073741824, 1588798331)... done.\n"
]
},
{
"ename": "SystemExit",
"evalue": "",
"output_type": "error",
"traceback": [
"An exception has occurred, use %tb to see the full traceback.\n",
"\u001b[0;31mSystemExit\u001b[0m\n"
]
}
],
"source": [
"import pickle\n",
"#from moc, get healpix pixels at a given order\n",
"from xidplus import moc_routines\n",
"order=9\n",
"tiles=moc_routines.get_HEALPix_pixels(order,prior250.sra,prior250.sdec,unique=True)\n",
"order_large=6\n",
"tiles_large=moc_routines.get_HEALPix_pixels(order_large,prior250.sra,prior250.sdec,unique=True)\n",
"print('----- There are '+str(len(tiles))+' tiles required for input catalogue and '+str(len(tiles_large))+' large tiles')\n",
"output_folder='./data/'\n",
"outfile=output_folder+'Master_prior.pkl'\n",
"xidplus.io.pickle_dump({'priors':[prior250,prior350,prior500],'tiles':tiles,'order':order,'version':xidplus.io.git_version()},outfile)\n",
"outfile=output_folder+'Tiles.pkl'\n",
"with open(outfile, 'wb') as f:\n",
" pickle.dump({'tiles':tiles,'order':order,'tiles_large':tiles_large,'order_large':order_large,'version':xidplus.io.git_version()},f)\n",
"raise SystemExit()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"prior250.nsrc"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
}
],
"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.8"
}
},
"nbformat": 4,
"nbformat_minor": 2
}