Commit c1981f9ae56fb584309478d44d2c6552f6a380c9

Authored by Jürgen Knödlseder
1 parent 15895c1e

CTA background rates are now per ontime (#2758)

ChangeLog
1 -2018-11-07 1 +2018-11-16
2 2
3 * Version 1.6.0 released 3 * Version 1.6.0 released
4 ======================== 4 ========================
5 5
  6 + CTA background rates are now per ontime (#2758)
6 Apply event bin weighting in ctmodel for stacked computation (#2721) 7 Apply event bin weighting in ctmodel for stacked computation (#2721)
7 Enable ctbin to produce counts cubes for a joint binned analysis (#2714) 8 Enable ctbin to produce counts cubes for a joint binned analysis (#2714)
8 Add Jupyter notebooks for H.E.S.S. DR1 (#2712) 9 Add Jupyter notebooks for H.E.S.S. DR1 (#2712)
1 New Features and Important Changes in ctools 1.6.0 1 New Features and Important Changes in ctools 1.6.0
2 2
3 -7 November 2018 3 +16 November 2018
4 4
5 5
6 Introduction 6 Introduction
@@ -11,6 +11,10 @@ ctools release with respect to the precedent release. @@ -11,6 +11,10 @@ ctools release with respect to the precedent release.
11 11
12 Configuration 12 Configuration
13 ------------- 13 -------------
  14 +CTA background rates are now per ontime and not livetime. This makes the IRF
  15 +background consistent with the cube background, and is also consistent with
  16 +the open gamma data format (#2758).
  17 +
14 A Code Generator was added to the development directory that can be started 18 A Code Generator was added to the development directory that can be started
15 using dev/codegen.py and that requires GammaLib to be installed. The code 19 using dev/codegen.py and that requires GammaLib to be installed. The code
16 generator allows adding ctools and cscripts, including unit tests and code 20 generator allows adding ctools and cscripts, including unit tests and code
doc/source/admin/release_history/1.6.rst
@@ -112,6 +112,8 @@ New features @@ -112,6 +112,8 @@ New features
112 Clean up 112 Clean up
113 -------- 113 --------
114 114
  115 +* [`2758 <https://cta-redmine.irap.omp.eu/issues/2758>`_] -
  116 + CTA background rates are now per ontime
115 * Remove ``ctools::is_valid_filename()`` method 117 * Remove ``ctools::is_valid_filename()`` method
116 * [`2045 <https://cta-redmine.irap.omp.eu/issues/2045>`_] - 118 * [`2045 <https://cta-redmine.irap.omp.eu/issues/2045>`_] -
117 Remove ``ctools::time_reference`` constant 119 Remove ``ctools::time_reference`` constant
test/test_cslightcrv.py
@@ -241,30 +241,31 @@ class Test(test): @@ -241,30 +241,31 @@ class Test(test):
241 241
242 # cslightcrv with classical analysis 242 # cslightcrv with classical analysis
243 lcrv = cscripts.cslightcrv() 243 lcrv = cscripts.cslightcrv()
244 - lcrv['inobs'] = self._offaxis_events  
245 - lcrv['inmodel'] = self._model_onoff  
246 - lcrv['srcname'] = 'Crab'  
247 - lcrv['caldb'] = self._caldb  
248 - lcrv['irf'] = self._irf  
249 - lcrv['tbinalg'] = 'LIN'  
250 - lcrv['tmin'] = '2020-01-01T00:00:00'  
251 - lcrv['tmax'] = '2020-01-01T00:05:00'  
252 - lcrv['tbins'] = 2  
253 - lcrv['method'] = 'ONOFF'  
254 - lcrv['emin'] = 1.0  
255 - lcrv['emax'] = 100.0  
256 - lcrv['enumbins'] = 2  
257 - lcrv['coordsys'] = 'CEL'  
258 - lcrv['xref'] = 83.63  
259 - lcrv['yref'] = 22.01  
260 - lcrv['rad'] = 0.2  
261 - lcrv['etruemin'] = 1.0  
262 - lcrv['etruemax'] = 100.0  
263 - lcrv['etruebins'] = 5  
264 - lcrv['statistic'] = 'WSTAT'  
265 - lcrv['outfile'] = 'cslightcrv_py5.fits'  
266 - lcrv['logfile'] = 'cslightcrv_py5.log'  
267 - lcrv['chatter'] = 4 244 + lcrv['inobs'] = self._offaxis_events
  245 + lcrv['inmodel'] = self._model_onoff
  246 + lcrv['srcname'] = 'Crab'
  247 + lcrv['caldb'] = self._caldb
  248 + lcrv['irf'] = self._irf
  249 + lcrv['tbinalg'] = 'LIN'
  250 + lcrv['tmin'] = '2020-01-01T00:00:00'
  251 + lcrv['tmax'] = '2020-01-01T00:05:00'
  252 + lcrv['tbins'] = 2
  253 + lcrv['method'] = 'ONOFF'
  254 + lcrv['use_irf_bkg'] = False # Needed even if WSTAT
  255 + lcrv['emin'] = 1.0
  256 + lcrv['emax'] = 100.0
  257 + lcrv['enumbins'] = 2
  258 + lcrv['coordsys'] = 'CEL'
  259 + lcrv['xref'] = 83.63
  260 + lcrv['yref'] = 22.01
  261 + lcrv['rad'] = 0.2
  262 + lcrv['etruemin'] = 1.0
  263 + lcrv['etruemax'] = 100.0
  264 + lcrv['etruebins'] = 5
  265 + lcrv['statistic'] = 'WSTAT'
  266 + lcrv['outfile'] = 'cslightcrv_py5.fits'
  267 + lcrv['logfile'] = 'cslightcrv_py5.log'
  268 + lcrv['chatter'] = 4
268 269
269 # Execute cslightcrv script 270 # Execute cslightcrv script
270 lcrv.execute() 271 lcrv.execute()
test/test_csworkflow.py
@@ -139,10 +139,10 @@ class Test(test): @@ -139,10 +139,10 @@ class Test(test):
139 models = gammalib.GModels(filename) 139 models = gammalib.GModels(filename)
140 140
141 # Set reference values 141 # Set reference values
142 - prefactor = 3.6507089091164e-16  
143 - index = 2.39314305030239  
144 - pre_background = 1.0405193333791  
145 - index_background = 0.0100808528325967 142 + prefactor = 3.62775976898809e-16
  143 + index = 2.39100016863397
  144 + pre_background = 1.05367124323594
  145 + index_background = 0.0421705243014668
146 146
147 # Check fit result values 147 # Check fit result values
148 self.test_value(models['Crab'][2].value(), 148 self.test_value(models['Crab'][2].value(),
test/test_cterror.py
@@ -264,8 +264,8 @@ class Test(test): @@ -264,8 +264,8 @@ class Test(test):
264 prefactor_error = 1.12920470341148e-16 264 prefactor_error = 1.12920470341148e-16
265 index = 2.39356360626209 265 index = 2.39356360626209
266 index_error = 0.128468611886618 266 index_error = 0.128468611886618
267 - pre_background = 1.01409721534593  
268 - pre_background_error = 0.122650321517162 267 + pre_background = 0.993814959041969
  268 + pre_background_error = 0.120197277367473
269 index_background = 0.0436264224948547 269 index_background = 0.0436264224948547
270 index_background_error = 0.110703165254809 270 index_background_error = 0.110703165254809
271 271
test/test_ctlike.py
@@ -252,8 +252,8 @@ class Test(test): @@ -252,8 +252,8 @@ class Test(test):
252 prefactor_error = 1.07582291031224e-16 252 prefactor_error = 1.07582291031224e-16
253 index = 2.39356360626209 253 index = 2.39356360626209
254 index_error = 0.126492171703747 254 index_error = 0.126492171703747
255 - pre_background = 1.01409721534593  
256 - pre_background_error = 0.122650321517162 255 + pre_background = 0.993814959041969
  256 + pre_background_error = 0.120197277367473
257 index_background = 0.0436264224948547 257 index_background = 0.0436264224948547
258 index_background_error = 0.110703165254809 258 index_background_error = 0.110703165254809
259 259
test/test_ctobssim.py
@@ -86,7 +86,7 @@ class Test(test): @@ -86,7 +86,7 @@ class Test(test):
86 86
87 # Load counts cube and check content. 87 # Load counts cube and check content.
88 evt = gammalib.GCTAEventList('ctobssim_cmd1.fits') 88 evt = gammalib.GCTAEventList('ctobssim_cmd1.fits')
89 - self._test_list(evt, 250) 89 + self._test_list(evt, 251)
90 90
91 # Setup ctobssim command 91 # Setup ctobssim command
92 cmd = ctobssim+' inmodel="model_that_does_not_exist.xml"'+ \ 92 cmd = ctobssim+' inmodel="model_that_does_not_exist.xml"'+ \
@@ -152,21 +152,21 @@ class Test(test): @@ -152,21 +152,21 @@ class Test(test):
152 152
153 # Check content of observation 153 # Check content of observation
154 self._test_observation(sim) 154 self._test_observation(sim)
155 - self._test_list(sim.obs()[0].events(), 250) 155 + self._test_list(sim.obs()[0].events(), 251)
156 156
157 # Save events 157 # Save events
158 sim.save() 158 sim.save()
159 159
160 # Load counts cube and check content. 160 # Load counts cube and check content.
161 evt = gammalib.GCTAEventList('ctobssim_py1.fits') 161 evt = gammalib.GCTAEventList('ctobssim_py1.fits')
162 - self._test_list(evt, 250) 162 + self._test_list(evt, 251)
163 163
164 # Copy ctobssim tool 164 # Copy ctobssim tool
165 cpy_sim = sim.copy() 165 cpy_sim = sim.copy()
166 166
167 # Retrieve observation and check content of copy 167 # Retrieve observation and check content of copy
168 self._test_observation(cpy_sim) 168 self._test_observation(cpy_sim)
169 - self._test_list(cpy_sim.obs()[0].events(), 250) 169 + self._test_list(cpy_sim.obs()[0].events(), 251)
170 170
171 # Execute copy of ctobssim tool again, now with a higher chatter 171 # Execute copy of ctobssim tool again, now with a higher chatter
172 # level than before 172 # level than before
@@ -179,7 +179,7 @@ class Test(test): @@ -179,7 +179,7 @@ class Test(test):
179 179
180 # Load counts cube and check content. 180 # Load counts cube and check content.
181 evt = gammalib.GCTAEventList('ctobssim_py2.fits') 181 evt = gammalib.GCTAEventList('ctobssim_py2.fits')
182 - self._test_list(evt, 250) 182 + self._test_list(evt, 251)
183 183
184 # Set-up observation container 184 # Set-up observation container
185 pnts = [{'ra': 83.63, 'dec': 21.01}, 185 pnts = [{'ra': 83.63, 'dec': 21.01},
@@ -206,8 +206,8 @@ class Test(test): @@ -206,8 +206,8 @@ class Test(test):
206 206
207 # Retrieve observation and check content 207 # Retrieve observation and check content
208 self._test_observation(sim, nobs=2, pnts=pnts) 208 self._test_observation(sim, nobs=2, pnts=pnts)
209 - self._test_list(sim.obs()[0].events(), 3565)  
210 - self._test_list(sim.obs()[1].events(), 3523) 209 + self._test_list(sim.obs()[0].events(), 3626)
  210 + self._test_list(sim.obs()[1].events(), 3601)
211 211
212 # Save events 212 # Save events
213 sim.save() 213 sim.save()
@@ -216,8 +216,8 @@ class Test(test): @@ -216,8 +216,8 @@ class Test(test):
216 obs = gammalib.GObservations('ctobssim_py3.xml') 216 obs = gammalib.GObservations('ctobssim_py3.xml')
217 217
218 # Retrieve observation and check content 218 # Retrieve observation and check content
219 - self._test_list(obs[0].events(), 3565)  
220 - self._test_list(obs[1].events(), 3523) 219 + self._test_list(obs[0].events(), 3626)
  220 + self._test_list(obs[1].events(), 3601)
221 221
222 # Return 222 # Return
223 return 223 return
test/test_obsutils.py
@@ -217,7 +217,7 @@ class Test(test): @@ -217,7 +217,7 @@ class Test(test):
217 # Check simulation results 217 # Check simulation results
218 self.test_value(res.size(), 1, 'Check number of observations') 218 self.test_value(res.size(), 1, 'Check number of observations')
219 self.test_value(res.models().size(), 2, 'Check number of models') 219 self.test_value(res.models().size(), 2, 'Check number of models')
220 - self.test_value(res.nobserved(), 19, 'Check number of observed events') 220 + self.test_value(res.nobserved(), 20, 'Check number of observed events')
221 self.test_value(res.npred(), 0.0, 'Check number of predicted events') 221 self.test_value(res.npred(), 0.0, 'Check number of predicted events')
222 self.test_value(res[0].eventtype(), 'CountsCube', 'Check event type') 222 self.test_value(res[0].eventtype(), 'CountsCube', 'Check event type')
223 self.test_value(res[0].events().ebounds().emin().TeV(), 1.0, 223 self.test_value(res[0].events().ebounds().emin().TeV(), 1.0,
@@ -226,7 +226,7 @@ class Test(test): @@ -226,7 +226,7 @@ class Test(test):
226 'Check maximum energy') 226 'Check maximum energy')
227 self.test_value(res[0].events().ebounds().size(), 5, 227 self.test_value(res[0].events().ebounds().size(), 5,
228 'Check number of energy bins') 228 'Check number of energy bins')
229 - self.test_value(res[0].events().number(), 19, 229 + self.test_value(res[0].events().number(), 20,
230 'Check number of events in cube') 230 'Check number of events in cube')
231 231
232 # Check energy dispersion flag 232 # Check energy dispersion flag
@@ -261,7 +261,7 @@ class Test(test): @@ -261,7 +261,7 @@ class Test(test):
261 # Check simulation results 261 # Check simulation results
262 self.test_value(res.size(), 2, 'Check number of observations') 262 self.test_value(res.size(), 2, 'Check number of observations')
263 self.test_value(res.models().size(), 2, 'Check number of models') 263 self.test_value(res.models().size(), 2, 'Check number of models')
264 - self.test_value(res.nobserved(), 46, 'Check number of observed events') 264 + self.test_value(res.nobserved(), 48, 'Check number of observed events')
265 self.test_value(res.npred(), 0.0, 'Check number of predicted events') 265 self.test_value(res.npred(), 0.0, 'Check number of predicted events')
266 266
267 # Check results of first observation 267 # Check results of first observation
@@ -271,7 +271,7 @@ class Test(test): @@ -271,7 +271,7 @@ class Test(test):
271 'Check maximum energy of On spectrum') 271 'Check maximum energy of On spectrum')
272 self.test_value(res[0].on_spec().ebounds().size(), 5, 272 self.test_value(res[0].on_spec().ebounds().size(), 5,
273 'Check number of energy bins of On spectrum') 273 'Check number of energy bins of On spectrum')
274 - self.test_value(res[0].on_spec().counts(), 24, 274 + self.test_value(res[0].on_spec().counts(), 26,
275 'Check number of events in of On spectrum') 275 'Check number of events in of On spectrum')
276 self.test_value(res[0].off_spec().ebounds().emin().TeV(), 1.0, 276 self.test_value(res[0].off_spec().ebounds().emin().TeV(), 1.0,
277 'Check minimum energy of Off spectrum') 277 'Check minimum energy of Off spectrum')
@@ -315,7 +315,7 @@ class Test(test): @@ -315,7 +315,7 @@ class Test(test):
315 'Check maximum energy of Off spectrum') 315 'Check maximum energy of Off spectrum')
316 self.test_value(res[1].off_spec().ebounds().size(), 5, 316 self.test_value(res[1].off_spec().ebounds().size(), 5,
317 'Check number of energy bins of Off spectrum') 317 'Check number of energy bins of Off spectrum')
318 - self.test_value(res[1].off_spec().counts(), 0, 318 + self.test_value(res[1].off_spec().counts(), 1,
319 'Check number of events in of Off spectrum') 319 'Check number of events in of Off spectrum')
320 self.test_value(res[1].arf().ebounds().emin().TeV(), 0.5, 320 self.test_value(res[1].arf().ebounds().emin().TeV(), 0.5,
321 'Check minimum energy of ARF') 321 'Check minimum energy of ARF')