test_csupperlimit.py
1 |
import gammalib as gl |
---|---|
2 |
import csupperlimit |
3 |
import obsutils |
4 |
import os |
5 |
|
6 |
|
7 |
|
8 |
if __name__ == "__main__": |
9 |
dir = gl.GSkyDir() |
10 |
dir.radec_deg(83.6331,22.01) |
11 |
ob = obsutils.set(dir)
|
12 |
|
13 |
obs = gl.GObservations() |
14 |
obs.append(ob) |
15 |
|
16 |
obs.models(os.environ["CTOOLS"]+"/test/data/crab.xml") |
17 |
filled_obs = obsutils.sim(obs) |
18 |
|
19 |
ulim = csupperlimit.csupperlimit(filled_obs) |
20 |
ulim.source = "Crab"
|
21 |
ulim.parname="Prefactor"
|
22 |
ulim.run() |
23 |
|
24 |
ulimit = ulim.ulimit |
25 |
print "Retrieved 95% U.L. to "+str("%.2e" % ulimit)+" 1/cm2/s/MeV" |
26 |
|