From 3b598ea059adeb4e96c81f7df613d364d451e57d Mon Sep 17 00:00:00 2001 From: Jürgen Knödlseder Date: Fri, 16 Feb 2018 15:22:06 +0100 Subject: [PATCH] Take energy dispersion in csresspec modelling into account (#2341) --- ChangeLog | 3 ++- NEWS | 5 +++-- cscripts/csresspec.py | 33 +++++++++++++++++---------------- doc/source/admin/release_history/1.5.1.rst | 4 +++- 4 files changed, 25 insertions(+), 20 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7e4d502..042c74d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,8 +1,9 @@ -2018-02-08 +2018-02-16 * Bug fix version 1.5.1 released ================================ + Take energy dispersion in csresspec modelling into account (#2341) Enable using csphagen for HESS, VERITAS and MAGIC observations (#2307) diff --git a/NEWS b/NEWS index a37347b..a795df3 100644 --- a/NEWS +++ b/NEWS @@ -1,4 +1,4 @@ -8 February 2018 +16 February 2018 Introduction @@ -219,7 +219,8 @@ None csresspec - Generate residual spectrum -------------------------------------- -None +The energy dispersion flag was not taken into account when modelling the the +counts to estimate the residuals. This is now corrected (#2341). csroot2caldb - Generates calibration database from ROOT file diff --git a/cscripts/csresspec.py b/cscripts/csresspec.py index 0c8ac79..ad95ef4 100755 --- a/cscripts/csresspec.py +++ b/cscripts/csresspec.py @@ -241,14 +241,14 @@ class csresspec(ctools.csobservation): # Bin events cntcube = ctools.ctbin(obs) - cntcube['xref'] = ra - cntcube['yref'] = dec - cntcube['binsz'] = 0.02 - cntcube['nxpix'] = npix - cntcube['nypix'] = npix - cntcube['proj'] = 'TAN' + cntcube['xref'] = ra + cntcube['yref'] = dec + cntcube['binsz'] = 0.02 + cntcube['nxpix'] = npix + cntcube['nypix'] = npix + cntcube['proj'] = 'TAN' cntcube['coordsys'] = 'CEL' - cntcube['ebinalg'] = self['ebinalg'].string() + cntcube['ebinalg'] = self['ebinalg'].string() if self['ebinalg'].string() == 'FILE': cntcube['ebinfile'] = self['ebinfile'].filename() else: @@ -356,7 +356,7 @@ class csresspec(ctools.csobservation): def _cube_to_spectrum(self, cube, evlist_info): """ Derive from event cube a count spectrum - + If data come from event list use only the ROI and energy range of the original data. Apply user defined mask if requested. @@ -550,29 +550,30 @@ class csresspec(ctools.csobservation): # if 3D observation if obs[0].classname() == 'GCTAObservation': - # Prepare Observations - # If already binned set the evlist_info dictionary to have # attribute was_list False if obs[0].eventtype() == 'CountsCube': evlist_info = {'was_list': False} - # Otherwise bin now + + # ... otherwise bin now else: - # we remember if we binned an event list - # so that we can mask only the ROI for residual calculation + # we remember if we binned an event list so that we can + # mask only the ROI for residual calculation msg = 'Setting up binned observation' self._log_string(gammalib.NORMAL, msg) obs, evlist_info = self._bin_evlist(obs) - # Calculate Model and residuals - # If model cube is provided load it + # Calculate Model and residuals. If model cube is provided load + # it if self._use_maps: modcube = gammalib.GCTAEventCube(self['inmodel'].filename()) - # Otherwise calculate it now + + # ... otherwise calculate it now else: msg = 'Computing model cube' self._log_string(gammalib.NORMAL, msg) modelcube = ctools.ctmodel(obs) + modelcube['edisp'] = self['edisp'].boolean() modelcube.run() modcube = modelcube.cube().copy() diff --git a/doc/source/admin/release_history/1.5.1.rst b/doc/source/admin/release_history/1.5.1.rst index c65f33c..da8dcaf 100644 --- a/doc/source/admin/release_history/1.5.1.rst +++ b/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. The following bugs were fixed: -* ... +* [`2341 `_] - + Take energy dispersion in :ref:`csresspec` modelling into account + The following improvements were made: -- libgit2 0.21.4