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_onarray_like

Observed number of counts in the on region

n_offarray_like

Observed number of counts in the off region

alphaarray_like

On / off region exposure ratio for background events

Returns
excessnumpy.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