Change request #2881

Replace log flag in GEbounds and GEnergies constructors by string and implement "POW" binning

Added by Knödlseder Jürgen about 5 years ago. Updated about 4 years ago.

Status:ClosedStart date:05/02/2019
Priority:NormalDue date:
Assigned To:Knödlseder Jürgen% Done:

100%

Category:-
Target version:1.7.0
Duration:

Description

So far a flag specifies in the GEbounds and GEnergies constructors whether a logarithmic or a linear binning should be used. The flag should be replaced by a string so that additional binning methods can be passed. Specifically, the POW method should be implement which implements a power-law binning that leads to equal integration intervals for each energy bin for a specific power law slope. The user should be allows to specify the power law slope through an additional user parameter.

The GEbounds::set_lin() and GEbounds::set_log() methods could be replaced by a single GEbounds::set() method with the same logic. The same is true for GEnergies::set_lin() and GEnergies::set_log(). Alternatively, a set_pow() method could be added.


Recurrence

No recurrence.

History

#1 Updated by Knödlseder Jürgen about 5 years ago

  • Target version set to 1.7.0

#2 Updated by Knödlseder Jürgen about 4 years ago

  • Status changed from New to Pull request
  • Assigned To set to Knödlseder Jürgen
  • % Done changed from 0 to 100

I change the interface of the following constructors:

GEnergies(const int& num, const GEnergy& emin, const GEnergy& emax, const std::string& method = "LOG", const double& gamma  = 1.0)
GEbouds(const int& num, const GEnergy& emin, const GEnergy& emax, const std::string& method = "LOG", const double& gamma  = 1.0)
and implemented the methods:
GEnergies::set(const int& num, const GEnergy& emin, const GEnergy& emax, const std::string& method = "LOG", const double& gamma  = 1.0)
GEbounds::set(const int& num, const GEnergy& emin, const GEnergy& emax, const std::string& method = "LOG", const double& gamma  = 1.0)

The GEbounds::set() method makes use of the GEbounds::set(const GEnergies& energies) method so that the actual algorithms for defining the energy bins are only implemented in the GEnergies class, reducing any code duplication. The GEbounds::set_lin() and GEbounds::set_log() methods were therefore removed.

For the GEnergies class the GEnergies::set_lin() and GEnergies::set_log() methods are now in private scope and a private GEnergies::set_pow() method was added to handle the power-law binning.

All GammaLib unit tests were adapted accordingly.

I also adapted ctools to match to the new interface. In addition I added to the following tools the possibility to specify a power-law binning in the parameter file (the ebingamma parameter was added to all these tools): ctbin, ctedispcube, ctexpcube, ctmapcube, ctmodel, ctpsfcube, csphagen, csresmap, csresspec, and csspec.

#3 Updated by Knödlseder Jürgen about 4 years ago

  • Status changed from Pull request to Closed

Merged into devel.

Also available in: Atom PDF