Matern#

class pypillometry.signal.gaussmarkov.Matern(sigma=1.0, ell=100.0, nu=1.5)[source]#

Bases: Component

Matérn process with half-integer smoothness nu = p + 1/2.

\[k(r) = \sigma^2 e^{-\lambda r} \frac{p!}{(2p)!} \sum_{i=0}^{p} \frac{(p+i)!}{i!(p-i)!} (2\lambda r)^{p-i}, \qquad \lambda = \sqrt{2\nu} / \ell\]

The state holds the process and its first p derivatives; the white noise drives only the highest one (Hartikainen & Särkkä, 2010).

Parameters:
  • sigma (float) – standard deviation (signal units)

  • ell (float) – length scale (ms)

  • nu (float) – smoothness, one of 0.5, 1.5, 2.5, …; default 1.5

Examples

>>> m = Matern(sigma=2., ell=100., nu=2.5)
>>> bool(np.allclose(m.ss().Pinf[0, 0], 4.))
True
>>> lam = np.sqrt(5) / 100.
>>> r = 30.
>>> bool(np.isclose(m.cov(r), 4 * (1 + lam*r + (lam*r)**2 / 3) * np.exp(-lam*r)))
True

Methods

cov

Autocovariance k(tau) of the output at lags tau (ms).

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]#

Autocovariance k(tau) of the output at lags tau (ms).

Return type:

ndarray

discretise(dt)#

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)#

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