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 3 * Bug fix version 1.5.1 released
4 4 ================================
5 5  
  6 + Take energy dispersion in csresspec modelling into account (#2341)
6 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 4 Introduction
... ... @@ -219,7 +219,8 @@ None
219 219  
220 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 226 csroot2caldb - Generates calibration database from ROOT file
... ...
cscripts/csresspec.py
... ... @@ -241,14 +241,14 @@ class csresspec(ctools.csobservation):
241 241  
242 242 # Bin events
243 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 250 cntcube['coordsys'] = 'CEL'
251   - cntcube['ebinalg'] = self['ebinalg'].string()
  251 + cntcube['ebinalg'] = self['ebinalg'].string()
252 252 if self['ebinalg'].string() == 'FILE':
253 253 cntcube['ebinfile'] = self['ebinfile'].filename()
254 254 else:
... ... @@ -356,7 +356,7 @@ class csresspec(ctools.csobservation):
356 356 def _cube_to_spectrum(self, cube, evlist_info):
357 357 """
358 358 Derive from event cube a count spectrum
359   -
  359 +
360 360 If data come from event list use only the ROI and energy range of
361 361 the original data. Apply user defined mask if requested.
362 362  
... ... @@ -550,29 +550,30 @@ class csresspec(ctools.csobservation):
550 550 # if 3D observation
551 551 if obs[0].classname() == 'GCTAObservation':
552 552  
553   - # Prepare Observations
554   -
555 553 # If already binned set the evlist_info dictionary to have
556 554 # attribute was_list False
557 555 if obs[0].eventtype() == 'CountsCube':
558 556 evlist_info = {'was_list': False}
559   - # Otherwise bin now
  557 +
  558 + # ... otherwise bin now
560 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 562 msg = 'Setting up binned observation'
564 563 self._log_string(gammalib.NORMAL, msg)
565 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 568 if self._use_maps:
570 569 modcube = gammalib.GCTAEventCube(self['inmodel'].filename())
571   - # Otherwise calculate it now
  570 +
  571 + # ... otherwise calculate it now
572 572 else:
573 573 msg = 'Computing model cube'
574 574 self._log_string(gammalib.NORMAL, msg)
575 575 modelcube = ctools.ctmodel(obs)
  576 + modelcube['edisp'] = self['edisp'].boolean()
576 577 modelcube.run()
577 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 10  
11 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 17 The following improvements were made:
16 18  
... ...