minor cleanup in energy groups
@@ -24,7 +24,6 @@ __all__ = [
'SpectrumEnergyGroupMaker',
'SpectrumEnergyGroup',
'SpectrumEnergyGroups',
- 'calculate_flux_point_binning',
]
# TODO: improve the code so that this isn't needed!
@@ -53,6 +52,11 @@ class SpectrumEnergyGroupMaker(object):
See :ref:`spectrum_energy_group` for examples.
+ Parameters
+ ----------
+ obs : `~gammapy.spectrum.SpectrumObservation`
+ Spectrum observation
+
Attributes
----------
obs : `~gammapy.spectrum.SpectrumObservation`
@@ -63,7 +67,7 @@ class SpectrumEnergyGroupMaker(object):
List of energy groups.
"""
- def __init__(self, obs=None):
+ def __init__(self, obs):
self.obs = obs
# Start with a table with the energy binning and basic stats
@@ -78,8 +82,7 @@ class SpectrumEnergyGroupMaker(object):
self.groups = SpectrumEnergyGroups.from_total_table(self.table)
def __str__(self):
- """Print a little report"""
- ss = 'SpectrumEnergyGroupMaker:\n'
+ ss = self.__class__.__name__
ss += '\nSpectrum table:\n'
ss += 'Number of bins: {}\n'.format(len(self.table))
@@ -91,7 +94,6 @@ class SpectrumEnergyGroupMaker(object):
return ss
# Properties concerning the total, un-grouped spectrum
-
@property
def table_energy_range(self):
"""Total spectrum energy range (no grouping or range applied)"""
@@ -100,7 +102,6 @@ class SpectrumEnergyGroupMaker(object):
return EnergyRange(emin, emax)
# Properties for the grouped spectrum
-
@property
def n_groups(self):
"""Number of groups."""
@@ -130,8 +131,8 @@ class SpectrumEnergyGroupMaker(object):
self.groups.apply_energy_min(emin)
if emax:
self.groups.apply_energy_max(emax)
- # Methods to compute groupings
+ # Methods to compute groupings
def compute_groups_fixed(self, ebounds):
"""Compute grouping for a given fixed energy binning.
"""
@@ -139,14 +140,6 @@ class SpectrumEnergyGroupMaker(object):
self.groups.apply_energy_max(energy=ebounds[-1])
self.groups.apply_energy_binning(ebounds=ebounds)
- def compute_groups_npoints(self, npoints):
- """TODO: document"""
- emin, emax = self.get_safe_range()
- npoints = self.config['n_points']
- return EnergyBounds.equal_log_spacing(
- emin=emin, emax=emax, nbins=npoints,
- )
-
class SpectrumEnergyGroup(object):
"""Spectrum energy group.
@@ -494,7 +487,7 @@ def calculate_flux_point_binning(obs_list, min_signif):
flux point interval, otherwise the sherpa covariance method breaks
down.
- TODO: Refactor
+ TODO: Refactor, add back to docs
Parameters
----------
