Commit 66518ce6521e33faeb8bbc784cd3a1220026652f

Authored by Jürgen Knödlseder
1 parent a1f63642

Set default deadc value to 0.98

ChangeLog
@@ -5,6 +5,7 @@ @@ -5,6 +5,7 @@
5 5
6 Set local language to english (#1370) 6 Set local language to english (#1370)
7 Enhance logfile output of csroot2caldb script 7 Enhance logfile output of csroot2caldb script
  8 + Set default deadc value to 0.98 (CTA has <2% deadtime)
8 9
9 10
10 2017-02-09 11 2017-02-09
cscripts/csobsdef.par
@@ -29,7 +29,7 @@ irf, s, h, ,,, &quot;Instrument response function&quot; @@ -29,7 +29,7 @@ irf, s, h, ,,, &quot;Instrument response function&quot;
29 emin, r, h, UNDEF,,, "Lower energy limit (TeV)" 29 emin, r, h, UNDEF,,, "Lower energy limit (TeV)"
30 emax, r, h, UNDEF,,, "Upper energy limit (TeV)" 30 emax, r, h, UNDEF,,, "Upper energy limit (TeV)"
31 rad, r, h, UNDEF,,, "Radius of ROI (degrees)" 31 rad, r, h, UNDEF,,, "Radius of ROI (degrees)"
32 -deadc, r, h, 0.95,,, "Deadtime correction factor" 32 +deadc, r, h, 0.98,,, "Deadtime correction factor"
33 33
34 # 34 #
35 # Standard parameters 35 # Standard parameters
cscripts/cspull.par
@@ -21,7 +21,7 @@ inmodel, f, a, $CTOOLS/share/models/crab.xml,,, &quot;Input model definition XML file @@ -21,7 +21,7 @@ inmodel, f, a, $CTOOLS/share/models/crab.xml,,, &quot;Input model definition XML file
21 caldb, s, a, prod2,,, "Calibration database" 21 caldb, s, a, prod2,,, "Calibration database"
22 irf, s, a, South_0.5h,,, "Instrument response function" 22 irf, s, a, South_0.5h,,, "Instrument response function"
23 edisp, b, h, no,,, "Apply energy dispersion?" 23 edisp, b, h, no,,, "Apply energy dispersion?"
24 -deadc, r, h, 0.95,0,1, "Deadtime correction factor" 24 +deadc, r, h, 0.98,0,1, "Deadtime correction factor"
25 outfile, f, a, pull.dat,,, "Output pull distribution file" 25 outfile, f, a, pull.dat,,, "Output pull distribution file"
26 26
27 # 27 #
cscripts/cssens.par
@@ -22,7 +22,7 @@ srcname, s, a, Crab,,, &quot;Source name&quot; @@ -22,7 +22,7 @@ srcname, s, a, Crab,,, &quot;Source name&quot;
22 caldb, s, a, prod2,,, "Calibration database" 22 caldb, s, a, prod2,,, "Calibration database"
23 irf, s, a, South_0.5h,,, "Instrument response function" 23 irf, s, a, South_0.5h,,, "Instrument response function"
24 edisp, b, h, no,,, "Apply energy dispersion?" 24 edisp, b, h, no,,, "Apply energy dispersion?"
25 -deadc, r, h, 0.95,0,1, "Deadtime correction factor" 25 +deadc, r, h, 0.98,0,1, "Deadtime correction factor"
26 outfile, f, h, sensitivity.dat,,, "Output sensitivity ASCII file" 26 outfile, f, h, sensitivity.dat,,, "Output sensitivity ASCII file"
27 27
28 # 28 #
cscripts/cstsdist.par
@@ -26,7 +26,7 @@ bkgcube, f, a, NONE,,, &quot;Input background cube file (only needed for stacked an @@ -26,7 +26,7 @@ bkgcube, f, a, NONE,,, &quot;Input background cube file (only needed for stacked an
26 caldb, s, a, prod2,,, "Calibration database" 26 caldb, s, a, prod2,,, "Calibration database"
27 irf, s, a, South_0.5h,,, "Instrument response function" 27 irf, s, a, South_0.5h,,, "Instrument response function"
28 edisp, b, h, no,,, "Apply energy dispersion?" 28 edisp, b, h, no,,, "Apply energy dispersion?"
29 -deadc, r, h, 0.95,0,1, "Deadtime correction factor" 29 +deadc, r, h, 0.98,0,1, "Deadtime correction factor"
30 outfile, f, a, ts.dat,,, "Output Test Statistic distribution file" 30 outfile, f, a, ts.dat,,, "Output Test Statistic distribution file"
31 31
32 # 32 #
cscripts/obsutils.py
1 # ========================================================================== 1 # ==========================================================================
2 # Utility functions for observation handling 2 # Utility functions for observation handling
3 # 3 #
4 -# Copyright (C) 2011-2016 Juergen Knoedlseder 4 +# Copyright (C) 2011-2017 Juergen Knoedlseder
5 # 5 #
6 # This program is free software: you can redistribute it and/or modify 6 # This program is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by 7 # it under the terms of the GNU General Public License as published by
@@ -178,7 +178,7 @@ def sim(obs, log=False, debug=False, chatter=2, edisp=False, seed=0, @@ -178,7 +178,7 @@ def sim(obs, log=False, debug=False, chatter=2, edisp=False, seed=0,
178 # ======================= # 178 # ======================= #
179 # Set one CTA observation # 179 # Set one CTA observation #
180 # ======================= # 180 # ======================= #
181 -def set_obs(pntdir, tstart=0.0, duration=1800.0, deadc=0.95, \ 181 +def set_obs(pntdir, tstart=0.0, duration=1800.0, deadc=0.98, \
182 emin=0.1, emax=100.0, rad=5.0, \ 182 emin=0.1, emax=100.0, rad=5.0, \
183 irf='South_50h', caldb='prod2', obsid='000000'): 183 irf='South_50h', caldb='prod2', obsid='000000'):
184 """ 184 """
@@ -273,7 +273,7 @@ def set_obs(pntdir, tstart=0.0, duration=1800.0, deadc=0.95, \ @@ -273,7 +273,7 @@ def set_obs(pntdir, tstart=0.0, duration=1800.0, deadc=0.95, \
273 # ============================ # 273 # ============================ #
274 # Set list of CTA observations # 274 # Set list of CTA observations #
275 # ============================ # 275 # ============================ #
276 -def set_obs_list(obsdeflist, tstart=0.0, duration=1800.0, deadc=0.95, \ 276 +def set_obs_list(obsdeflist, tstart=0.0, duration=1800.0, deadc=0.98, \
277 emin=0.1, emax=100.0, rad=5.0, \ 277 emin=0.1, emax=100.0, rad=5.0, \
278 irf='South_50h', caldb='prod2'): 278 irf='South_50h', caldb='prod2'):
279 """ 279 """
@@ -411,7 +411,7 @@ def set_obs_patterns(pattern, ra=83.6331, dec=22.0145, offset=1.5): @@ -411,7 +411,7 @@ def set_obs_patterns(pattern, ra=83.6331, dec=22.0145, offset=1.5):
411 # Set observation container filled with CTA observations # 411 # Set observation container filled with CTA observations #
412 # ====================================================== # 412 # ====================================================== #
413 def set_observations(ra, dec, rad, tstart, duration, emin, emax, irf, caldb, 413 def set_observations(ra, dec, rad, tstart, duration, emin, emax, irf, caldb,
414 - deadc=0.95, pattern='single', offset=1.5): 414 + deadc=0.98, pattern='single', offset=1.5):
415 """ 415 """
416 Set an observation container filled with CTA observations 416 Set an observation container filled with CTA observations
417 417
src/ctmodel/ctmodel.par
@@ -36,7 +36,7 @@ dec, r, a, 22.01,-90,90, &quot;Dec of pointing (degrees)&quot; @@ -36,7 +36,7 @@ dec, r, a, 22.01,-90,90, &quot;Dec of pointing (degrees)&quot;
36 rad, r, a, 5.0,0,180, "Radius of FOV (degrees)" 36 rad, r, a, 5.0,0,180, "Radius of FOV (degrees)"
37 tmin, r, a, 0.0,,, "Start time (MET in s)" 37 tmin, r, a, 0.0,,, "Start time (MET in s)"
38 tmax, r, a, 1800.0,,, "End time (MET in s)" 38 tmax, r, a, 1800.0,,, "End time (MET in s)"
39 -deadc, r, h, 0.95,0,1, "Average deadtime correction factor" 39 +deadc, r, h, 0.98,0,1, "Average deadtime correction factor"
40 40
41 # 41 #
42 # Energy binning parameters 42 # Energy binning parameters
src/ctobssim/ctobssim.par
@@ -36,7 +36,7 @@ tmin, r, a, 0.0,,, &quot;Start time (MET in s)&quot; @@ -36,7 +36,7 @@ tmin, r, a, 0.0,,, &quot;Start time (MET in s)&quot;
36 tmax, r, a, 1800.0,,, "End time (MET in s)" 36 tmax, r, a, 1800.0,,, "End time (MET in s)"
37 emin, r, a, 0.1,,, "Lower energy limit (TeV)" 37 emin, r, a, 0.1,,, "Lower energy limit (TeV)"
38 emax, r, a, 100.0,,, "Upper energy limit (TeV)" 38 emax, r, a, 100.0,,, "Upper energy limit (TeV)"
39 -deadc, r, h, 0.95,0,1, "Average deadtime correction factor" 39 +deadc, r, h, 0.98,0,1, "Average deadtime correction factor"
40 maxrate, r, h, 1.0e6,,, "Maximum photon rate" 40 maxrate, r, h, 1.0e6,,, "Maximum photon rate"
41 eslices, i, h, 10,1,100, "Number of energy slices" 41 eslices, i, h, 10,1,100, "Number of energy slices"
42 42
test/data/obs_stacked_two.xml
@@ -6,7 +6,7 @@ @@ -6,7 +6,7 @@
6 <parameter name="GoodTimeIntervals" tmin="0" tmax="1800" /> 6 <parameter name="GoodTimeIntervals" tmin="0" tmax="1800" />
7 <parameter name="TimeReference" mjdrefi="51544" mjdreff="0.5" timeunit="s" timesys="TT" timeref="LOCAL" /> 7 <parameter name="TimeReference" mjdrefi="51544" mjdreff="0.5" timeunit="s" timesys="TT" timeref="LOCAL" />
8 <parameter name="RegionOfInterest" ra="83.6331" dec="21.0145" rad="1.5" /> 8 <parameter name="RegionOfInterest" ra="83.6331" dec="21.0145" rad="1.5" />
9 - <parameter name="Deadtime" deadc="0.95" /> 9 + <parameter name="Deadtime" deadc="0.98" />
10 <parameter name="Calibration" database="prod2" response="South_0.5h" /> 10 <parameter name="Calibration" database="prod2" response="South_0.5h" />
11 </observation> 11 </observation>
12 <observation name="Crab" id="000002" instrument="CTA"> 12 <observation name="Crab" id="000002" instrument="CTA">
@@ -15,7 +15,7 @@ @@ -15,7 +15,7 @@
15 <parameter name="GoodTimeIntervals" tmin="1800" tmax="3600" /> 15 <parameter name="GoodTimeIntervals" tmin="1800" tmax="3600" />
16 <parameter name="TimeReference" mjdrefi="51544" mjdreff="0.5" timeunit="s" timesys="TT" timeref="LOCAL" /> 16 <parameter name="TimeReference" mjdrefi="51544" mjdreff="0.5" timeunit="s" timesys="TT" timeref="LOCAL" />
17 <parameter name="RegionOfInterest" ra="83.6331" dec="23.0145" rad="1.5" /> 17 <parameter name="RegionOfInterest" ra="83.6331" dec="23.0145" rad="1.5" />
18 - <parameter name="Deadtime" deadc="0.95" /> 18 + <parameter name="Deadtime" deadc="0.98" />
19 <parameter name="Calibration" database="prod2" response="South_0.5h" /> 19 <parameter name="Calibration" database="prod2" response="South_0.5h" />
20 </observation> 20 </observation>
21 </observation_list> 21 </observation_list>
test/data/pntdef_maximal.dat
1 name,id,lon,lat,duration,emin,emax,rad,deadc,caldb,irf 1 name,id,lon,lat,duration,emin,emax,rad,deadc,caldb,irf
2 -Crab,0001,184.58,-5.78,1800.0,0.1,100.0,5.0,0.95,Prod2,South_50h  
3 -Crab,0002,184.58,-4.78,1800.0,0.1,100.0,5.0,0.95,Prod2,South_50h  
4 -Crab,0003,184.58,-6.78,1800.0,0.1,100.0,5.0,0.95,Prod2,South_50h 2 +Crab,0001,184.58,-5.78,1800.0,0.1,100.0,5.0,0.98,Prod2,South_50h
  3 +Crab,0002,184.58,-4.78,1800.0,0.1,100.0,5.0,0.98,Prod2,South_50h
  4 +Crab,0003,184.58,-6.78,1800.0,0.1,100.0,5.0,0.98,Prod2,South_50h
test/data/sciver/obs_stacked.xml
@@ -6,7 +6,7 @@ @@ -6,7 +6,7 @@
6 <parameter name="GoodTimeIntervals" tmin="0" tmax="1800" /> 6 <parameter name="GoodTimeIntervals" tmin="0" tmax="1800" />
7 <parameter name="TimeReference" mjdrefi="51544" mjdreff="0.5" timeunit="s" timesys="TT" timeref="LOCAL" /> 7 <parameter name="TimeReference" mjdrefi="51544" mjdreff="0.5" timeunit="s" timesys="TT" timeref="LOCAL" />
8 <parameter name="RegionOfInterest" ra="83.6331" dec="21.0145" rad="1.5" /> 8 <parameter name="RegionOfInterest" ra="83.6331" dec="21.0145" rad="1.5" />
9 - <parameter name="Deadtime" deadc="0.95" /> 9 + <parameter name="Deadtime" deadc="0.98" />
10 <parameter name="Calibration" database="prod2" response="South_0.5h" /> 10 <parameter name="Calibration" database="prod2" response="South_0.5h" />
11 </observation> 11 </observation>
12 <observation name="Crab" id="000002" instrument="CTA"> 12 <observation name="Crab" id="000002" instrument="CTA">
@@ -15,7 +15,7 @@ @@ -15,7 +15,7 @@
15 <parameter name="GoodTimeIntervals" tmin="1800" tmax="3600" /> 15 <parameter name="GoodTimeIntervals" tmin="1800" tmax="3600" />
16 <parameter name="TimeReference" mjdrefi="51544" mjdreff="0.5" timeunit="s" timesys="TT" timeref="LOCAL" /> 16 <parameter name="TimeReference" mjdrefi="51544" mjdreff="0.5" timeunit="s" timesys="TT" timeref="LOCAL" />
17 <parameter name="RegionOfInterest" ra="83.6331" dec="23.0145" rad="1.5" /> 17 <parameter name="RegionOfInterest" ra="83.6331" dec="23.0145" rad="1.5" />
18 - <parameter name="Deadtime" deadc="0.95" /> 18 + <parameter name="Deadtime" deadc="0.98" />
19 <parameter name="Calibration" database="prod2" response="South_0.5h" /> 19 <parameter name="Calibration" database="prod2" response="South_0.5h" />
20 </observation> 20 </observation>
21 </observation_list> 21 </observation_list>
test/data/workflow.xml
@@ -6,7 +6,7 @@ @@ -6,7 +6,7 @@
6 <parameter name="caldb" value="prod2" /> 6 <parameter name="caldb" value="prod2" />
7 <parameter name="irf" value="South_0.5h" /> 7 <parameter name="irf" value="South_0.5h" />
8 <parameter name="edisp" value="no" /> 8 <parameter name="edisp" value="no" />
9 - <parameter name="deadc" value="0.95" /> 9 + <parameter name="deadc" value="0.98" />
10 <parameter name="ra" value="83.63" /> 10 <parameter name="ra" value="83.63" />
11 <parameter name="dec" value="22.01" /> 11 <parameter name="dec" value="22.01" />
12 <parameter name="target" value="Crab" /> 12 <parameter name="target" value="Crab" />
test/science_verification.py
@@ -11,7 +11,7 @@ @@ -11,7 +11,7 @@
11 # 11 #
12 # -------------------------------------------------------------------------- 12 # --------------------------------------------------------------------------
13 # 13 #
14 -# Copyright (C) 2015-2016 Juergen Knoedlseder 14 +# Copyright (C) 2015-2017 Juergen Knoedlseder
15 # 15 #
16 # This program is free software: you can redistribute it and/or modify 16 # This program is free software: you can redistribute it and/or modify
17 # it under the terms of the GNU General Public License as published by 17 # it under the terms of the GNU General Public License as published by
@@ -41,7 +41,7 @@ import cscripts @@ -41,7 +41,7 @@ import cscripts
41 # ========================== # 41 # ========================== #
42 def generate_pull_distribution(model, obs='NONE', trials=100, \ 42 def generate_pull_distribution(model, obs='NONE', trials=100, \
43 caldb='prod2', irf='South_50h', \ 43 caldb='prod2', irf='South_50h', \
44 - deadc=0.95, edisp=False, \ 44 + deadc=0.98, edisp=False, \
45 ra=83.63, dec=22.01, rad=5.0, \ 45 ra=83.63, dec=22.01, rad=5.0, \
46 emin=0.1, emax=100.0, enumbins=0, \ 46 emin=0.1, emax=100.0, enumbins=0, \
47 duration=1800.0, \ 47 duration=1800.0, \
test/test_csobsdef.py
@@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
2 # ========================================================================== 2 # ==========================================================================
3 # This scripts performs unit tests for the csobsdef script. 3 # This scripts performs unit tests for the csobsdef script.
4 # 4 #
5 -# Copyright (C) 2016 Juergen Knoedlseder 5 +# Copyright (C) 2016-2017 Juergen Knoedlseder
6 # 6 #
7 # This program is free software: you can redistribute it and/or modify 7 # This program is free software: you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by 8 # it under the terms of the GNU General Public License as published by
@@ -186,7 +186,7 @@ class Test(test): @@ -186,7 +186,7 @@ class Test(test):
186 'Check for "CTA" instrument') 186 'Check for "CTA" instrument')
187 self.test_value(o.ontime(), 1800.0, 1.0e-6, 187 self.test_value(o.ontime(), 1800.0, 1.0e-6,
188 'Check for ontime') 188 'Check for ontime')
189 - self.test_value(o.deadc(), 0.95, 1.0e-6, 189 + self.test_value(o.deadc(), 0.98, 1.0e-6,
190 'Check for deadtime correction') 190 'Check for deadtime correction')
191 self.test_value(o.events().ebounds().emin().TeV(), 0.1, 1.0e-6, 191 self.test_value(o.events().ebounds().emin().TeV(), 0.1, 1.0e-6,
192 'Check for minimum energy') 192 'Check for minimum energy')
test/test_cspull.py
@@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
2 # ========================================================================== 2 # ==========================================================================
3 # This scripts performs unit tests for the cspull script. 3 # This scripts performs unit tests for the cspull script.
4 # 4 #
5 -# Copyright (C) 2016 Juergen Knoedlseder 5 +# Copyright (C) 2016-2017 Juergen Knoedlseder
6 # 6 #
7 # This program is free software: you can redistribute it and/or modify 7 # This program is free software: you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by 8 # it under the terms of the GNU General Public License as published by
@@ -79,7 +79,7 @@ class Test(test): @@ -79,7 +79,7 @@ class Test(test):
79 ' ntrials=2'+ \ 79 ' ntrials=2'+ \
80 ' caldb="'+self._caldb+'" irf="'+self._irf+'"'+ \ 80 ' caldb="'+self._caldb+'" irf="'+self._irf+'"'+ \
81 ' ra=83.6331 dec=22.0145 emin=0.1 emax=100.0'+ \ 81 ' ra=83.6331 dec=22.0145 emin=0.1 emax=100.0'+ \
82 - ' enumbins=0 tmax=100.0 deadc=0.95 rad=5.0'+ \ 82 + ' enumbins=0 tmax=100.0 deadc=0.98 rad=5.0'+ \
83 ' npix=200 binsz=0.05'+ \ 83 ' npix=200 binsz=0.05'+ \
84 ' logfile="cspull_cmd1.log" chatter=1' 84 ' logfile="cspull_cmd1.log" chatter=1'
85 85
@@ -100,7 +100,7 @@ class Test(test): @@ -100,7 +100,7 @@ class Test(test):
100 ' ntrials=2'+ \ 100 ' ntrials=2'+ \
101 ' caldb="'+self._caldb+'" irf="'+self._irf+'"'+ \ 101 ' caldb="'+self._caldb+'" irf="'+self._irf+'"'+ \
102 ' ra=83.6331 dec=22.0145 emin=0.1 emax=100.0'+ \ 102 ' ra=83.6331 dec=22.0145 emin=0.1 emax=100.0'+ \
103 - ' enumbins=0 tmax=100.0 deadc=0.95 rad=5.0'+ \ 103 + ' enumbins=0 tmax=100.0 deadc=0.98 rad=5.0'+ \
104 ' npix=200 binsz=0.05'+ \ 104 ' npix=200 binsz=0.05'+ \
105 ' logfile="cspull_cmd2.log"' 105 ' logfile="cspull_cmd2.log"'
106 106
@@ -129,7 +129,7 @@ class Test(test): @@ -129,7 +129,7 @@ class Test(test):
129 pull['emax'] = 100.0 129 pull['emax'] = 100.0
130 pull['enumbins'] = 0 130 pull['enumbins'] = 0
131 pull['tmax'] = 100.0 131 pull['tmax'] = 100.0
132 - pull['deadc'] = 0.95 132 + pull['deadc'] = 0.98
133 pull['rad'] = 5.0 133 pull['rad'] = 5.0
134 pull['logfile'] = 'cspull_py1.log' 134 pull['logfile'] = 'cspull_py1.log'
135 pull['chatter'] = 2 135 pull['chatter'] = 2
@@ -155,7 +155,7 @@ class Test(test): @@ -155,7 +155,7 @@ class Test(test):
155 pull['emax'] = 100.0 155 pull['emax'] = 100.0
156 pull['enumbins'] = 10 156 pull['enumbins'] = 10
157 pull['tmax'] = 100.0 157 pull['tmax'] = 100.0
158 - pull['deadc'] = 0.95 158 + pull['deadc'] = 0.98
159 pull['rad'] = 5.0 159 pull['rad'] = 5.0
160 pull['npix'] = 20 160 pull['npix'] = 20
161 pull['binsz'] = 0.2 161 pull['binsz'] = 0.2
test/test_csworkflow.py
@@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
2 # ========================================================================== 2 # ==========================================================================
3 # This scripts performs unit tests for the csworkflow script. 3 # This scripts performs unit tests for the csworkflow script.
4 # 4 #
5 -# Copyright (C) 2016 Juergen Knoedlseder 5 +# Copyright (C) 2016-2017 Juergen Knoedlseder
6 # 6 #
7 # This program is free software: you can redistribute it and/or modify 7 # This program is free software: you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by 8 # it under the terms of the GNU General Public License as published by
@@ -143,13 +143,13 @@ class Test(test): @@ -143,13 +143,13 @@ class Test(test):
143 self.test_value(models['Crab'][2].value(), 143 self.test_value(models['Crab'][2].value(),
144 5.71055e-16, 1.0e-5, 'Crab prefactor') 144 5.71055e-16, 1.0e-5, 'Crab prefactor')
145 self.test_value(models['Crab'][3].value(), 145 self.test_value(models['Crab'][3].value(),
146 - -2.47559, 1.0e-5, 'Crab index') 146 + -2.463392, 1.0e-5, 'Crab index')
147 self.test_value(models['Background'][0].value(), 147 self.test_value(models['Background'][0].value(),
148 - 3.00491, 1.0e-5, 'Background model sigma') 148 + 3.008828, 1.0e-5, 'Background model sigma')
149 self.test_value(models['Background'][1].value(), 149 self.test_value(models['Background'][1].value(),
150 6.27131e-05, 1.0e-5, 'Background model prefactor') 150 6.27131e-05, 1.0e-5, 'Background model prefactor')
151 self.test_value(models['Background'][2].value(), 151 self.test_value(models['Background'][2].value(),
152 - -1.83164, 1.0e-5, 'Background model index') 152 + -1.833184, 1.0e-5, 'Background model index')
153 153
154 # Return 154 # Return
155 return 155 return
test/test_ctobssim.py
@@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
2 # ========================================================================== 2 # ==========================================================================
3 # This scripts performs unit tests for the ctobssim tool 3 # This scripts performs unit tests for the ctobssim tool
4 # 4 #
5 -# Copyright (C) 2014-2016 Juergen Knoedlseder 5 +# Copyright (C) 2014-2017 Juergen Knoedlseder
6 # 6 #
7 # This program is free software: you can redistribute it and/or modify 7 # This program is free software: you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by 8 # it under the terms of the GNU General Public License as published by
@@ -88,7 +88,7 @@ class Test(test): @@ -88,7 +88,7 @@ class Test(test):
88 88
89 # Load counts cube and check content. 89 # Load counts cube and check content.
90 evt = gammalib.GCTAEventList('ctobssim_cmd1.fits') 90 evt = gammalib.GCTAEventList('ctobssim_cmd1.fits')
91 - self._test_list(evt, 6881) 91 + self._test_list(evt, 7105)
92 92
93 # Setup ctobssim command 93 # Setup ctobssim command
94 cmd = ctobssim+' inmodel="model_that_does_not_exist.xml"'+ \ 94 cmd = ctobssim+' inmodel="model_that_does_not_exist.xml"'+ \
@@ -161,14 +161,14 @@ class Test(test): @@ -161,14 +161,14 @@ class Test(test):
161 161
162 # Check content of observation 162 # Check content of observation
163 self._test_observation(sim) 163 self._test_observation(sim)
164 - self._test_list(sim.obs()[0].events(), 6881) 164 + self._test_list(sim.obs()[0].events(), 7105)
165 165
166 # Save events 166 # Save events
167 sim.save() 167 sim.save()
168 168
169 # Load counts cube and check content. 169 # Load counts cube and check content.
170 evt = gammalib.GCTAEventList('ctobssim_py1.fits') 170 evt = gammalib.GCTAEventList('ctobssim_py1.fits')
171 - self._test_list(evt, 6881) 171 + self._test_list(evt, 7105)
172 172
173 # Set-up observation container 173 # Set-up observation container
174 pnts = [{'ra': 83.63, 'dec': 21.01}, 174 pnts = [{'ra': 83.63, 'dec': 21.01},
@@ -196,10 +196,10 @@ class Test(test): @@ -196,10 +196,10 @@ class Test(test):
196 196
197 # Retrieve observation and check content 197 # Retrieve observation and check content
198 self._test_observation(sim, nobs=4, pnts=pnts) 198 self._test_observation(sim, nobs=4, pnts=pnts)
199 - self._test_list(sim.obs()[0].events(), 6003)  
200 - self._test_list(sim.obs()[1].events(), 6084)  
201 - self._test_list(sim.obs()[2].events(), 5955)  
202 - self._test_list(sim.obs()[3].events(), 6030) 199 + self._test_list(sim.obs()[0].events(), 6199)
  200 + self._test_list(sim.obs()[1].events(), 6305)
  201 + self._test_list(sim.obs()[2].events(), 6092)
  202 + self._test_list(sim.obs()[3].events(), 6192)
203 203
204 # Save events 204 # Save events
205 sim.save() 205 sim.save()
@@ -208,20 +208,20 @@ class Test(test): @@ -208,20 +208,20 @@ class Test(test):
208 obs = gammalib.GObservations('ctobssim_py2.xml') 208 obs = gammalib.GObservations('ctobssim_py2.xml')
209 209
210 # Retrieve observation and check content 210 # Retrieve observation and check content
211 - self._test_list(obs[0].events(), 6003)  
212 - self._test_list(obs[1].events(), 6084)  
213 - self._test_list(obs[2].events(), 5955)  
214 - self._test_list(obs[3].events(), 6030) 211 + self._test_list(obs[0].events(), 6199)
  212 + self._test_list(obs[1].events(), 6305)
  213 + self._test_list(obs[2].events(), 6092)
  214 + self._test_list(obs[3].events(), 6192)
215 215
216 # Copy ctobssim tool 216 # Copy ctobssim tool
217 cpy_sim = sim.copy() 217 cpy_sim = sim.copy()
218 218
219 # Retrieve observation and check content of copy 219 # Retrieve observation and check content of copy
220 self._test_observation(cpy_sim, nobs=4, pnts=pnts) 220 self._test_observation(cpy_sim, nobs=4, pnts=pnts)
221 - self._test_list(cpy_sim.obs()[0].events(), 6003)  
222 - self._test_list(cpy_sim.obs()[1].events(), 6084)  
223 - self._test_list(cpy_sim.obs()[2].events(), 5955)  
224 - self._test_list(cpy_sim.obs()[3].events(), 6030) 221 + self._test_list(cpy_sim.obs()[0].events(), 6199)
  222 + self._test_list(cpy_sim.obs()[1].events(), 6305)
  223 + self._test_list(cpy_sim.obs()[2].events(), 6092)
  224 + self._test_list(cpy_sim.obs()[3].events(), 6192)
225 225
226 # Execute copy of ctobssim tool again, now with a higher chatter 226 # Execute copy of ctobssim tool again, now with a higher chatter
227 # level than before 227 # level than before
@@ -235,10 +235,10 @@ class Test(test): @@ -235,10 +235,10 @@ class Test(test):
235 # Check result file 235 # Check result file
236 obs = gammalib.GObservations('ctobssim_py3.xml') 236 obs = gammalib.GObservations('ctobssim_py3.xml')
237 self.test_value(obs.size(), 4, 'Check for number of observations') 237 self.test_value(obs.size(), 4, 'Check for number of observations')
238 - self._test_list(obs[0].events(), 6003)  
239 - self._test_list(obs[1].events(), 6084)  
240 - self._test_list(obs[2].events(), 5955)  
241 - self._test_list(obs[3].events(), 6030) 238 + self._test_list(obs[0].events(), 6199)
  239 + self._test_list(obs[1].events(), 6305)
  240 + self._test_list(obs[2].events(), 6092)
  241 + self._test_list(obs[3].events(), 6192)
242 242
243 # Return 243 # Return
244 return 244 return
@@ -268,8 +268,8 @@ class Test(test): @@ -268,8 +268,8 @@ class Test(test):
268 'Observation is CTA observation') 268 'Observation is CTA observation')
269 self.test_value(obs.ontime(), 1800.0, 1.0e-6, 269 self.test_value(obs.ontime(), 1800.0, 1.0e-6,
270 'Ontime is 1800 sec') 270 'Ontime is 1800 sec')
271 - self.test_value(obs.livetime(), 1710.0, 1.0e-6,  
272 - 'Livetime is 1710 sec') 271 + self.test_value(obs.livetime(), 1764.0, 1.0e-6,
  272 + 'Livetime is 1764 sec')
273 self.test_value(pnt.dir().ra_deg(), pnts[i]['ra'], 1.0e-6, 273 self.test_value(pnt.dir().ra_deg(), pnts[i]['ra'], 1.0e-6,
274 'Pointing Right Ascension is '+str(pnts[i]['ra'])+' deg') 274 'Pointing Right Ascension is '+str(pnts[i]['ra'])+' deg')
275 self.test_value(pnt.dir().dec_deg(), pnts[i]['dec'], 1.0e-6, 275 self.test_value(pnt.dir().dec_deg(), pnts[i]['dec'], 1.0e-6,