diff --git a/cscripts/csresmap.py b/cscripts/csresmap.py index 806c2bd..ae53697 100755 --- a/cscripts/csresmap.py +++ b/cscripts/csresmap.py @@ -34,7 +34,7 @@ class csresmap(ctools.cscript): # Constructor def __init__(self, *argv): """ - Constructor. + Constructor """ # Set name self._name = 'csresmap' @@ -107,16 +107,19 @@ class csresmap(ctools.cscript): if not self._skip_binning: self['xref'].real() self['yref'].real() - self['emin'].real() - self['emax'].real() - self['enumbins'].integer() - self['ebinalg'].string() self['coordsys'].string() self['proj'].string() self['nxpix'].integer() self['nypix'].integer() self['binsz'].real() - + self['ebinalg'].string() + if self['ebinalg'].string() == 'FILE': + self['ebinfile'].filename() + else: + self['emin'].real() + self['emax'].real() + self['enumbins'].integer() + # Query parameters self['edisp'].boolean() self['algorithm'].string() @@ -149,11 +152,7 @@ class csresmap(ctools.cscript): self._get_parameters() # Write observation into logger - if self._logTerse(): - self._log('\n') - self._log.header1(gammalib.number('Observation',len(self._obs))) - self._log(str(self._obs)) - self._log('\n') + self._log_observations(gammalib.NORMAL, self._obs, 'Observation') # If a counts and model cube are specified then load them as sky map if self._use_maps: @@ -172,23 +171,24 @@ class csresmap(ctools.cscript): else: # Write header - if self._logTerse(): - self._log('\n') - self._log.header1('Generate binned map (ctbin)') + self._log_header1(gammalib.TERSE, 'Generate binned map (ctbin)') # Create countsmap bin = ctools.ctbin(self._obs) - bin['nxpix'] = self['nxpix'].integer() - bin['nypix'] = self['nypix'].integer() - bin['proj'] = self['proj'].string() - bin['coordsys'] = self['coordsys'].string() bin['xref'] = self['xref'].real() bin['yref'] = self['yref'].real() - bin['enumbins'] = self['enumbins'].integer() + bin['proj'] = self['proj'].string() + bin['coordsys'] = self['coordsys'].string() bin['ebinalg'] = self['ebinalg'].string() - bin['emin'] = self['emin'].real() - bin['emax'] = self['emax'].real() + bin['nxpix'] = self['nxpix'].integer() + bin['nypix'] = self['nypix'].integer() bin['binsz'] = self['binsz'].real() + if self['ebinalg'].string() == "FILE": + bin['ebinfile'] = self['ebinfile'].filename().file() + else: + bin['enumbins'] = self['enumbins'].integer() + bin['emin'] = self['emin'].real() + bin['emax'] = self['emax'].real() bin['chatter'] = self['chatter'].integer() bin['clobber'] = self['clobber'].boolean() bin['debug'] = self['debug'].boolean() @@ -201,9 +201,7 @@ class csresmap(ctools.cscript): countmap = cta_counts_cube.counts() # Write header - if self._logTerse(): - self._log('\n') - self._log.header1('Generate model map (ctmodel)') + self._log_header1(gammalib.TERSE, 'Generate model map (ctmodel)') # Create model map model = ctools.ctmodel(self._obs)