compute_total_stats

gammapy.stats.compute_total_stats(counts, exposure, background=None, solid_angle=None, mask=None)[source]

Compute total stats for arrays of per-bin stats.

The result dictionary contains a flux entry computed as

\[F = N / E = \sum{N_i} / \sum{E_i}\]

as well as a flux3 entry computed as

\[F = \sum{F_i} = \sum{\left(N_i / E_i\right)}\]

where F is flux, N is excess and E is exposure.

The output flux units are the inverse of the input exposure units, e.g.

  • exposure in cm^2 s -> flux in cm^-2 s^-1
  • exposure in cm^2 s TeV -> flux in cm^-2 s^-1 TeV-1

The output surface_brightness units in addition depend on the solid_angle units, e.g.

  • exposure in cm^2 s and solid_angle in deg^2 -> surface_brightness in cm^-2 s^-1 deg^-2

TODOs:

  • integrate this with the Stats class.
  • add statistical errors on excess, flux, surface brightness
Parameters:
counts, exposure : array_like

Input arrays

background, solid_angle, mask : array_like

Optional input arrays

Returns:
result : dict

Dictionary of total stats (for now, see the code for which entries it has).