SpectrumEnergyGroups

class gammapy.spectrum.SpectrumEnergyGroups(initlist=None)[source]

Bases: collections.UserList

List of SpectrumEnergyGroup objects.

A helper class used by the gammapy.spectrum.SpectrumEnergyGroupsMaker.

Attributes Summary

energy_bounds Energy group bounds (Quantity).
energy_range Total energy range (Quantity of length 2).

Methods Summary

append(item) S.append(value) – append value to the end of the sequence
clear()
copy() Deep copy
count(value)
extend(other) S.extend(iterable) – extend sequence by appending elements from the iterable
from_group_table(table) Create from energy groups in Table format.
from_total_table(table) Create list of SpectrumEnergyGroup objects from table.
index(value, [start, [stop]]) Raises ValueError if the value is not present.
insert(i, item) S.insert(index, value) – insert value before index
pop([index]) Raise IndexError if list is empty or index is out of range.
remove(item) S.remove(value) – remove first occurrence of value.
reverse() S.reverse() – reverse IN PLACE
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

energy_bounds

Energy group bounds (Quantity).

energy_range

Total energy range (Quantity of length 2).

Methods Documentation

append(item)

S.append(value) – append value to the end of the sequence

clear() → None -- remove all items from S
copy()[source]

Deep copy

count(value) → integer -- return number of occurrences of value
extend(other)

S.extend(iterable) – extend sequence by appending elements from the iterable

classmethod from_group_table(table)[source]

Create from energy groups in Table format.

classmethod from_total_table(table)[source]

Create list of SpectrumEnergyGroup objects from table.

index(value[, start[, stop]]) → integer -- return first index of value.

Raises ValueError if the value is not present.

Supporting start and stop arguments is optional, but recommended.

insert(i, item)

S.insert(index, value) – insert value before index

pop([index]) → item -- remove and return item at index (default last).

Raise IndexError if list is empty or index is out of range.

remove(item)

S.remove(value) – remove first occurrence of value. Raise ValueError if the value is not present.

reverse()

S.reverse() – reverse IN PLACE

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.