ctobssim.py

executed file - Dang Viet Tan, 01/22/2016 11:39 AM

Download (1.03 KB)

 
1
import gammalib
2
import ctools
3

    
4
def overall():
5

    
6
    model_name           = "models/model_ics.xml" 
7
    events_name          = "events-ics.fits"
8
    caldb                = "prod2"    
9
    irf                  = "South_50h" 
10
    ra                   =   258.37678
11
    dec                  =   -39.781175
12
    rad_sim              =   5.0
13
    tstart               =    0.0
14
    tstop                =  32400.0 # 9hr
15
    emin                 =    0.1 
16
    emax                 =  100.0
17
    rad_select           =    5.0
18

    
19
    # Simulate events
20
    print "Generating event file... "
21
    sim = ctools.ctobssim()
22
    sim.logFileOpen()
23
    sim["inmodel"].filename(model_name)
24
    sim["outevents"].filename(events_name)
25
    sim["caldb"].string(caldb)
26
    sim["irf"].string(irf)
27
    sim["ra"].real(ra)
28
    sim["dec"].real(dec)
29
    sim["rad"].real(rad_sim)
30
    sim["tmin"].real(tstart)
31
    sim["tmax"].real(tstop)
32
    sim["emin"].real(emin)
33
    sim["emax"].real(emax)
34
    sim.execute()
35
    print(sim.obs()[0].events())
36

    
37
    return
38

    
39
if __name__ == '__main__':
40
    overall()