excess_error

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

Estimate error on excess for an on-off measurement.

\[\Delta\mu_{excess} = \sqrt{n_{on} + \alpha ^ 2 \times n_{off}}\]

TODO: Implement better error and limit estimates (Li & Ma, Rolke)!

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_error : numpy.ndarray

Excess error estimate

Examples

>>> excess_error(n_on=10, n_off=20, alpha=0.1)
3.1937438845342623...
>>> excess_error(n_on=4, n_off=9, alpha=0.5)
2.5