test.py
1 |
#! /usr/bin/env python
|
---|---|
2 |
import gammalib |
3 |
import ctools |
4 |
import cscripts |
5 |
from cscripts import obsutils |
6 |
|
7 |
def test(irf, emin, emax): |
8 |
"""
|
9 |
"""
|
10 |
# Set pointing direction
|
11 |
pntdir = gammalib.GSkyDir() |
12 |
pntdir.radec_deg(83.63, 22.01) |
13 |
|
14 |
# Set CTA Observation
|
15 |
run = obsutils.set_obs(pntdir, emin=emin, emax=emax, rad=5.0, duration=21232, irf=irf, caldb='.') |
16 |
|
17 |
# Setup observation container
|
18 |
obs = gammalib.GObservations() |
19 |
obs.append(run) |
20 |
|
21 |
# Simulate events
|
22 |
sim = ctools.ctobssim(obs) |
23 |
sim['inmodel'] = 'model_src+bkg_CTA.xml' |
24 |
sim['outevents'] = 'events.fits' |
25 |
sim['chatter'] = 4 |
26 |
sim['debug'] = True |
27 |
sim.execute() |
28 |
|
29 |
# Return
|
30 |
return
|
31 |
|
32 |
|
33 |
if __name__ == '__main__': |
34 |
|
35 |
# Run tests
|
36 |
#test('IRF_ASTRI_cut_mod.fits', 0.631, 398.0)
|
37 |
test('IRF_ASTRI_cut_mod_2.fits', 0.631, 398.0) |