Deterministic filters¶
Summary¶
File: src/estimators/deterministic.py. DeterministicEstimator owns the state mean ψ and covariance Cpp directly (no ensemble).
| Class | Notes |
|---|---|
KalmanFilter |
Standard linear KF; propagates covariance with Jacobian F_jac |
romda.estimators.DeterministicEstimator(N, Nq, Cdd, psi0, Cpp0, M=None, model=None, F=None, Q=None, **kwargs)
¶
Bases: Estimator
Base for non-ensemble estimators that own an explicit mean and covariance (e.g., KF, UKF).
Unlike EnsembleEstimator, the mean \(\boldsymbol{\psi}\) and covariance
\(\mathbf{C}_{\psi\psi}\) live on the estimator itself; the (optional) model is
only used to advance the mean in time. With model=None the mean is advanced
by the linear map F instead, one application per step, and current_time
counts steps.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
N
|
int
|
State dimension. |
required |
Nq
|
int
|
Observable dimension. |
required |
Cdd
|
(ndarray, shape(Nq, Nq))
|
Default observation-noise covariance. |
required |
psi0
|
(ndarray, shape(N))
|
Initial state mean. |
required |
Cpp0
|
(ndarray, shape(N, N))
|
Initial state covariance \(\mathbf{C}_{\psi\psi,\,0|0}\). |
required |
M
|
ndarray, shape (Nq, N), or callable
|
Measurement operator. Defaults to |
None
|
model
|
Model
|
Nonlinear model used for the mean forecast. Either |
None
|
F
|
(ndarray, shape(N, N))
|
Linear transition matrix, used instead of |
None
|
Q
|
(ndarray, shape(N, N))
|
Process-noise covariance added at every covariance propagation (defaults to zeros). |
None
|
Source code in src/estimators/deterministic.py
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 | |
current_state
property
¶
Current mean estimate (owned by the estimator, not the model).
Cpp
property
¶
Current state covariance (forecast after forecast_step, posterior after analysis_step).
forecast_step(t_end=None, **kwargs)
¶
Advance the state mean: via the model if present, else via F.
With a model, this delegates to Estimator.forecast_step (which
advances the model history) and then refreshes the mean from the
model's current state. Without a model, F is applied Nt times
(default 1) and current_time counts steps; t_end is not supported.
Source code in src/estimators/deterministic.py
114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 | |
romda.estimators.KalmanFilter(*, F_jac=None, **kwargs)
¶
Bases: DeterministicEstimator
Exact linear (or linearized) Kalman filter.
Implements the standard two-step KF recursion. All DeterministicEstimator
parameters apply, plus:
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
F_jac
|
(ndarray, shape(N, N))
|
Jacobian of the forecast map over ONE model step, used to propagate the
covariance (applied once per step spanned by each |
None
|
Notes
Predict (mean via F or model.time_integrate, covariance via F_jac):
Update:
Source code in src/estimators/deterministic.py
190 191 192 193 194 195 196 197 198 199 200 | |
forecast_step(t_end=None, **kwargs)
¶
KF prediction step.
Advances the state mean via model.time_integrate or \(\mathbf{F}\boldsymbol{\psi}\),
then propagates the covariance once per model step spanned:
\(\mathbf{C}^\mathrm{f}_{\psi\psi} = \mathbf{F}_\mathrm{jac}\,\mathbf{C}_{\psi\psi,\,k-1|k-1}\,\mathbf{F}_\mathrm{jac}^\mathrm{T} + \mathbf{Q}\).
Source code in src/estimators/deterministic.py
204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 | |
analysis_step(d, Cdd, return_analysis=False)
¶
Kalman update step.
\(\mathbf{S} = \mathbf{M}\mathbf{C}^\mathrm{f}_{\psi\psi}\mathbf{M}^\mathrm{T} + \mathbf{C}_{dd}\), \(\mathbf{K} = \mathbf{C}^\mathrm{f}_{\psi\psi}\mathbf{M}^\mathrm{T}\mathbf{S}^{-1}\), \(\boldsymbol{\psi}^\mathrm{a} = \boldsymbol{\psi}^\mathrm{f} + \mathbf{K}(\mathbf{d} - \mathbf{M}\boldsymbol{\psi}^\mathrm{f})\), \(\mathbf{C}^\mathrm{a}_{\psi\psi} = (\mathbb{I} - \mathbf{K}\mathbf{M})\,\mathbf{C}^\mathrm{f}_{\psi\psi}\).
When a model is present, the analysed mean is written back into the
model history so the next forecast_step starts from the analysis.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
d
|
(ndarray, shape(Nq))
|
Observation vector. |
required |
Cdd
|
(ndarray, shape(Nq, Nq))
|
Observation-noise covariance. |
required |
Returns:
| Type | Description |
|---|---|
(ndarray, shape(N))
|
Posterior mean \(\boldsymbol{\psi}_{k|k}\), only if |
Source code in src/estimators/deterministic.py
242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 | |