cstat#

gammapy.stats.cstat(n_on, mu_on, truncation_value=1e-25)[source]#

C statistic, for Poisson data.

The C statistic is defined as

\[C = 2 \left[ \mu_{on} - n_{on} + n_{on} (\log(n_{on}) - log(\mu_{on}) \right]\]

and \(C = 0\) where \(\mu_{on} <= 0\).

truncation_value handles the case where n_on or mu_on is 0 or less and the log cannot be taken. For more information see Fit statistics

Parameters
n_onarray_like

Observed counts

mu_onarray_like

Expected counts

truncation_valuearray_like

n_on = truncation_value where n_on <= truncation_value. mu_on = truncation_value where n_on <= truncation_value Default is 1e-25.

Returns
statndarray

Statistic per bin

References