ObservationGroupAxis

class gammapy.data.ObservationGroupAxis(name, bins, fmt)[source]

Bases: object

Observation group axis.

Class to define an axis along which to define bins for creating observation groups.

Two kinds of axis are supported, depending on the value of the fmt parameter:

  • fmt='edges' for continuous axes (e.g. altitude angle)
  • fmt='values' for discrete axes (e.g. number of telescopes)

In both cases, both, dimensionless and Quantity-like parameter axes are supported.

See also Observation grouping.

Parameters:

name : str

Name of the parameter to bin.

bins : int, float or Quantity-like

Array of values or bin edges, depending on the fmt parameter.

fmt : {‘edges’, ‘values’}

Format of binning

Examples

Examples how to create ObservationGroupAxis objects:

zenith = Angle([0, 30, 40, 50], 'deg')
zenith_axis = ObservationGroupAxis('ALT', alt, fmt='edges')

ntels = [3, 4]
ntels_axis = ObservationGroupAxis('N_TELS', ntels, fmt='values')

Attributes Summary

get_bins List of bins (int, float or Quantity-like).
info Info string (str).
n_bins Number of bins (int).

Methods Summary

from_column(col) Import from astropy column.
get_bin(bin_id) Get bin (int, float or Quantity-like).
to_column() Convert to astropy column.

Attributes Documentation

get_bins

List of bins (int, float or Quantity-like).

List of bin edges or values (depending on the fmt parameter) for all bins.

info

Info string (str).

n_bins

Number of bins (int).

Methods Documentation

classmethod from_column(col)[source]

Import from astropy column.

Parameters:

col : Column

Column with the axis info.

get_bin(bin_id)[source]

Get bin (int, float or Quantity-like).

Value or tuple of bin edges (depending on the fmt parameter) for the specified bin.

Parameters:

bin_id : int

ID of the bin to retrieve.

Returns:

bin : int, float or Quantity-like

Value or tuple of bin edges, depending on the fmt parameter.

to_column()[source]

Convert to astropy column.

Returns:

col : Column

Column with the axis info.