SpectrumEnergyGroupMaker¶
-
class
gammapy.spectrum.
SpectrumEnergyGroupMaker
(obs)[source]¶ Bases:
object
Energy bin groups for spectral analysis.
This class contains both methods that run algorithms that compute groupings as well as the results as data members and methods to debug and assess the results.
The input
obs
is used read-only, to access the counts energy binning, as well as some other info that is used for energy bin grouping.This class creates the
groups
attribute on construction, with exactly one group per energy bin. It is then modified by calling methods on this class, usually to declare some bins as under- and overflow (i.e. not to be used in spectral analysis), and to group bins (e.g. for flux point computation).See Spectrum energy grouping for examples.
Parameters: obs :
SpectrumObservation
Spectrum observation
Attributes
obs ( SpectrumObservation
) Spectrum observation datagroups ( SpectrumEnergyGroups
) List of energy groupsMethods Summary
compute_groups_adaptive
(min_signif[, …])Compute energy binning for flux points. compute_groups_fixed
(ebounds)Apply grouping for a given fixed energy binning. compute_range_safe
()Apply safe energy range of observation to groups
.Methods Documentation
-
compute_groups_adaptive
(min_signif, rebin_factor=2)[source]¶ Compute energy binning for flux points.
This is useful to get an energy binning to use with
FluxPoints()
Each bin in the resulting energy binning will include amin_signif
source detection.TODO: It is required that at least two fine bins be included in one flux point interval, otherwise the sherpa covariance method breaks down.
Parameters: min_signif : float
Required significance for each bin
-
compute_groups_fixed
(ebounds)[source]¶ Apply grouping for a given fixed energy binning.
Parameters: ebounds :
Quantity
Energy bounds array
-
compute_range_safe
()[source]¶ Apply safe energy range of observation to
groups
.This method takes the safe energy range information from
self.obs
and changesself.groups
like this:- group bins below the safe energy range into one group of type “underflow”
- group bins above the safe energy range into one group of type “overflow”
-