ObservationStats

class gammapy.data.ObservationStats(n_on=None, n_off=None, a_on=None, a_off=None, obs_id=None, livetime=None)[source]

Bases: gammapy.stats.Stats

Observation statistics.

Class allowing to summarize observation (DataStoreObservation) statistics

Parameters:
n_on : int

Number of on events

n_off : int

Number of off events

a_on : float

Relative background exposure of the on region

a_off : float

Relative background exposure of the off region

obs_id : int

ID of the observation

livetime : Quantity

Livetime of the observation

Attributes Summary

alpha Alpha (on / off exposure ratio).
background Background estimate (float).
excess Excess (float).
sigma Li-Ma significance for observation statistics (float).

Methods Summary

from_observation(observation, bg_estimate) Create from DataStoreObservation.
stack(stats_list) Stack (concatenate) list of ObservationStats.
to_dict(self) Data as a dict.

Attributes Documentation

alpha

Alpha (on / off exposure ratio).

Override member function from Stats to take into account weighted alpha by number of Off events

background

Background estimate (float).

\[\mu_\mathrm{bg} = \alpha\ n_\mathrm{off}\]
excess

Excess (float).

\[n_\mathrm{ex} = n_\mathrm{on} - \mu_\mathrm{bg}\]
sigma

Li-Ma significance for observation statistics (float).

Methods Documentation

classmethod from_observation(observation, bg_estimate)[source]

Create from DataStoreObservation.

Parameters:
observation : DataStoreObservation

IACT data store observation

bg_estimate : BackgroundEstimate

Background estimate

classmethod stack(stats_list)[source]

Stack (concatenate) list of ObservationStats.

Parameters:
stats_list : list

List of ObservationStats

Returns:
total_stats : ObservationStats

Statistics for stacked observation

to_dict(self)[source]

Data as a dict.

This is useful for serialization or putting the info in a table.