From c1981f9ae56fb584309478d44d2c6552f6a380c9 Mon Sep 17 00:00:00 2001 From: Jürgen Knödlseder Date: Fri, 16 Nov 2018 15:34:01 +0100 Subject: [PATCH] CTA background rates are now per ontime (#2758) --- ChangeLog | 3 ++- NEWS | 6 +++++- doc/source/admin/release_history/1.6.rst | 2 ++ test/test_cslightcrv.py | 49 +++++++++++++++++++++++++------------------------ test/test_csworkflow.py | 8 ++++---- test/test_cterror.py | 4 ++-- test/test_ctlike.py | 4 ++-- test/test_ctobssim.py | 18 +++++++++--------- test/test_obsutils.py | 10 +++++----- 9 files changed, 56 insertions(+), 48 deletions(-) diff --git a/ChangeLog b/ChangeLog index a99b94a..7d45c53 100755 --- a/ChangeLog +++ b/ChangeLog @@ -1,8 +1,9 @@ -2018-11-07 +2018-11-16 * Version 1.6.0 released ======================== + CTA background rates are now per ontime (#2758) Apply event bin weighting in ctmodel for stacked computation (#2721) Enable ctbin to produce counts cubes for a joint binned analysis (#2714) Add Jupyter notebooks for H.E.S.S. DR1 (#2712) diff --git a/NEWS b/NEWS index 86388de..0f18261 100755 --- a/NEWS +++ b/NEWS @@ -1,6 +1,6 @@ New Features and Important Changes in ctools 1.6.0 -7 November 2018 +16 November 2018 Introduction @@ -11,6 +11,10 @@ ctools release with respect to the precedent release. Configuration ------------- +CTA background rates are now per ontime and not livetime. This makes the IRF +background consistent with the cube background, and is also consistent with +the open gamma data format (#2758). + A Code Generator was added to the development directory that can be started using dev/codegen.py and that requires GammaLib to be installed. The code generator allows adding ctools and cscripts, including unit tests and code diff --git a/doc/source/admin/release_history/1.6.rst b/doc/source/admin/release_history/1.6.rst index 80ef31a..f9254e0 100644 --- a/doc/source/admin/release_history/1.6.rst +++ b/doc/source/admin/release_history/1.6.rst @@ -112,6 +112,8 @@ New features Clean up -------- +* [`2758 `_] - + CTA background rates are now per ontime * Remove ``ctools::is_valid_filename()`` method * [`2045 `_] - Remove ``ctools::time_reference`` constant diff --git a/test/test_cslightcrv.py b/test/test_cslightcrv.py index 5ecfa37..65db11f 100755 --- a/test/test_cslightcrv.py +++ b/test/test_cslightcrv.py @@ -241,30 +241,31 @@ class Test(test): # cslightcrv with classical analysis lcrv = cscripts.cslightcrv() - lcrv['inobs'] = self._offaxis_events - lcrv['inmodel'] = self._model_onoff - lcrv['srcname'] = 'Crab' - lcrv['caldb'] = self._caldb - lcrv['irf'] = self._irf - lcrv['tbinalg'] = 'LIN' - lcrv['tmin'] = '2020-01-01T00:00:00' - lcrv['tmax'] = '2020-01-01T00:05:00' - lcrv['tbins'] = 2 - lcrv['method'] = 'ONOFF' - lcrv['emin'] = 1.0 - lcrv['emax'] = 100.0 - lcrv['enumbins'] = 2 - lcrv['coordsys'] = 'CEL' - lcrv['xref'] = 83.63 - lcrv['yref'] = 22.01 - lcrv['rad'] = 0.2 - lcrv['etruemin'] = 1.0 - lcrv['etruemax'] = 100.0 - lcrv['etruebins'] = 5 - lcrv['statistic'] = 'WSTAT' - lcrv['outfile'] = 'cslightcrv_py5.fits' - lcrv['logfile'] = 'cslightcrv_py5.log' - lcrv['chatter'] = 4 + lcrv['inobs'] = self._offaxis_events + lcrv['inmodel'] = self._model_onoff + lcrv['srcname'] = 'Crab' + lcrv['caldb'] = self._caldb + lcrv['irf'] = self._irf + lcrv['tbinalg'] = 'LIN' + lcrv['tmin'] = '2020-01-01T00:00:00' + lcrv['tmax'] = '2020-01-01T00:05:00' + lcrv['tbins'] = 2 + lcrv['method'] = 'ONOFF' + lcrv['use_irf_bkg'] = False # Needed even if WSTAT + lcrv['emin'] = 1.0 + lcrv['emax'] = 100.0 + lcrv['enumbins'] = 2 + lcrv['coordsys'] = 'CEL' + lcrv['xref'] = 83.63 + lcrv['yref'] = 22.01 + lcrv['rad'] = 0.2 + lcrv['etruemin'] = 1.0 + lcrv['etruemax'] = 100.0 + lcrv['etruebins'] = 5 + lcrv['statistic'] = 'WSTAT' + lcrv['outfile'] = 'cslightcrv_py5.fits' + lcrv['logfile'] = 'cslightcrv_py5.log' + lcrv['chatter'] = 4 # Execute cslightcrv script lcrv.execute() diff --git a/test/test_csworkflow.py b/test/test_csworkflow.py index 0a7b32b..1e63866 100755 --- a/test/test_csworkflow.py +++ b/test/test_csworkflow.py @@ -139,10 +139,10 @@ class Test(test): models = gammalib.GModels(filename) # Set reference values - prefactor = 3.6507089091164e-16 - index = 2.39314305030239 - pre_background = 1.0405193333791 - index_background = 0.0100808528325967 + prefactor = 3.62775976898809e-16 + index = 2.39100016863397 + pre_background = 1.05367124323594 + index_background = 0.0421705243014668 # Check fit result values self.test_value(models['Crab'][2].value(), diff --git a/test/test_cterror.py b/test/test_cterror.py index 155f3c9..94aee00 100755 --- a/test/test_cterror.py +++ b/test/test_cterror.py @@ -264,8 +264,8 @@ class Test(test): prefactor_error = 1.12920470341148e-16 index = 2.39356360626209 index_error = 0.128468611886618 - pre_background = 1.01409721534593 - pre_background_error = 0.122650321517162 + pre_background = 0.993814959041969 + pre_background_error = 0.120197277367473 index_background = 0.0436264224948547 index_background_error = 0.110703165254809 diff --git a/test/test_ctlike.py b/test/test_ctlike.py index 560c82a..dd1b09d 100755 --- a/test/test_ctlike.py +++ b/test/test_ctlike.py @@ -252,8 +252,8 @@ class Test(test): prefactor_error = 1.07582291031224e-16 index = 2.39356360626209 index_error = 0.126492171703747 - pre_background = 1.01409721534593 - pre_background_error = 0.122650321517162 + pre_background = 0.993814959041969 + pre_background_error = 0.120197277367473 index_background = 0.0436264224948547 index_background_error = 0.110703165254809 diff --git a/test/test_ctobssim.py b/test/test_ctobssim.py index 13ce054..5aab421 100755 --- a/test/test_ctobssim.py +++ b/test/test_ctobssim.py @@ -86,7 +86,7 @@ class Test(test): # Load counts cube and check content. evt = gammalib.GCTAEventList('ctobssim_cmd1.fits') - self._test_list(evt, 250) + self._test_list(evt, 251) # Setup ctobssim command cmd = ctobssim+' inmodel="model_that_does_not_exist.xml"'+ \ @@ -152,21 +152,21 @@ class Test(test): # Check content of observation self._test_observation(sim) - self._test_list(sim.obs()[0].events(), 250) + self._test_list(sim.obs()[0].events(), 251) # Save events sim.save() # Load counts cube and check content. evt = gammalib.GCTAEventList('ctobssim_py1.fits') - self._test_list(evt, 250) + self._test_list(evt, 251) # Copy ctobssim tool cpy_sim = sim.copy() # Retrieve observation and check content of copy self._test_observation(cpy_sim) - self._test_list(cpy_sim.obs()[0].events(), 250) + self._test_list(cpy_sim.obs()[0].events(), 251) # Execute copy of ctobssim tool again, now with a higher chatter # level than before @@ -179,7 +179,7 @@ class Test(test): # Load counts cube and check content. evt = gammalib.GCTAEventList('ctobssim_py2.fits') - self._test_list(evt, 250) + self._test_list(evt, 251) # Set-up observation container pnts = [{'ra': 83.63, 'dec': 21.01}, @@ -206,8 +206,8 @@ class Test(test): # Retrieve observation and check content self._test_observation(sim, nobs=2, pnts=pnts) - self._test_list(sim.obs()[0].events(), 3565) - self._test_list(sim.obs()[1].events(), 3523) + self._test_list(sim.obs()[0].events(), 3626) + self._test_list(sim.obs()[1].events(), 3601) # Save events sim.save() @@ -216,8 +216,8 @@ class Test(test): obs = gammalib.GObservations('ctobssim_py3.xml') # Retrieve observation and check content - self._test_list(obs[0].events(), 3565) - self._test_list(obs[1].events(), 3523) + self._test_list(obs[0].events(), 3626) + self._test_list(obs[1].events(), 3601) # Return return diff --git a/test/test_obsutils.py b/test/test_obsutils.py index b419253..f1b2e81 100755 --- a/test/test_obsutils.py +++ b/test/test_obsutils.py @@ -217,7 +217,7 @@ class Test(test): # Check simulation results self.test_value(res.size(), 1, 'Check number of observations') self.test_value(res.models().size(), 2, 'Check number of models') - self.test_value(res.nobserved(), 19, 'Check number of observed events') + self.test_value(res.nobserved(), 20, 'Check number of observed events') self.test_value(res.npred(), 0.0, 'Check number of predicted events') self.test_value(res[0].eventtype(), 'CountsCube', 'Check event type') self.test_value(res[0].events().ebounds().emin().TeV(), 1.0, @@ -226,7 +226,7 @@ class Test(test): 'Check maximum energy') self.test_value(res[0].events().ebounds().size(), 5, 'Check number of energy bins') - self.test_value(res[0].events().number(), 19, + self.test_value(res[0].events().number(), 20, 'Check number of events in cube') # Check energy dispersion flag @@ -261,7 +261,7 @@ class Test(test): # Check simulation results self.test_value(res.size(), 2, 'Check number of observations') self.test_value(res.models().size(), 2, 'Check number of models') - self.test_value(res.nobserved(), 46, 'Check number of observed events') + self.test_value(res.nobserved(), 48, 'Check number of observed events') self.test_value(res.npred(), 0.0, 'Check number of predicted events') # Check results of first observation @@ -271,7 +271,7 @@ class Test(test): 'Check maximum energy of On spectrum') self.test_value(res[0].on_spec().ebounds().size(), 5, 'Check number of energy bins of On spectrum') - self.test_value(res[0].on_spec().counts(), 24, + self.test_value(res[0].on_spec().counts(), 26, 'Check number of events in of On spectrum') self.test_value(res[0].off_spec().ebounds().emin().TeV(), 1.0, 'Check minimum energy of Off spectrum') @@ -315,7 +315,7 @@ class Test(test): 'Check maximum energy of Off spectrum') self.test_value(res[1].off_spec().ebounds().size(), 5, 'Check number of energy bins of Off spectrum') - self.test_value(res[1].off_spec().counts(), 0, + self.test_value(res[1].off_spec().counts(), 1, 'Check number of events in of Off spectrum') self.test_value(res[1].arf().ebounds().emin().TeV(), 0.5, 'Check minimum energy of ARF') -- libgit2 0.21.4