In [1]:
%pylab inline


Welcome to pylab, a matplotlib-based Python environment [backend: module://IPython.zmq.pylab.backend_inline].
For more information, type 'help(pylab)'.

In [2]:
from VOT import *

This is an example of calculating one of the built-in objects (PG1553, Crab Nebula etc.). It shows which effective area table was used and some other diagnostic information.


In [3]:
vt1 = VOT("PG1553")


WARNING - Spectrum starts below minimum energy in EBL table.
WARNING - Spectrum continues beyond maximum energy in EBL table.
WARNING - Using 659.0 counts/hr as the rate from the Crab Nebula.
WARNING - Time to detection assumes a Crab Nebula Spectrum.
INFO - Using Effective_Areas/VERITAS/ea_Nov2010_na_ATM21_vegasv240rc1_7sam_050off_soft-1.summary.csv
INFO - Using EffectiveArea_Azimuth_0_Zenith_20_Noise_4.07
INFO - Safe energy range: 177.83 to 25,118.86 GeV
INFO - dNdE at 1 GeV: 1.12e-08 s^-1 cm^-2 GeV^-1
INFO - dNdE at 400 GeV: 5.19e-13 s^-1 cm^-2 GeV^-1
INFO - dNdE at 1 TeV: 1.13e-13 s^-1 cm^-2 GeV^-1
INFO - tau at min safe E: 0.71
INFO - tau at max safe E: 336.88
INFO - Predicted counts/hour: 9.90e+01
INFO - This is approximately 15.0205% of the Crab Nebula's Flux
INFO - This will take approximately 0.2646 hours to detect at a 5 sigma level

In [4]:
from VOTPlot import Plot, PlotSpectrum

In [5]:
PlotSpectrum(vt1.VS)



In [6]:
Plot(vt1.VS, vt1.VR)


The first plot shows the LAT spectrum (blue) extrabolated out to VHE energies, the red curve is the EBL curve used and the green curve is the LAT spectrum with the EBL effects. The second plot shows the same blue and green curves from before along with the Effecitve Area curve used. The blue vertical lines are the 'safe energy range'.

This is the same calculation but with a different average zenith angle.


In [7]:
vt2 = VOT("PG1553", zenith=35)


WARNING - Spectrum starts below minimum energy in EBL table.
WARNING - Spectrum continues beyond maximum energy in EBL table.
WARNING - Using 659.0 counts/hr as the rate from the Crab Nebula.
WARNING - Time to detection assumes a Crab Nebula Spectrum.
INFO - Using Effective_Areas/VERITAS/ea_Nov2010_na_ATM21_vegasv240rc1_7sam_050off_soft-1.summary.csv
INFO - Using EffectiveArea_Azimuth_0_Zenith_35_Noise_4.07
INFO - Safe energy range: 281.84 to 39,810.72 GeV
INFO - dNdE at 1 GeV: 1.12e-08 s^-1 cm^-2 GeV^-1
INFO - dNdE at 400 GeV: 5.19e-13 s^-1 cm^-2 GeV^-1
INFO - dNdE at 1 TeV: 1.13e-13 s^-1 cm^-2 GeV^-1
INFO - tau at min safe E: 1.67
INFO - tau at max safe E: 468.48
INFO - Predicted counts/hour: 2.94e+01
INFO - This is approximately 4.4563% of the Crab Nebula's Flux
INFO - This will take approximately 1.7593 hours to detect at a 5 sigma level

In [8]:
vt3 = VOT("PG1553", zenith=35, eblModel="Kneiske")

In [9]:
Plot(vt3.VS, vt3.VR)


This is the same calculation but with a different EBL Model. Now, if you wanted to compare to the Crab, just do:


In [10]:
vtcrab = VOT("Crab")


WARNING - Using minimum redshift in EBL table.
WARNING - Spectrum starts below minimum energy in EBL table.
WARNING - Spectrum continues beyond maximum energy in EBL table.
WARNING - Using 659.0 counts/hr as the rate from the Crab Nebula.
WARNING - Time to detection assumes a Crab Nebula Spectrum.
INFO - Using Effective_Areas/VERITAS/ea_Nov2010_na_ATM21_vegasv240rc1_7sam_050off_soft-1.summary.csv
INFO - Using EffectiveArea_Azimuth_0_Zenith_20_Noise_4.07
INFO - Safe energy range: 177.83 to 25,118.86 GeV
INFO - dNdE at 1 GeV: 5.56e-07 s^-1 cm^-2 GeV^-1
INFO - dNdE at 400 GeV: 3.26e-13 s^-1 cm^-2 GeV^-1
INFO - dNdE at 1 TeV: 3.50e-14 s^-1 cm^-2 GeV^-1
INFO - tau at min safe E: 0.00
INFO - tau at max safe E: 0.00
INFO - Predicted counts/hour: 6.59e+02
INFO - This is approximately 100.0381% of the Crab Nebula's Flux
INFO - This will take approximately 0.0337 hours to detect at a 5 sigma level

In [11]:
vtCTA = VOT("PG1553", instrument="CTA", eblModel="Finke")


WARNING - Spectrum starts below minimum energy in EBL table.
WARNING - Spectrum continues beyond maximum energy in EBL table.
WARNING - This EA is for demonstration purposes only.  All paramters (zenith etc.) are ignored.
WARNING - Using 1760.0 counts/hr as the rate from the Crab Nebula.
WARNING - Assuming 10 times worse sensitivity than HESS for CTA!
INFO - Using Effective_Areas/CTA/EA_1210.3503_Fig15_MPIK.csv
INFO - Using EA_1210.3503_Fig15_MPIK
INFO - Safe energy range: 100.00 to 100,000.00 GeV
INFO - dNdE at 1 GeV: 1.12e-08 s^-1 cm^-2 GeV^-1
INFO - dNdE at 400 GeV: 5.19e-13 s^-1 cm^-2 GeV^-1
INFO - dNdE at 1 TeV: 1.13e-13 s^-1 cm^-2 GeV^-1
INFO - tau at min safe E: 0.26
INFO - tau at max safe E: 486.67
INFO - Predicted counts/hour: 2.67e+02
INFO - This is approximately 15.1777% of the Crab Nebula's Flux
INFO - This will take approximately 0.0151 hours to detect at a 5 sigma level

In [12]:
Plot(vtCTA.VS, vtCTA.VR)


The rate is stored in each of these variables so you can compare these:


In [13]:
"PG1553 is {:,.2f}% of the Crab".format(100.*(vt1.rate/vtcrab.rate))


Out[13]:
'PG1553 is 15.01% of the Crab'

You can create you're own source with any of the functions in the 2FGL (powerlaw, curved powerlaw etc.) and with a few different EBL models. This is a work in progress and if there is a particular source type that you need, I'll add it in.


In [14]:
vtcustom = VOT("custom", eMin=0.1, eMax=100000, Nbins=10000, redshift=0.8955, eblModel='Dominguez', instrument='VERITAS', zenith=20, spectralModel='LogParabola', N0 = 1.359e-11,
                                  alpha=-1.8772, beta=-0.067012, Eb = 0.9085)


WARNING - Spectrum starts below minimum energy in EBL table.
WARNING - Spectrum continues beyond maximum energy in EBL table.
WARNING - Using 659.0 counts/hr as the rate from the Crab Nebula.
WARNING - Time to detection assumes a Crab Nebula Spectrum.
INFO - Using Effective_Areas/VERITAS/ea_Nov2010_na_ATM21_vegasv240rc1_7sam_050off_soft-1.summary.csv
INFO - Using EffectiveArea_Azimuth_0_Zenith_20_Noise_4.07
INFO - Safe energy range: 177.83 to 25,118.86 GeV
INFO - dNdE at 1 GeV: 1.13e-11 s^-1 cm^-2 GeV^-1
INFO - dNdE at 400 GeV: 1.24e-17 s^-1 cm^-2 GeV^-1
INFO - dNdE at 1 TeV: 9.90e-19 s^-1 cm^-2 GeV^-1
INFO - tau at min safe E: 1.85
INFO - tau at max safe E: 1,081.82
INFO - Predicted counts/hour: 7.46e-04
INFO - This is approximately 0.0001% of the Crab Nebula's Flux
INFO - This will take approximately 241.6449 hours to detect at a 5 sigma level

In [15]:
Plot(vtcustom.VS, vtcustom.VR)


This is actually one of the built in sources:


In [16]:
vt4C = VOT("4C5517")


WARNING - Spectrum starts below minimum energy in EBL table.
WARNING - Spectrum continues beyond maximum energy in EBL table.
WARNING - Using 659.0 counts/hr as the rate from the Crab Nebula.
WARNING - Time to detection assumes a Crab Nebula Spectrum.
INFO - Using Effective_Areas/VERITAS/ea_Nov2010_na_ATM21_vegasv240rc1_7sam_050off_soft-1.summary.csv
INFO - Using EffectiveArea_Azimuth_0_Zenith_20_Noise_4.07
INFO - Safe energy range: 177.83 to 25,118.86 GeV
INFO - dNdE at 1 GeV: 1.13e-11 s^-1 cm^-2 GeV^-1
INFO - dNdE at 400 GeV: 1.24e-17 s^-1 cm^-2 GeV^-1
INFO - dNdE at 1 TeV: 9.90e-19 s^-1 cm^-2 GeV^-1
INFO - tau at min safe E: 1.85
INFO - tau at max safe E: 1,081.82
INFO - Predicted counts/hour: 7.46e-04
INFO - This is approximately 0.0001% of the Crab Nebula's Flux
INFO - This will take approximately 241.6449 hours to detect at a 5 sigma level

In [17]:
"4C5517 is {:,.4f}% of the Crab".format(100.*(vt4C.rate/vtcrab.rate))


Out[17]:
'4C5517 is 0.0001% of the Crab'

In [18]:
vtHESS = VOT("PG1553", instrument="HESS", zenith=45)


WARNING - Spectrum starts below minimum energy in EBL table.
WARNING - Spectrum continues beyond maximum energy in EBL table.
WARNING - Using 1040.0 counts/hr as the rate from the Crab Nebula.
WARNING - Time to detection assumes a Crab Nebula Spectrum.
INFO - Using Effective_Areas/HESS/EA_AA457_Fig13_True_Zenith_45.csv
INFO - Using EA_AA457_Fig13_True_Zenith_45
INFO - Safe energy range: 395.02 to 45,000.00 GeV
INFO - dNdE at 1 GeV: 1.12e-08 s^-1 cm^-2 GeV^-1
INFO - dNdE at 400 GeV: 5.19e-13 s^-1 cm^-2 GeV^-1
INFO - dNdE at 1 TeV: 1.13e-13 s^-1 cm^-2 GeV^-1
INFO - tau at min safe E: 2.79
INFO - tau at max safe E: 468.48
INFO - Predicted counts/hour: 1.06e+01
INFO - This is approximately 1.0235% of the Crab Nebula's Flux
INFO - This will take approximately 21.9515 hours to detect at a 5 sigma level

In [19]:
Plot(vtHESS.VS, vtHESS.VR)


You can get a JSON string as output if you like which is useful for websites.


In [5]:
vtjson = VOT("PG1553", output = "JSON")


WARNING - Spectrum starts below minimum energy in EBL table.
WARNING - Spectrum continues beyond maximum energy in EBL table.
WARNING - Using 659.0 counts/hr as the rate from the Crab Nebula.
WARNING - Time to detection assumes a Crab Nebula Spectrum.
[{"EAFile": {"value": "Effective_Areas/VERITAS/ea_Nov2010_na_ATM21_vegasv240rc1_7sam_050off_soft-1.summary.csv", "unit": "file name"}, "DetTime": {"value": 0.26460586272188408, "unit": "Hours"}, "Emin": {"value": 177.82794100389228, "unit": "GeV"}, "Emax": {"value": 25118.864315095823, "unit": "GeV"}, "Rate": {"value": 98.98520728146319, "unit": "counts/hour"}, "Crab": {"value": 15.020517038158296, "unit": "% Crab"}, "EATable": {"value": "EffectiveArea_Azimuth_0_Zenith_20_Noise_4.07", "unit": "table name"}}]

And you can use JSON as input which is useful for websites.


In [6]:
vtjson2 = VOT(output = "JSON", input = "JSON", jsonString='[{"source":"custom", "eMin":0.1, "eMax":100000, "Nbins":10000, "redshift":0.8955, "eblModel":"Dominguez","instrument":"VERITAS", "zenith":20, "spectralModel":"LogParabola", "N0":1.359e-11, "alpha":-1.8772, "beta":-0.067012, "Eb":0.9085}]')


WARNING - Spectrum starts below minimum energy in EBL table.
WARNING - Spectrum continues beyond maximum energy in EBL table.
WARNING - Using 659.0 counts/hr as the rate from the Crab Nebula.
WARNING - Time to detection assumes a Crab Nebula Spectrum.
[{"EAFile": {"value": "Effective_Areas/VERITAS/ea_Nov2010_na_ATM21_vegasv240rc1_7sam_050off_soft-1.summary.csv", "unit": "file name"}, "DetTime": {"value": 241.64486464500001, "unit": "Hours"}, "Emin": {"value": 177.82794100389228, "unit": "GeV"}, "Emax": {"value": 25118.864315095823, "unit": "GeV"}, "Rate": {"value": 0.00074586894890236587, "unit": "counts/hour"}, "Crab": {"value": 0.00011318193458306008, "unit": "% Crab"}, "EATable": {"value": "EffectiveArea_Azimuth_0_Zenith_20_Noise_4.07", "unit": "table name"}}]

There's a really simple CLI right now.

python VOT.py --source custom --output JSON --input JSON --jsonInput '[{"source":"custom", "eMin":0.1, "eMax":100000, "Nbins":10000, "redshift":0.8955, "eblModel":"Dominguez","instrument":"VERITAS", "zenith":20, "spectralModel":"LogParabola", "N0":1.359e-11, "alpha":-1.8772, "beta":-0.067012, "Eb":0.9085}]'


In [7]:
vtpl2 = VOT("custom", eMin=0.1, eMax=100000, Nbins=10000, redshift=0.5846, eblModel='Dominguez', instrument='VERITAS', zenith=40, spectralModel='PowerLaw2', N = 1.7e-6, index = -2.26 , E1 = 0.1, E2 = 300)


INFO - Calculated normalization: 1.17716549189e-07 s^-1 cm^-2 GeV^-1
WARNING - Spectrum starts below minimum energy in EBL table.
WARNING - Spectrum continues beyond maximum energy in EBL table.
WARNING - Using 659.0 counts/hr as the rate from the Crab Nebula.
WARNING - Time to detection assumes a Crab Nebula Spectrum.
INFO - Using Effective_Areas/VERITAS/ea_Nov2010_na_ATM21_vegasv240rc1_7sam_050off_soft-1.summary.csv
INFO - Using EffectiveArea_Azimuth_0_Zenith_40_Noise_4.07
INFO - Safe energy range: 316.23 to 39,810.72 GeV
INFO - dNdE at 1 GeV: 1.18e-07 s^-1 cm^-2 GeV^-1
INFO - dNdE at 400 GeV: 1.55e-13 s^-1 cm^-2 GeV^-1
INFO - dNdE at 1 TeV: 1.95e-14 s^-1 cm^-2 GeV^-1
INFO - tau at min safe E: 2.52
INFO - tau at max safe E: 630.75
INFO - Predicted counts/hour: 2.93e+00
INFO - This is approximately 0.4447% of the Crab Nebula's Flux
INFO - This will take approximately 121.0428 hours to detect at a 5 sigma level

In [8]:
Plot(vtpl2.VS, vtpl2.VR)


Some other examples (HESS2, HAWC)...


In [5]:
HESS2 = VOT("PG1553", instrument='HESS2')


WARNING - Spectrum starts below minimum energy in EBL table.
WARNING - Spectrum continues beyond maximum energy in EBL table.
WARNING - This EA is for demonstration purposes only.  All paramters (zenith etc.) are ignored.
WARNING - Using 2150.0 counts/hr as the rate from the Crab Nebula.
WARNING - Assuming HESS sensitivity but using HESS2 effective areas!
INFO - Using Effective_Areas/HESS2/EA_1307.6003v1_Fig2_AC2.csv
INFO - Using EA_1307.6003v1_Fig2_AC2
INFO - Safe energy range: 50.00 to 990.00 GeV
INFO - dNdE at 1 GeV: 1.12e-08 s^-1 cm^-2 GeV^-1
INFO - dNdE at 400 GeV: 5.19e-13 s^-1 cm^-2 GeV^-1
INFO - dNdE at 1 TeV: 1.13e-13 s^-1 cm^-2 GeV^-1
INFO - tau at min safe E: 0.04
INFO - tau at max safe E: 6.59
INFO - Predicted counts/hour: 7.74e+02
INFO - This is approximately 35.9916% of the Crab Nebula's Flux
INFO - This will take approximately 0.0381 hours to detect at a 5 sigma level

In [6]:
Plot(HESS2.VS, HESS2.VR)



In [12]:
HAWC = VOT("Crab", instrument='HAWC')


WARNING - Using minimum redshift in EBL table.
WARNING - Spectrum starts below minimum energy in EBL table.
WARNING - Spectrum continues beyond maximum energy in EBL table.
WARNING - Assuming 1000 times worse sensitivity than HESS for HAWC!
INFO - Using Effective_Areas/HAWC/EA_APh35_Fig2_nHit_70_cosTh_0809.csv
INFO - Using EA_APh35_Fig2_nHit_70_cosTh_0809
INFO - Safe energy range: 63.10 to 99,000.00 GeV
INFO - dNdE at 1 GeV: 5.56e-07 s^-1 cm^-2 GeV^-1
INFO - dNdE at 400 GeV: 3.26e-13 s^-1 cm^-2 GeV^-1
INFO - dNdE at 1 TeV: 3.50e-14 s^-1 cm^-2 GeV^-1
INFO - tau at min safe E: 0.00
INFO - tau at max safe E: 0.00
INFO - Predicted counts/hour: 1.90e+01
INFO - This is approximately 100.1030% of the Crab Nebula's Flux
INFO - This will take approximately 8.9399 hours to detect at a 5 sigma level

In [ ]: