mne_denoise.icanclean.compute_icanclean#
- mne_denoise.icanclean.compute_icanclean(X_primary: ndarray, X_ref: ndarray, sfreq: float, mode: str = 'sliding', clean_with: str = 'X', segment_len: float = 2.0, overlap: float = 0.0, threshold: float | str = 0.7, max_reject_fraction: float = 0.5, reref_primary: bool | str = False, reref_ref: bool | str = False, stats_segment_len: float | None = None, null_random_state: int | None = None, verbose: bool | str | int | None = None, callback=None) tuple[ndarray, dict[str, Any]][source]#
Compute one iCanClean pass on continuous NumPy arrays.
- Parameters:
- X_primaryndarray, shape (n_primary, n_times)
Primary channels to clean.
- X_refndarray, shape (n_reference, n_times)
Reference channels.
- sfreqfloat
Sampling frequency in Hz.
- mode{“sliding”, “global”, “calibrated”}, default=”sliding”
CCA fitting and cleaning mode.
- clean_with{“X”, “Y”, “both”}, default=”X”
Canonical basis used for artifact regression.
- segment_lenfloat, default=2.0
Cleaning-window length in seconds for windowed modes.
- overlapfloat, default=0.0
Fractional window overlap.
- thresholdfloat or {“auto”, “null”}, default=0.7
Squared-correlation rejection threshold.
- max_reject_fractionfloat, default=0.5
Maximum fraction of components removed per window.
- reref_primarybool or str, default=False
Average-reference option for the primary CCA block.
- reref_refbool or str, default=False
Average-reference option for the reference CCA block.
- stats_segment_lenfloat or None, default=None
Optional broader statistics window for sliding mode.
- null_random_stateint or None, default=None
Seed for threshold=”null”.
- verbosebool, str, int, or None, default=None
Logging level.
- callbackcallable or None, default=None
Synchronous callback for completed window operations.
- Returns:
- X_primary_cleanndarray, shape (n_primary, n_times)
Cleaned primary data.
- qcdict
Quality-control arrays and resolved settings.
Notes
The function is array-only and transductive: the operator is estimated from the same recording it cleans. Use ICanClean for MNE containers and estimator lifecycle semantics. A high canonical correlation indicates shared variance, not artifact identity [1][2][3].
References