excess

gammapy.stats.excess(n_on, n_off, alpha)[source]

Estimate excess in the on region for an on-off observation.

\[\mu_{excess} = n_{on} - \alpha \times n_{off}\]
Parameters:
n_on : array_like

Observed number of counts in the on region

n_off : array_like

Observed number of counts in the off region

alpha : array_like

On / off region exposure ratio for background events

Returns:
excess : numpy.ndarray

Excess estimate for the on region

Examples

>>> excess(n_on=10, n_off=20, alpha=0.1)
8.0
>>> excess(n_on=4, n_off=9, alpha=0.5)
-0.5