Note

You are not reading the most up to date version of Gammapy documentation.
Access the latest stable version v1.3 or the list of Gammapy releases.

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 Ssimple is given by

Ssimple=(nonμbkg)/μbkg

The Li & Ma significance estimate corresponds to the Li & Ma formula (17) in the limiting case of known background μbkg=α×noff with α0. The following formula for Slima was obtained with Mathematica:

Slima=[2nonlog(nonμbkg)non+μbkg]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 : numpy.ndarray

Significance according to the method chosen.

References

[R11]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