SpectrumEnergyGroups¶
-
class
gammapy.spectrum.SpectrumEnergyGroups(initlist=None)[source]¶ Bases:
collections.UserListList of
SpectrumEnergyGroupobjects.A helper class used by the
gammapy.spectrum.SpectrumEnergyMaker.Attributes Summary
bin_idx_rangeTuple (left, right) with range of bin indices (both edges inclusive). energy_boundsEnergy group bounds ( Quantity).energy_rangeTotal energy range ( Quantityof length 2).Methods Summary
append(item)apply_energy_binning(ebounds)Apply an energy binning. apply_energy_max(energy)apply_energy_max_old(energy)Modify list in-place to apply a max energy cut. apply_energy_min(energy)apply_energy_min_old(energy)Modify list in-place to apply a min energy cut. clear()clip_to_valid_range(list_idx)TODO: document copy()Deep copy count(item)extend(other)find_list_idx(energy)Find the list index corresponding to a given energy. find_list_idx_range(energy_min, energy_max)TODO: document. from_group_table(table)Create from energy groups in Tableformat.from_total_table(table)Create list of SpectrumEnergyGroup objects from table. index(item, *args)insert(i, item)make_and_replace_merged_group(list_idx_min, …)Merge energy groups and update indexes make_merged_group(list_idx_min, …)Merge group according to indexes pop([i])reindex_groups()Re-index groups remove(item)reverse()sort(*args, **kwds)to_group_table()Table with one energy group per row ( Table).to_total_table()Table with one energy bin per row ( Table).Attributes Documentation
-
bin_idx_range¶ Tuple (left, right) with range of bin indices (both edges inclusive).
Methods Documentation
-
append(item)¶
-
clear()¶
-
count(item)¶
-
extend(other)¶
-
find_list_idx_range(energy_min, energy_max)[source]¶ TODO: document.
- Min index is the bin that contains
energy_range.min - Max index is the bin that is below the one that contains
energy_range.max - This way we don’t loose any bins or count them twice.
- Containment is checked for each bin as [min, max)
- Min index is the bin that contains
-
index(item, *args)¶
-
insert(i, item)¶
-
make_and_replace_merged_group(list_idx_min, list_idx_max, bin_type)[source]¶ Merge energy groups and update indexes
-
pop(i=-1)¶
-
remove(item)¶
-
reverse()¶
-
sort(*args, **kwds)¶
-
to_group_table()[source]¶ Table with one energy group per row (
Table).Columns:
energy_group_idx- Energy group index (int)energy_group_n_bins- Number of bins in the energy group (int)bin_idx_min- First bin index in the energy group (int)bin_idx_max- Last bin index in the energy group (int)bin_type- Bin type {‘normal’, ‘underflow’, ‘overflow’} (str)energy_min- Energy group start energy (Quantity)energy_max- Energy group end energy (Quantity)
-
to_total_table()[source]¶ Table with one energy bin per row (
Table).Columns:
energy_group_idx- Energy group index (int)bin_idx- Energy bin index (int)bin_type- Bin type {‘normal’, ‘underflow’, ‘overflow’} (str)
There are no energy columns, because the per-bin energy info was lost during grouping.
-