Commit 2f7db38bf50cb49aaf75c5bb1ca2b9f4bfa13ebb

Authored by Jürgen Knödlseder
1 parent a0b400dc

Use full true energy range for On/Off fitting in csspec (#2656)

ChangeLog
1 -2018-07-31 1 +2018-08-01
2 2
3 * Version 1.6.0 released 3 * Version 1.6.0 released
4 ======================== 4 ========================
5 5
  6 + Use full RMF true energy range for On/Off analysis in csspec (#2656)
6 Defer import of ROOT module in csroot2caldb to run method (#2652) 7 Defer import of ROOT module in csroot2caldb to run method (#2652)
7 Transparently update parameter files (#2513) 8 Transparently update parameter files (#2513)
8 Change formula for number of true energy bins in csphagen (#2490) 9 Change formula for number of true energy bins in csphagen (#2490)
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 -31 July 2018 3 +1 August 2018
4 4
5 5
6 Introduction 6 Introduction
@@ -302,6 +302,10 @@ Add hidden "nthreads" parameter and implement parallelisation of computations @@ -302,6 +302,10 @@ Add hidden "nthreads" parameter and implement parallelisation of computations
302 302
303 csspec - Generates Spectral Energy Distribution 303 csspec - Generates Spectral Energy Distribution
304 ----------------------------------------------- 304 -----------------------------------------------
  305 +The full true energy range of the RMF is now used in an On/Off analysis to
  306 +prevent cutting off the tails of the energy dispersion, which happened before
  307 +when the script was used for the analysis of H.E.S.S. data (#2656).
  308 +
305 Add hidden "nthreads" parameter and implement parallelisation of computations 309 Add hidden "nthreads" parameter and implement parallelisation of computations
306 (#2421). 310 (#2421).
307 311
cscripts/csspec.py
@@ -468,25 +468,18 @@ class csspec(ctools.csobservation): @@ -468,25 +468,18 @@ class csspec(ctools.csobservation):
468 obs : `~gammalib.GCTAOnOffObservation` 468 obs : `~gammalib.GCTAOnOffObservation`
469 CTA On/Off observation 469 CTA On/Off observation
470 """ 470 """
471 - # Select energy bins in etrue and ereco. 20% margin is added for  
472 - # true energies to take into account the energy dispersion. 0.1%  
473 - # margin is added for reconstructed energies to accomodate for  
474 - # rounding errors.  
475 - etrue = gammalib.GEbounds()  
476 - ereco = gammalib.GEbounds()  
477 - itrue = []  
478 - ireco = []  
479 - for i in range(obs.rmf().etrue().size()):  
480 - etrue_min = obs.rmf().etrue().emin(i)  
481 - etrue_max = obs.rmf().etrue().emax(i)  
482 - if etrue_min * 1.2 >= emin and etrue_max * 0.8 <= emax:  
483 - etrue.append(etrue_min, etrue_max)  
484 - itrue.append(i) 471 + # Select energy bins in etrue and ereco. All etrue energy bins are
  472 + # selected. A 0.1% margin is added for reconstructed energies to
  473 + # accomodate for rounding errors.
  474 + etrue = obs.rmf().etrue()
  475 + ereco = gammalib.GEbounds()
  476 + itrue = [i for i in range(obs.rmf().etrue().size())]
  477 + ireco = []
485 for i in range(obs.rmf().emeasured().size()): 478 for i in range(obs.rmf().emeasured().size()):
486 - ereco_min = obs.rmf().emeasured().emin(i)  
487 - ereco_max = obs.rmf().emeasured().emax(i)  
488 - if ereco_min * 1.001 >= emin and ereco_max * 0.999 <= emax:  
489 - ereco.append(ereco_min, ereco_max) 479 + ereco_bin_min = obs.rmf().emeasured().emin(i)
  480 + ereco_bin_max = obs.rmf().emeasured().emax(i)
  481 + if ereco_bin_min * 1.001 >= emin and ereco_bin_max * 0.999 <= emax:
  482 + ereco.append(ereco_bin_min, ereco_bin_max)
490 ireco.append(i) 483 ireco.append(i)
491 484
492 # Extract PHA 485 # Extract PHA
doc/source/admin/release_history/1.6.rst
@@ -32,6 +32,8 @@ Bug fixes @@ -32,6 +32,8 @@ Bug fixes
32 Improvements 32 Improvements
33 ------------ 33 ------------
34 34
  35 +* [`2656 <https://cta-redmine.irap.omp.eu/issues/2656>`_] -
  36 + Use full ``RMF`` true energy range for On/Off analysis in :ref:`csspec`
35 * [`2513 <https://cta-redmine.irap.omp.eu/issues/2513>`_] - 37 * [`2513 <https://cta-redmine.irap.omp.eu/issues/2513>`_] -
36 Transparently update parameter files 38 Transparently update parameter files
37 * [`2490 <https://cta-redmine.irap.omp.eu/issues/2490>`_] - 39 * [`2490 <https://cta-redmine.irap.omp.eu/issues/2490>`_] -