significance

gammapy.stats.significance(n_on, mu_bkg, method='lima', n_on_min=1)[source]

Compute significance for an observed number of counts and known background.

The simple significance estimate \(S_{simple}\) is given by

\[S_{simple} = (n_{on} - \mu_{bkg}) / \sqrt{\mu_{bkg}}\]

The Li & Ma significance estimate corresponds to the Li & Ma formula (17) in the limiting case of known background \(\mu_{bkg} = \alpha \times n_{off}\) with \(\alpha \to 0\). The following formula for \(S_{lima}\) was obtained with Mathematica:

\[S_{lima} = \left[ 2 n_{on} \log \left( \frac{n_{on}}{\mu_{bkg}} \right) - n_{on} + \mu_{bkg} \right] ^ {1/2}\]
Parameters:

n_on : array_like

Observed number of counts

mu_bkg : array_like

Known background level

method : str

Select method: ‘lima’ or ‘simple’

n_on_min : float

Minimum n_on (return NaN for smaller values)

Returns:

significance : ndarray

Significance according to the method chosen.

References

[R10]Li and Ma, “Analysis methods for results in gamma-ray astronomy”, Link

Examples

>>> significance(n_on=11, mu_bkg=9, method='lima')
0.64401498442763649
>>> significance(n_on=11, mu_bkg=9, method='simple')
0.66666666666666663
>>> significance(n_on=7, mu_bkg=9, method='lima')
-0.69397262486881672
>>> significance(n_on=7, mu_bkg=9, method='simple')
-0.66666666666666663