mne_denoise.bss_cca.BSSCCA#

class mne_denoise.bss_cca.BSSCCA(*, lag_samples: int | None = None, lag_seconds: float | None = None, sfreq: float | None = None, n_remove: int | None = None, rho_threshold: float | None = None, reject: str = 'low', threshold_on: str = 'rho', segment_len: float | None = None, overlap: float = 0.0, preserve_mean: bool = True, verbose: bool | str | int | None = None)[source]#

Reference-free BSS-CCA estimator.

The estimator learns fixed channel-space operators from the fitted data and reuses them during transform.

Parameters:
lag_samplesint or None, default=None

Positive lag in samples.

lag_secondsfloat or None, default=None

Positive lag in seconds; NumPy input then requires sfreq.

sfreqfloat or None, default=None

Sampling frequency for NumPy data.

n_removeint or None, default=None

Number of components to remove.

rho_thresholdfloat or None, default=None

Correlation threshold used instead of n_remove. Exactly one selection rule is required.

reject{“low”, “high”}, default=”low”

End of the correlation spectrum treated as artifactual.

threshold_on{“rho”, “rsq”}, default=”rho”

Scale for rho_threshold.

segment_lenfloat or None, default=None

Continuous-data block length in seconds.

overlapfloat, default=0.0

Fraction shared by neighboring blocks.

preserve_meanbool, default=True

Add the fitted channel mean after cleaning.

verbosebool, str, int, or None, default=None

Logging level.

Attributes:
cleaning_matrix_ndarray or tuple of ndarray

Fitted channel-space operator(s).

filters_ndarray

Canonical filters ordered by decreasing correlation.

patterns_ndarray

Least-squares channel patterns.

correlations_ndarray

Canonical correlations.

autocorrelations_ndarray

Signed lagged autocorrelations.

filter_asymmetry_ndarray

Canonical-filter asymmetry diagnostic.

kept_mask_ndarray of bool

Retained component mask.

training_mean_ndarray

Fitted channel mean.

spans_tuple

Block spans when segmented.

lag_samples_int

Resolved lag in samples.

See also

mne_denoise.icanclean.ICanClean

Reference-based CCA cleaning using physical or derived reference signals.

compute_bss_cca

One-shot functional interface for array data.

Notes

With segment_len set, transform requires the same number of samples used during fit. MNE Raw, Epochs, and Evoked inputs preserve their container type and channel metadata [1][2].

References

Examples

>>> import numpy as np
>>> from mne_denoise.bss_cca import BSSCCA
>>> rng = np.random.default_rng(0)
>>> data = rng.standard_normal((8, 2000))
>>> model = BSSCCA(sfreq=250.0, lag_samples=1, n_remove=1)
>>> clean = model.fit_transform(data)
fit(X: Any, y=None, *, callback=None, verbose: bool | str | int | None = None) BSSCCA[source]#

Fit the BSS-CCA operators.

Parameters:
Xarray-like or MNE Raw, Epochs, or Evoked

Data used to learn the operators.

yNone, default=None

Ignored for scikit-learn compatibility.

callbackcallable or None, default=None

Synchronous progress callback in segmented mode.

verbosebool, str, int, or None, default=None

Logging level.

Returns:
BSSCCA

The fitted estimator.

fit_transform(X: Any, y=None, *, callback=None, verbose: bool | str | int | None = None, **fit_params) Any[source]#

Fit BSS-CCA and apply the fitted operators to X.

Parameters:
Xarray-like or MNE Raw, Epochs, or Evoked

Data to fit and transform.

yNone, default=None

Ignored for scikit-learn compatibility.

callbackcallable or None, default=None

Synchronous progress callback in segmented mode.

verbosebool, str, int, or None, default=None

Logging level.

**fit_paramsdict

Reserved for scikit-learn compatibility.

Returns:
same type as X

A cleaned copy.

transform(X: Any, y=None, *, verbose: bool | str | int | None = None) Any[source]#

Apply the fitted BSS-CCA operators.

Parameters:
Xarray-like or MNE Raw, Epochs, or Evoked

Data with the fitted channel layout.

yNone, default=None

Ignored for scikit-learn compatibility.

verbosebool, str, int, or None, default=None

Logging level.

Returns:
same type as X

A cleaned copy.