kkf.systems#
Dynamical systems module.
Defines classes and utilities for representing general dynamical systems with state transitions and measurement functions.
Functions
|
Create an additive dynamical system where noise is added to the state and observation functions. |
Classes
|
A class representing a general dynamical system with state and measurement equations. |
- class kkf.systems.DynamicalSystem(nx, ny, f, g, dist_X, dist_dyn, dist_obs, discrete_time)[source]#
Bases:
objectA class representing a general dynamical system with state and measurement equations.
This class encapsulates the dynamics, measurements, and associated probability distributions for both state and measurement noise. Can be considered as:
- Discrete time:
Dynamics: x_{k+1} = f(x_{k}) + w_{k} Measurements: y_{k} = g(x_{k}) + v_{k}
- Continous time:
Dynamics: x’(t) = f(x(t)) + w(t) Measurements: y(t) = g(x(t)) + v(t)
- Parameters:
nx (int)
ny (int)
f (Callable[[ndarray[tuple[Any, ...], dtype[float64]]], ndarray[tuple[Any, ...], dtype[float64]]])
g (Callable[[ndarray[tuple[Any, ...], dtype[float64]]], ndarray[tuple[Any, ...], dtype[float64]]])
dist_X (rv_continuous)
dist_dyn (rv_continuous)
dist_obs (rv_continuous)
discrete_time (bool)
- f#
State transition function (dynamics).
- Type:
Callable
- g#
Measurement/output function.
- Type:
Callable
- dist_X#
Probability distribution for initial states.
- Type:
rv_continuous
- dist_dyn#
Probability distribution for dynamics noise.
- Type:
rv_continuous
- dist_obs#
Probability distribution for measurement noise.
- Type:
rv_continuous
- discrete_time#
Indicates if the system is in discrete time, if False the system is in continous time.
- Type:
Notes
The functions f and g model the noise-free dynamics and measurements; the noise terms w and v are added separately (see
dynamicsandmeasurements). They should have the following signatures: - f(x: ndarray) -> ndarray - g(x: ndarray) -> ndarray where x is the state vector. Both must also accept a batch of column vectors of shape (nx, n_features), sinceKoopmanOperatorevaluates them on the full dictionary at once.- dynamics(x, w)[source]#
Apply the state transition function.
- Parameters:
x (np.ndarray) – Current state vector.
w (np.ndarray) – Process noise vector.
- Returns:
Next state vector.
- Return type:
np.ndarray
- kkf.systems.create_additive_system(nx, ny, f, g, dist_X, dist_dyn, dist_obs, N_samples, discrete_time=True)[source]#
Create an additive dynamical system where noise is added to the state and observation functions.
- Parameters:
nx (int) – Dimension of the state space.
ny (int) – Dimension of the measurement space.
f (Callable) – State transition function (with noise).
g (Callable) – Measurement function (with noise).
dist_X (rv_continuous) – Initial state distribution.
dist_dyn (rv_continuous) – Dynamics noise distribution.
dist_obs (rv_continuous) – Measurement noise distribution.
N_samples (int) – Number of samples to generate empirical mean of dynamics and observation.
discrete_time (bool, optional) – Indicates if the system is in discrete time. Default is True.
- Returns:
New dynamical system instance with additive noise.
- Return type:
Notes
The resulting system has the form: x[k+1] = f(x[k]) + w[k] y[k] = g(x[k]) + v[k] where w and v are noise terms.
Deprecated since version ``create_additive_system``: is deprecated and will be removed in a future major release. The state-dependent noise distributions it builds are incompatible with the covariance sampling used by
apply_koopman_kalman_filter(which callsdist_dyn.rvs(size=...)without a state argument). Construct aDynamicalSystemdirectly instead, providingf/gas the noise-free maps.