In this notebook, the catalog files are defined and the fit_igmf script is run to calculate the IGMF limits

Imports


In [53]:
from astropy.table import Table
from os import path
from glob import glob
from time import time

Define the catalog names

The extension catalog file


In [3]:
cat = '../data/table_std_psf0123_joint2a_stdmodel_lnl_v15.fits'

The TeV source SEDs


In [4]:
tev_sed = '../data/TeV_sources_cut_var_zsafe.fits'

Get the IGMF data cube


In [5]:
th_jet = 6. # the jet opening angle
tmax = 1e7 # the maximum allowed time array
kind = 'elmag' # either 'elmag' or 'analytic'

In [19]:
basedir = '/nfs/farm/g/glast/u/mmeyer/projects/FermiHalo/Output/EBLm6/'
tmax_str = '{0:.0e}'.format(tmax).replace('+','').replace('0','')

if kind == 'elmag':
    filename = path.join(basedir,
                'th_jet{0:.2f}/gam-2.00/results_merged_z_th{0:.0f}d_t{1:s}.fits'.format(th_jet, tmax_str))
elif kind == 'analytic':
    filename = path.join(basedir,
                'th_jet{0:.2f}/gam-2.00/results_analytical_merged_z_th{0:.0f}d_t{1:s}.fits'.format(th_jet, tmax_str))
                
if not len(glob(filename)):
    raise ValueError("no such file {0:s}".format(filename))
else:
    print 'Casc model: {0:s}'.format(filename)


Casc model: /nfs/farm/g/glast/u/mmeyer/projects/FermiHalo/Output/EBLm6/th_jet6.00/gam-2.00/results_merged_z_th6d_t1e7.fits

Set the other analysis parameters


In [55]:
fint = 'LogParabolaExpCutoff' # either  'LogParabolaExpCutoff' or 'PLExpCutoff'
nsteps = 12 # number of steps for IGMF and Lcoh
casc_scale = 1.
casc_r68_scale = 1.

The output file:


In [21]:
out = '../data/fit_igmg_th_jet{0:.0f}_tmax{1:.0e}_lp_{2:s}.fits'.format(th_jet,tmax,kind)
print 'out file is ', out


out file is  ../data/fit_igmg_th_jet6_tmax1e+07_lp_elmag.fits

Get the full spectra TeV names


In [24]:
cat_tev = Table.read(tev_sed)

In [56]:
name = ' --name '.join(cat_tev['SOURCE_FULL'])
print name


1ES0229+200_HESS_2005-2006 --name 1ES0229+200_VERITAS_2009-2012 --name 1ES0347-121_HESS_2006-09-12 --name 1ES0414+009_VERITAS_2008-2011 --name 1ES0414+009_HESS_2005-2009 --name RGBJ0710+591_VERITAS_2008-2009 --name 1RXSJ101015.9-311909_HESS_2006-2 --name 1ES1101-232_HESS_2004-2005 --name 1ES1218+304_VERITAS_2008-2009 --name 1ES1218+304_VERITAS_2007 --name 1ES1312-423_HESS_2004-2010 --name H1426+428_HEGRA_1999_2000 --name H1426+428_HEGRA_2002 --name H2356-309_HESS_2004 --name H2356-309_HESS_2006 --name H2356-309_HESS_2005

Run the script


In [ ]:
t1 = time()
%run ../haloanalysis/scripts/fit_igmf.py $cat --output $out --modelfile $filename --sedfile $tev_sed \
                                            --int_spec $fint --nstep $nsteps --casc_scale $casc_scale \
                                            --name $name
print 'it took {0:.2f} s'.format(time() - t1)


((0, 0), 0.0079048253626297083, [0.14000000000000001, -4.0, -20.0], [1.4174527745514996e-13, -1.5664664595854532, 2.206922030598357e-09, 999999750.98381543])
((0, 1), 0.0079048253626297083, [0.14000000000000001, -4.0, -19.272727272727273], [1.4174527745514996e-13, -1.5664664595854532, 2.206922030598357e-09, 999999750.98381543])
((0, 2), 0.0079048253626297083, [0.14000000000000001, -4.0, -18.545454545454547], [1.4174527745514996e-13, -1.5664664595854532, 2.206922030598357e-09, 999999750.98381543])
((0, 3), 0.0079048253626297083, [0.14000000000000001, -4.0, -17.81818181818182], [1.4174527745514996e-13, -1.5664664595854532, 2.206922030598357e-09, 999999750.98381543])
((0, 4), 0.0079048253626297083, [0.14000000000000001, -4.0, -17.09090909090909], [1.4174527745514996e-13, -1.5664664595854532, 2.206922030598357e-09, 999999750.98381543])
((0, 5), 0.0079048253626297083, [0.14000000000000001, -4.0, -16.363636363636363], [1.4174527745514996e-13, -1.5664664595854532, 2.206922030598357e-09, 999999750.98381543])
((0, 6), 0.0079048253626297083, [0.14000000000000001, -4.0, -15.636363636363637], [1.4174527745514996e-13, -1.5664664595854532, 2.206922030598357e-09, 999999750.98381543])
((0, 7), 0.0079048253626297083, [0.14000000000000001, -4.0, -14.90909090909091], [1.4174527745514996e-13, -1.5664664595854532, 2.206922030598357e-09, 999999750.98381543])
((0, 8), 0.0079048253626297083, [0.14000000000000001, -4.0, -14.181818181818182], [1.4174527745514996e-13, -1.5664664595854532, 2.206922030598357e-09, 999999750.98381543])
((0, 9), 0.0079048253626297083, [0.14000000000000001, -4.0, -13.454545454545453], [1.4174527745514996e-13, -1.5664664595854532, 2.206922030598357e-09, 999999750.98381543])
((0, 10), 0.0079048253626297083, [0.14000000000000001, -4.0, -12.727272727272727], [1.4174527745514996e-13, -1.5664664595854532, 2.206922030598357e-09, 999999750.98381543])
((0, 11), 0.0079048253626297083, [0.14000000000000001, -4.0, -12.0], [1.4174527745514996e-13, -1.5664664595854532, 2.206922030598357e-09, 999999750.98381543])
((1, 0), 0.0079048253626297083, [0.14000000000000001, -3.2727272727272725, -20.0], [1.4174527745514996e-13, -1.5664664595854532, 2.206922030598357e-09, 999999750.98381543])
((1, 1), 0.0079048253626297083, [0.14000000000000001, -3.2727272727272725, -19.272727272727273], [1.4174527745514996e-13, -1.5664664595854532, 2.206922030598357e-09, 999999750.98381543])
((1, 2), 0.0079048253626297083, [0.14000000000000001, -3.2727272727272725, -18.545454545454547], [1.4174527745514996e-13, -1.5664664595854532, 2.206922030598357e-09, 999999750.98381543])
((1, 3), 0.0079048253626297083, [0.14000000000000001, -3.2727272727272725, -17.81818181818182], [1.4174527745514996e-13, -1.5664664595854532, 2.206922030598357e-09, 999999750.98381543])
((1, 4), 0.0079048253626297083, [0.14000000000000001, -3.2727272727272725, -17.09090909090909], [1.4174527745514996e-13, -1.5664664595854532, 2.206922030598357e-09, 999999750.98381543])
((1, 5), 0.0079048253626297083, [0.14000000000000001, -3.2727272727272725, -16.363636363636363], [1.4174527745514996e-13, -1.5664664595854532, 2.206922030598357e-09, 999999750.98381543])
((1, 6), 0.0079048253626297083, [0.14000000000000001, -3.2727272727272725, -15.636363636363637], [1.4174527745514996e-13, -1.5664664595854532, 2.206922030598357e-09, 999999750.98381543])
((1, 7), 0.0079048253626297083, [0.14000000000000001, -3.2727272727272725, -14.90909090909091], [1.4174527745514996e-13, -1.5664664595854532, 2.206922030598357e-09, 999999750.98381543])
((1, 8), 0.0079048253626297083, [0.14000000000000001, -3.2727272727272725, -14.181818181818182], [1.4174527745514996e-13, -1.5664664595854532, 2.206922030598357e-09, 999999750.98381543])
((1, 9), 0.0079048253626297083, [0.14000000000000001, -3.2727272727272725, -13.454545454545453], [1.4174527745514996e-13, -1.5664664595854532, 2.206922030598357e-09, 999999750.98381543])
((1, 10), 0.0079048253626297083, [0.14000000000000001, -3.2727272727272725, -12.727272727272727], [1.4174527745514996e-13, -1.5664664595854532, 2.206922030598357e-09, 999999750.98381543])
((1, 11), 0.0079048253626297083, [0.14000000000000001, -3.2727272727272725, -12.0], [1.4174527745514996e-13, -1.5664664595854532, 2.206922030598357e-09, 999999750.98381543])
((2, 0), 0.0079048253626297083, [0.14000000000000001, -2.5454545454545454, -20.0], [1.4174527745514996e-13, -1.5664664595854532, 2.206922030598357e-09, 999999750.98381543])
((2, 1), 0.0079048253626297083, [0.14000000000000001, -2.5454545454545454, -19.272727272727273], [1.4174527745514996e-13, -1.5664664595854532, 2.206922030598357e-09, 999999750.98381543])
((2, 2), 0.0079048253626297083, [0.14000000000000001, -2.5454545454545454, -18.545454545454547], [1.4174527745514996e-13, -1.5664664595854532, 2.206922030598357e-09, 999999750.98381543])
((2, 3), 0.0079048253626297083, [0.14000000000000001, -2.5454545454545454, -17.81818181818182], [1.4174527745514996e-13, -1.5664664595854532, 2.206922030598357e-09, 999999750.98381543])
((2, 4), 0.0079048253626297083, [0.14000000000000001, -2.5454545454545454, -17.09090909090909], [1.4174527745514996e-13, -1.5664664595854532, 2.206922030598357e-09, 999999750.98381543])
((2, 5), 0.0079048253626297083, [0.14000000000000001, -2.5454545454545454, -16.363636363636363], [1.4174527745514996e-13, -1.5664664595854532, 2.206922030598357e-09, 999999750.98381543])
((2, 6), 0.0079048253626297083, [0.14000000000000001, -2.5454545454545454, -15.636363636363637], [1.4174527745514996e-13, -1.5664664595854532, 2.206922030598357e-09, 999999750.98381543])
((2, 7), 0.0079048253626297083, [0.14000000000000001, -2.5454545454545454, -14.90909090909091], [1.4174527745514996e-13, -1.5664664595854532, 2.206922030598357e-09, 999999750.98381543])
((2, 8), 0.0079048253626297083, [0.14000000000000001, -2.5454545454545454, -14.181818181818182], [1.4174527745514996e-13, -1.5664664595854532, 2.206922030598357e-09, 999999750.98381543])
((2, 9), 0.0079048253626297083, [0.14000000000000001, -2.5454545454545454, -13.454545454545453], [1.4174527745514996e-13, -1.5664664595854532, 2.206922030598357e-09, 999999750.98381543])
((2, 10), 0.0079048253626297083, [0.14000000000000001, -2.5454545454545454, -12.727272727272727], [1.4174527745514996e-13, -1.5664664595854532, 2.206922030598357e-09, 999999750.98381543])

In [ ]: