Events#

class astropy.stats.Events(p0: float = 0.05, gamma: float | None = None, ncp_prior: float | None = None)[source]#

Bases: FitnessFunc

Bayesian blocks fitness for binned or unbinned events.

Parameters:
p0float, optional

False alarm probability, used to compute the prior on \(N_{\rm blocks}\) (see eq. 21 of Scargle 2013). For the Events type data, p0 does not seem to be an accurate representation of the actual false alarm probability. If you are using this fitness function for a triggering type condition, it is recommended that you run statistical trials on signal-free noise to determine an appropriate value of gamma or ncp_prior to use for a desired false alarm rate.

gammafloat, optional

If specified, then use this gamma to compute the general prior form, \(p \sim {\tt gamma}^{N_{\rm blocks}}\). If gamma is specified, p0 is ignored.

ncp_priorfloat, optional

If specified, use the value of ncp_prior to compute the prior as above, using the definition \({\tt ncp\_prior} = -\ln({\tt gamma})\). If ncp_prior is specified, gamma and p0 is ignored.

Methods Summary

fitness(N_k, T_k)

validate_input(t, x, sigma)

Validate inputs to the model.

Methods Documentation

fitness(N_k: NDArray[float], T_k: NDArray[float]) NDArray[float][source]#
validate_input(t: ArrayLike, x: ArrayLike | None, sigma: float | ArrayLike | None) tuple[NDArray[float], NDArray[float], NDArray[float]][source]#

Validate inputs to the model.

Parameters:
tarray_like

times of observations

xarray_like, optional

values observed at each time

sigmafloat or array_like, optional

errors in values x

Returns:
t, x, sigmaarray_like, float

validated and perhaps modified versions of inputs