Constant#

class pypillometry.signal.gaussmarkov.Constant(kappa=10000000.0)[source]#

Bases: Component

Unknown constant (e.g., the mean of the signal) with a diffuse prior.

A state that does not change, with a prior variance kappa that is very large against the signal. Used with n_diffuse=1 in kalman_loglik(), the likelihood of the other parameters does not depend on the level of the signal (the restricted likelihood, REML), and the smoother returns the posterior of the constant with the other components.

Parameters:

kappa (float) – prior variance (signal units squared); default 1e7. Not a fitted parameter.

Examples

>>> c = Constant()
>>> c.discretise(50.)
(array([[1.]]), array([[0.]]))
>>> c.param_names
()

Methods

cov

0: the constant does not enter the covariance and the variogram.

discretise

Exact discretisation for a time step dt (ms).

get_params

dict of the parameters

psd

One-sided power spectral density of the output at frequencies freq (Hz), in signal units squared per Hz; its integral over all frequencies is the variance.

ss

Continuous-time state space (ContinuousSS).

variogram

Semivariogram gamma(tau) = k(0) - k(tau) of the output (ms).

with_params

copy with some parameters (or structural fields) changed

Details

cov(tau)[source]#

0: the constant does not enter the covariance and the variogram.

Return type:

ndarray

discretise(dt)[source]#

Exact discretisation for a time step dt (ms).

Return type:

tuple[ndarray, ndarray]

Returns:

A, Q (np.ndarray) – transition matrix and process-noise covariance, x[t+dt] = A x[t] + w, w ~ N(0, Q)

get_params()#

dict of the parameters

Return type:

dict[str, float]

psd(freq)[source]#

One-sided power spectral density of the output at frequencies freq (Hz), in signal units squared per Hz; its integral over all frequencies is the variance.

\[S(f) = \frac{2}{1000} H (i\omega - F)^{-1} Q_n (-i\omega - F^\top)^{-1} H^\top, \qquad \omega = 2\pi f / 1000\]
Return type:

ndarray

ss()[source]#

Continuous-time state space (ContinuousSS).

Return type:

ContinuousSS

variogram(tau)#

Semivariogram gamma(tau) = k(0) - k(tau) of the output (ms).

Return type:

ndarray

with_params(**kw)#

copy with some parameters (or structural fields) changed

Return type:

Self

property dim: int#

dimension of the state