Commit 3b598ea059adeb4e96c81f7df613d364d451e57d

Authored by Jürgen Knödlseder
1 parent 16dfc641

Take energy dispersion in csresspec modelling into account (#2341)

ChangeLog
1 -2018-02-08 1 +2018-02-16
2 2
3 * Bug fix version 1.5.1 released 3 * Bug fix version 1.5.1 released
4 ================================ 4 ================================
5 5
  6 + Take energy dispersion in csresspec modelling into account (#2341)
6 Enable using csphagen for HESS, VERITAS and MAGIC observations (#2307) 7 Enable using csphagen for HESS, VERITAS and MAGIC observations (#2307)
7 8
8 9
1 -8 February 2018 1 +16 February 2018
2 2
3 3
4 Introduction 4 Introduction
@@ -219,7 +219,8 @@ None @@ -219,7 +219,8 @@ None
219 219
220 csresspec - Generate residual spectrum 220 csresspec - Generate residual spectrum
221 -------------------------------------- 221 --------------------------------------
222 -None 222 +The energy dispersion flag was not taken into account when modelling the the
  223 +counts to estimate the residuals. This is now corrected (#2341).
223 224
224 225
225 csroot2caldb - Generates calibration database from ROOT file 226 csroot2caldb - Generates calibration database from ROOT file
cscripts/csresspec.py
@@ -241,14 +241,14 @@ class csresspec(ctools.csobservation): @@ -241,14 +241,14 @@ class csresspec(ctools.csobservation):
241 241
242 # Bin events 242 # Bin events
243 cntcube = ctools.ctbin(obs) 243 cntcube = ctools.ctbin(obs)
244 - cntcube['xref'] = ra  
245 - cntcube['yref'] = dec  
246 - cntcube['binsz'] = 0.02  
247 - cntcube['nxpix'] = npix  
248 - cntcube['nypix'] = npix  
249 - cntcube['proj'] = 'TAN' 244 + cntcube['xref'] = ra
  245 + cntcube['yref'] = dec
  246 + cntcube['binsz'] = 0.02
  247 + cntcube['nxpix'] = npix
  248 + cntcube['nypix'] = npix
  249 + cntcube['proj'] = 'TAN'
250 cntcube['coordsys'] = 'CEL' 250 cntcube['coordsys'] = 'CEL'
251 - cntcube['ebinalg'] = self['ebinalg'].string() 251 + cntcube['ebinalg'] = self['ebinalg'].string()
252 if self['ebinalg'].string() == 'FILE': 252 if self['ebinalg'].string() == 'FILE':
253 cntcube['ebinfile'] = self['ebinfile'].filename() 253 cntcube['ebinfile'] = self['ebinfile'].filename()
254 else: 254 else:
@@ -356,7 +356,7 @@ class csresspec(ctools.csobservation): @@ -356,7 +356,7 @@ class csresspec(ctools.csobservation):
356 def _cube_to_spectrum(self, cube, evlist_info): 356 def _cube_to_spectrum(self, cube, evlist_info):
357 """ 357 """
358 Derive from event cube a count spectrum 358 Derive from event cube a count spectrum
359 - 359 +
360 If data come from event list use only the ROI and energy range of 360 If data come from event list use only the ROI and energy range of
361 the original data. Apply user defined mask if requested. 361 the original data. Apply user defined mask if requested.
362 362
@@ -550,29 +550,30 @@ class csresspec(ctools.csobservation): @@ -550,29 +550,30 @@ class csresspec(ctools.csobservation):
550 # if 3D observation 550 # if 3D observation
551 if obs[0].classname() == 'GCTAObservation': 551 if obs[0].classname() == 'GCTAObservation':
552 552
553 - # Prepare Observations  
554 -  
555 # If already binned set the evlist_info dictionary to have 553 # If already binned set the evlist_info dictionary to have
556 # attribute was_list False 554 # attribute was_list False
557 if obs[0].eventtype() == 'CountsCube': 555 if obs[0].eventtype() == 'CountsCube':
558 evlist_info = {'was_list': False} 556 evlist_info = {'was_list': False}
559 - # Otherwise bin now 557 +
  558 + # ... otherwise bin now
560 else: 559 else:
561 - # we remember if we binned an event list  
562 - # so that we can mask only the ROI for residual calculation 560 + # we remember if we binned an event list so that we can
  561 + # mask only the ROI for residual calculation
563 msg = 'Setting up binned observation' 562 msg = 'Setting up binned observation'
564 self._log_string(gammalib.NORMAL, msg) 563 self._log_string(gammalib.NORMAL, msg)
565 obs, evlist_info = self._bin_evlist(obs) 564 obs, evlist_info = self._bin_evlist(obs)
566 565
567 - # Calculate Model and residuals  
568 - # If model cube is provided load it 566 + # Calculate Model and residuals. If model cube is provided load
  567 + # it
569 if self._use_maps: 568 if self._use_maps:
570 modcube = gammalib.GCTAEventCube(self['inmodel'].filename()) 569 modcube = gammalib.GCTAEventCube(self['inmodel'].filename())
571 - # Otherwise calculate it now 570 +
  571 + # ... otherwise calculate it now
572 else: 572 else:
573 msg = 'Computing model cube' 573 msg = 'Computing model cube'
574 self._log_string(gammalib.NORMAL, msg) 574 self._log_string(gammalib.NORMAL, msg)
575 modelcube = ctools.ctmodel(obs) 575 modelcube = ctools.ctmodel(obs)
  576 + modelcube['edisp'] = self['edisp'].boolean()
576 modelcube.run() 577 modelcube.run()
577 modcube = modelcube.cube().copy() 578 modcube = modelcube.cube().copy()
578 579
doc/source/admin/release_history/1.5.1.rst
@@ -10,7 +10,9 @@ ctools 1.5.1 is a bug fix release for ctools release 1.5. @@ -10,7 +10,9 @@ ctools 1.5.1 is a bug fix release for ctools release 1.5.
10 10
11 The following bugs were fixed: 11 The following bugs were fixed:
12 12
13 -* ... 13 +* [`2341 <https://cta-redmine.irap.omp.eu/issues/2341>`_] -
  14 + Take energy dispersion in :ref:`csresspec` modelling into account
  15 +
14 16
15 The following improvements were made: 17 The following improvements were made:
16 18