From 2f7db38bf50cb49aaf75c5bb1ca2b9f4bfa13ebb Mon Sep 17 00:00:00 2001 From: Jürgen Knödlseder Date: Wed, 1 Aug 2018 19:52:16 +0200 Subject: [PATCH] Use full true energy range for On/Off fitting in csspec (#2656) --- ChangeLog | 3 ++- NEWS | 6 +++++- cscripts/csspec.py | 29 +++++++++++------------------ doc/source/admin/release_history/1.6.rst | 2 ++ 4 files changed, 20 insertions(+), 20 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6f4e210..a5cb3b6 100755 --- a/ChangeLog +++ b/ChangeLog @@ -1,8 +1,9 @@ -2018-07-31 +2018-08-01 * Version 1.6.0 released ======================== + Use full RMF true energy range for On/Off analysis in csspec (#2656) Defer import of ROOT module in csroot2caldb to run method (#2652) Transparently update parameter files (#2513) Change formula for number of true energy bins in csphagen (#2490) diff --git a/NEWS b/NEWS index 004a5f8..e7bb570 100755 --- a/NEWS +++ b/NEWS @@ -1,6 +1,6 @@ New Features and Important Changes in ctools 1.6.0 -31 July 2018 +1 August 2018 Introduction @@ -302,6 +302,10 @@ Add hidden "nthreads" parameter and implement parallelisation of computations csspec - Generates Spectral Energy Distribution ----------------------------------------------- +The full true energy range of the RMF is now used in an On/Off analysis to +prevent cutting off the tails of the energy dispersion, which happened before +when the script was used for the analysis of H.E.S.S. data (#2656). + Add hidden "nthreads" parameter and implement parallelisation of computations (#2421). diff --git a/cscripts/csspec.py b/cscripts/csspec.py index cd6a8b1..de3c716 100755 --- a/cscripts/csspec.py +++ b/cscripts/csspec.py @@ -468,25 +468,18 @@ class csspec(ctools.csobservation): obs : `~gammalib.GCTAOnOffObservation` CTA On/Off observation """ - # Select energy bins in etrue and ereco. 20% margin is added for - # true energies to take into account the energy dispersion. 0.1% - # margin is added for reconstructed energies to accomodate for - # rounding errors. - etrue = gammalib.GEbounds() - ereco = gammalib.GEbounds() - itrue = [] - ireco = [] - for i in range(obs.rmf().etrue().size()): - etrue_min = obs.rmf().etrue().emin(i) - etrue_max = obs.rmf().etrue().emax(i) - if etrue_min * 1.2 >= emin and etrue_max * 0.8 <= emax: - etrue.append(etrue_min, etrue_max) - itrue.append(i) + # Select energy bins in etrue and ereco. All etrue energy bins are + # selected. A 0.1% margin is added for reconstructed energies to + # accomodate for rounding errors. + etrue = obs.rmf().etrue() + ereco = gammalib.GEbounds() + itrue = [i for i in range(obs.rmf().etrue().size())] + ireco = [] for i in range(obs.rmf().emeasured().size()): - ereco_min = obs.rmf().emeasured().emin(i) - ereco_max = obs.rmf().emeasured().emax(i) - if ereco_min * 1.001 >= emin and ereco_max * 0.999 <= emax: - ereco.append(ereco_min, ereco_max) + ereco_bin_min = obs.rmf().emeasured().emin(i) + ereco_bin_max = obs.rmf().emeasured().emax(i) + if ereco_bin_min * 1.001 >= emin and ereco_bin_max * 0.999 <= emax: + ereco.append(ereco_bin_min, ereco_bin_max) ireco.append(i) # Extract PHA diff --git a/doc/source/admin/release_history/1.6.rst b/doc/source/admin/release_history/1.6.rst index c5731ff..0ba291f 100644 --- a/doc/source/admin/release_history/1.6.rst +++ b/doc/source/admin/release_history/1.6.rst @@ -32,6 +32,8 @@ Bug fixes Improvements ------------ +* [`2656 `_] - + Use full ``RMF`` true energy range for On/Off analysis in :ref:`csspec` * [`2513 `_] - Transparently update parameter files * [`2490 `_] - -- libgit2 0.21.4