mne_denoise.ssa.SingularSpectrumAnalysis#
- class mne_denoise.ssa.SingularSpectrumAnalysis(sfreq: float | None = None, window_length: int | None = None, drop_freq_max: float = 3.0, drop_band: tuple[float, float] | None = None, n_check: int | None = None, max_window: int = 100, verbose: bool | str | int | None = None, *, window_seconds: float | None = None)[source]#
Frequency-guided per-channel Basic SSA transformer.
- Parameters:
sfreq (float | None, default=None) – Sampling frequency in Hz. NumPy input requires an explicit value. MNE input supplies it from metadata and must agree with an explicit value.
window_length (int | None, default=None) – Embedding dimension in samples. It is mutually exclusive with
window_seconds. None selects an automatic value.drop_freq_max (float, default=3.0) – Reject components whose dominant frequency is at or below this value in Hz.
drop_band (tuple of float | None, default=None) – Inclusive
(low, high)dominant-frequency rejection band in Hz. If supplied, it replacesdrop_freq_maxas the component-selection interval.n_check (int | None, default=None) – Restrict selection to this many leading numerical-rank components. None examines every numerical-rank component.
max_window (int, default=100) – Maximum embedding dimension used by automatic window selection.
verbose (bool | str | int | None, default=None) – MNE-style logging level.
window_seconds (float | None, default=None) – Embedding duration in seconds, mutually exclusive with
window_length.
- ch_names_in_#
Fitted MNE channel names and order, or None for NumPy input.
- diagnostics_#
Diagnostics from the most recent transformation. Epoched input stores one dictionary per epoch.
- dropped_counts_#
Number of rejected components per channel, or per epoch and channel.
- Type:
ndarray
See also
compute_basic_ssaFunctional interface for channel-first arrays.
ssa_clean_channelCanonical single-channel implementation.
ssa_decomposeComplete additive Basic SSA decomposition.
mne_denoise.ssa.LocalSingularSpectrumAnalysisLocal clustered SSA.
Notes
The estimator is transductive.
fitvalidates the operating point and records the channel layout; everytransformdecomposes the records supplied to that call. Changing record or epoch boundaries can therefore change the trajectory matrix, Fourier bins, and selected components. The additive decomposition follows Basic SSA [1]; dominant-frequency rejection is an application-specific grouping rule.Examples
>>> import numpy as np >>> from mne_denoise.ssa import SingularSpectrumAnalysis >>> sfreq = 100.0 >>> time = np.arange(500) / sfreq >>> data = np.vstack( ... [np.sin(2 * np.pi * 1.0 * time), np.sin(2 * np.pi * 10.0 * time)] ... ) >>> model = SingularSpectrumAnalysis(sfreq=sfreq, drop_freq_max=3.0) >>> cleaned = model.fit_transform(data) >>> cleaned.shape (2, 500)
References
[1]Golyandina, N., & Zhigljavsky, A. (2013). Singular Spectrum Analysis for Time Series. Springer. https://doi.org/10.1007/978-3-642-34913-3
- __init__(sfreq: float | None = None, window_length: int | None = None, drop_freq_max: float = 3.0, drop_band: tuple[float, float] | None = None, n_check: int | None = None, max_window: int = 100, verbose: bool | str | int | None = None, *, window_seconds: float | None = None) None[source]#
Methods
__init__([sfreq, window_length, ...])fit(X[, y])Validate the operating point and record the fitted channel layout.
fit_transform(X[, y])Fit to data, then transform it.
get_metadata_routing()Get metadata routing of this object.
get_params([deep])Get parameters for this estimator.
set_output(*[, transform])Set output container.
set_params(**params)Set the parameters of this estimator.
transform(X[, y])Apply the transductive SSA decomposition to the supplied records.