Commit e7dee70474ed389aa8342da7f5fbfd36ffaf13c5

Authored by Jürgen Knödlseder
1 parent 2fd9c50b

Fix energy boundary handline in cssens (#1873)

ChangeLog
1 -2016-10-17 1 +2016-11-10
2 2
3 * Version 1.2.0 released 3 * Version 1.2.0 released
4 ======================== 4 ========================
5 5
  6 + Fix energy boundary handline in cssens (#1873)
6 Add outcovmat parameter to ctlike (#1863) 7 Add outcovmat parameter to ctlike (#1863)
7 Add publish parameter and methods to ctobssim, ctselect, cslightcrv and csspec (#1871) 8 Add publish parameter and methods to ctobssim, ctselect, cslightcrv and csspec (#1871)
8 Add csviscube script (#1853) 9 Add csviscube script (#1853)
1 New Features and Important Changes in ctools 1.2.0 1 New Features and Important Changes in ctools 1.2.0
2 2
3 -17 October 2016 3 +10 November 2016
4 4
5 5
6 Introduction 6 Introduction
@@ -213,6 +213,9 @@ a Sun constraint, but no Moon constraint (#1835). @@ -213,6 +213,9 @@ a Sun constraint, but no Moon constraint (#1835).
213 A publish() method has been added to cslightcrv and csspec that publishes the 213 A publish() method has been added to cslightcrv and csspec that publishes the
214 results on a VO hub (#1871). 214 results on a VO hub (#1871).
215 215
  216 +Fix energy boundary handling in cssens that has been corrupted during code
  217 +refactoring (#1873).
  218 +
216 219
217 Examples 220 Examples
218 -------- 221 --------
cscripts/cssens.py
@@ -201,11 +201,11 @@ class cssens(ctools.cscript): @@ -201,11 +201,11 @@ class cssens(ctools.cscript):
201 Maximum energy 201 Maximum energy
202 """ 202 """
203 # Loop over all observations in container 203 # Loop over all observations in container
204 - for obs in self._obs: 204 + for i, obs in enumerate(self._obs):
205 205
206 - # Get observation energy boundaries  
207 - obs_ebounds = obs.events().ebounds()  
208 - 206 + # Get energy boundaries of the observation
  207 + obs_ebounds = self._obs_ebounds[i]
  208 +
209 # Get minimum and maximum energy of the observation 209 # Get minimum and maximum energy of the observation
210 obs_emin = obs_ebounds.emin() 210 obs_emin = obs_ebounds.emin()
211 obs_emax = obs_ebounds.emax() 211 obs_emax = obs_ebounds.emax()
@@ -546,9 +546,10 @@ class cssens(ctools.cscript): @@ -546,9 +546,10 @@ class cssens(ctools.cscript):
546 # Get parameters 546 # Get parameters
547 self._get_parameters() 547 self._get_parameters()
548 548
549 - # Loop over observations and store ebounds 549 + # Loop over observations and store a deep copy of the energy
  550 + # boundaries for later use
550 for obs in self._obs: 551 for obs in self._obs:
551 - self._obs_ebounds.append(obs.events().ebounds()) 552 + self._obs_ebounds.append(obs.events().ebounds().copy())
552 553
553 # Initialise script 554 # Initialise script
554 colnames = ['loge', 'emin', 'emax', 'crab_flux', 'photon_flux', 555 colnames = ['loge', 'emin', 'emax', 'crab_flux', 'photon_flux',