Result types¶
Every estimator in sid returns a frozen dataclass. The dataclasses are
re-exported from the top-level sid namespace, but their definitions live in
sid._results.
CompareResult¶
CompareResult
dataclass
¶
Result from model output comparison (compare).
Contains the predicted and measured outputs, the NRMSE fit metric per channel, and the residual.
fit
instance-attribute
¶
NRMSE fit percentage per channel, shape (ny,).
100% = perfect, 0% = no better than mean predictor.
FreqMapResult¶
FreqMapResult
dataclass
¶
FreqMapResult(time: ndarray, frequency: ndarray, frequency_hz: ndarray, response: ndarray | None, response_std: ndarray | None, noise_spectrum: ndarray, noise_spectrum_std: ndarray, coherence: ndarray | None, sample_time: float, segment_length: int, overlap: int, window_size: int | None, algorithm: str, num_trajectories: int | ndarray, method: str)
Result from time-varying frequency response map (freq_map).
response
instance-attribute
¶
Time-varying frequency response, shape (nf, K) or (nf, K, ny, nu).
None in time-series mode.
response_std
instance-attribute
¶
Standard deviation of response, same shape.
noise_spectrum
instance-attribute
¶
Time-varying noise spectrum, shape (nf, K) or (nf, K, ny, ny).
noise_spectrum_std
instance-attribute
¶
Standard deviation of noise spectrum.
coherence
instance-attribute
¶
Squared coherence, shape (nf, K). SISO only; None otherwise.
num_trajectories
instance-attribute
¶
Number of trajectories used.
Scalar int when every segment uses the same number of
trajectories (uniform-length input, or variable-length input where
all trajectories happen to span every segment). A (K,) ndarray
of intp values otherwise — one entry per segment, giving the
number of trajectories that spanned that segment (SPEC.md §6.8).
FreqResult¶
FreqResult
dataclass
¶
FreqResult(frequency: ndarray, frequency_hz: ndarray, response: ndarray | None, response_std: ndarray | None, noise_spectrum: ndarray, noise_spectrum_std: ndarray, coherence: ndarray | None, sample_time: float, window_size: int | ndarray, data_length: int, num_trajectories: int, method: str)
Result from frequency-domain estimation (freq_bt, freq_etfe, freq_btfdr).
All array shapes shown for the SISO case. For MIMO, response has
shape (nf, ny, nu) and noise_spectrum has shape (nf, ny, ny).
response
instance-attribute
¶
Complex frequency response, shape (nf,) or (nf, ny, nu).
None in time-series mode.
response_std
instance-attribute
¶
Standard deviation of response, same shape. None in time-series mode.
noise_spectrum
instance-attribute
¶
Noise (or output) power spectrum, shape (nf,) or (nf, ny, ny).
noise_spectrum_std
instance-attribute
¶
Standard deviation of noise_spectrum, same shape.
coherence
instance-attribute
¶
Squared coherence, shape (nf,). SISO only; None for MIMO or time-series.
window_size
instance-attribute
¶
Lag window size M (scalar for BT/ETFE, array for BTFDR).
method
instance-attribute
¶
Estimation method identifier ('freq_bt', 'freq_etfe', 'freq_btfdr').
FrozenResult¶
FrozenResult
dataclass
¶
FrozenResult(frequency: ndarray, frequency_hz: ndarray, time_steps: ndarray, response: ndarray, response_std: ndarray | None, sample_time: float, method: str)
Result from frozen transfer function computation (ltv_disc_frozen).
Contains the instantaneous (frozen) frequency response G(w, k) computed from time-varying state-space matrices A(k), B(k), along with optional uncertainty propagation.
time_steps
instance-attribute
¶
Selected time step indices (0-based), shape (nk,).
response
instance-attribute
¶
Complex frozen transfer function, shape (nf, p, q, nk).
response_std
instance-attribute
¶
Standard deviation of response, shape (nf, p, q, nk).
None when the input LTVResult has no uncertainty.
LTVIOResult¶
LTVIOResult
dataclass
¶
LTVIOResult(a: ndarray, b: ndarray, x: ndarray | list, h: ndarray, r: ndarray, cost: ndarray, iterations: int, lambda_: ndarray, data_length: int, state_dim: int, output_dim: int, input_dim: int, num_trajectories: int, a_std: ndarray | None, b_std: ndarray | None, p_cov: ndarray | None, noise_cov: ndarray | None, noise_cov_estimated: bool | None, noise_variance: float | None, degrees_of_freedom: float | None, algorithm: str, method: str)
Result from LTV input-output identification (ltv_disc_io).
Contains the identified time-varying system matrices A(k), B(k),
estimated state trajectories, and optional Bayesian uncertainty
estimates. All array shapes use the convention (rows, cols, time)
consistent with MATLAB's (:, :, k) indexing.
x
instance-attribute
¶
Estimated state trajectories, shape (N+1, n, L) or list of
(N_l+1, n) arrays for variable-length trajectories.
a_std
instance-attribute
¶
Standard deviation of a entries, shape (n, n, N).
None when uncertainty was not computed.
b_std
instance-attribute
¶
Standard deviation of b entries, shape (n, q, N).
None when uncertainty was not computed.
p_cov
instance-attribute
¶
Row-wise posterior covariance blocks, shape (d, d, N) where
d = n + q. None when uncertainty was not computed.
noise_cov
instance-attribute
¶
Noise covariance matrix, shape (n, n).
None when uncertainty was not computed.
noise_cov_estimated
instance-attribute
¶
True if noise_cov was estimated from residuals.
None when uncertainty was not computed.
noise_variance
instance-attribute
¶
Scalar noise variance trace(noise_cov) / n.
None when uncertainty was not computed.
degrees_of_freedom
instance-attribute
¶
Effective degrees of freedom used in noise covariance estimation.
None when uncertainty was not computed.
LTVResult¶
LTVResult
dataclass
¶
LTVResult(a: ndarray, b: ndarray, a_std: ndarray | None, b_std: ndarray | None, p_cov: ndarray | None, noise_cov: ndarray | None, noise_cov_estimated: bool | None, noise_variance: float | None, degrees_of_freedom: float | None, lambda_: ndarray, cost: ndarray, data_length: int, state_dim: int, input_dim: int, num_trajectories: int, algorithm: str, preconditioned: bool | str, method: str)
Result from LTV state-space identification (ltv_disc).
Contains the identified time-varying system matrices A(k), B(k) and
optional Bayesian uncertainty estimates. All array shapes use the
convention (rows, cols, time) consistent with MATLAB's
(:, :, k) indexing.
a_std
instance-attribute
¶
Standard deviation of a entries, shape (p, p, N).
None when uncertainty was not requested.
b_std
instance-attribute
¶
Standard deviation of b entries, shape (p, q, N).
None when uncertainty was not requested.
p_cov
instance-attribute
¶
Row-wise posterior covariance blocks, shape (d, d, N) where
d = p + q. None when uncertainty was not requested.
noise_cov
instance-attribute
¶
Noise covariance matrix, shape (p, p).
None when uncertainty was not requested.
noise_cov_estimated
instance-attribute
¶
True if noise_cov was estimated from residuals,
False if user-provided. None when uncertainty was not
requested.
noise_variance
instance-attribute
¶
Scalar noise variance trace(noise_cov) / p.
None when uncertainty was not requested.
degrees_of_freedom
instance-attribute
¶
Effective degrees of freedom used in noise covariance estimation.
NaN when noise_cov was user-provided. None when
uncertainty was not requested.
preconditioned
instance-attribute
¶
Whether block-diagonal preconditioning was applied.
False when not requested, 'not_implemented' when requested
but disabled (v1.0), or True when implemented and applied.
ResidualResult¶
ResidualResult
dataclass
¶
ResidualResult(residual: ndarray, auto_corr: ndarray, auto_corr_all: ndarray, cross_corr: ndarray, confidence_bound: float, whiteness_pass: bool, whiteness_pass_all: ndarray, independence_pass: bool, independence_pass_all: ndarray | None, data_length: int)
Result from residual analysis (residual).
Contains the model residuals, normalised auto- and cross-correlation functions, and whiteness/independence diagnostic test outcomes.
auto_corr
instance-attribute
¶
Normalised autocorrelation of the first output channel,
shape (max_lag + 1,).
auto_corr_all
instance-attribute
¶
Per-channel normalised autocorrelation, shape (max_lag + 1, ny).
cross_corr
instance-attribute
¶
Normalised cross-correlation between residuals and inputs,
shape (2 * max_lag + 1, ny * nu). Empty array for time-series.
whiteness_pass
instance-attribute
¶
True if all channels pass the whiteness test.
whiteness_pass_all
instance-attribute
¶
Per-channel whiteness test result, shape (ny,).
independence_pass
instance-attribute
¶
True if all (output, input) pairs pass the independence test.
independence_pass_all
instance-attribute
¶
Per-pair independence test result, shape (ny * nu,).
None for time-series mode.
SpectrogramResult¶
SpectrogramResult
dataclass
¶
SpectrogramResult(time: ndarray, frequency: ndarray, frequency_rad: ndarray, power: ndarray, power_db: ndarray, complex_stft: ndarray, sample_time: float, window_length: int, overlap: int, nfft: int, num_trajectories: int, method: str)
Exceptions¶
SidError ¶
Bases: Exception
Base exception for sid toolbox errors.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
code
|
str
|
Machine-readable error code (e.g. |
required |
message
|
str
|
Human-readable error description. |
required |
Attributes:
| Name | Type | Description |
|---|---|---|
code |
str
|
The error code passed at construction time. |