mne_rt.tools.ORICA#
- class mne_rt.tools.ORICA(n_channels: int, learning_rate: float = 0.1, block_size: int = 256, online_whitening: bool = True, calibrate_pca: bool = False, forgetfac: float = 1.0, nonlinearity: str = 'tanh', random_state: int | None = None)[source]#
Bases:
objectOnline Recursive ICA (ORICA) for EEG data.
- Parameters:
- n_channels
int Number of input EEG channels.
- learning_rate
float Learning rate for ICA updates.
- block_size
int Size of blocks for online updates.
- online_whiteningbool
If True, perform online whitening. If False, assumes input is already whitened.
- calibrate_pcabool
If True, estimate whitening matrix from the first block and fix it. If False, update recursively.
- forgetfac
float Forgetting factor for online covariance (0 < forgetfac <= 1). Values < 1 allow adaptation to nonstationary signals.
- nonlinearity
str Nonlinearity:
"tanh","pow3", or"gauss".- random_state
int|None Seed for reproducibility.
- n_channels
- __init__(n_channels: int, learning_rate: float = 0.1, block_size: int = 256, online_whitening: bool = True, calibrate_pca: bool = False, forgetfac: float = 1.0, nonlinearity: str = 'tanh', random_state: int | None = None) None[source]#
Methods
__init__(n_channels[, learning_rate, ...])denoise(X, artifact_idx)Remove specific ICs and reconstruct sensor data.
find_blink_ic(template_map[, threshold])Identify ICs corresponding to blinks by template correlation.
Fit on X and return estimated sources.
Reconstruct sensor-space data from source signals.
partial_fit(X)Update the unmixing matrix with a new block of EEG data.
transform(X)Project data to source space without updating W.
update_and_denoise(X, template_map[, threshold])Fit one block, detect blinks by template, and return cleaned data.
- partial_fit(X: ndarray) ORICA[source]#
Update the unmixing matrix with a new block of EEG data.
- Parameters:
- X
ndarray,shape(n_channels,n_samples) EEG data block.
- X
- Returns:
self
- fit_transform(X: ndarray) ndarray[source]#
Fit on X and return estimated sources.
Equivalent to
partial_fit(X)followed bytransform(X).
- inverse_transform(S: ndarray) ndarray[source]#
Reconstruct sensor-space data from source signals.
Applies the full inverse pipeline:
X_rec = whitening_inv_ @ pinv(W) @ S + mean_
- find_blink_ic(template_map: ndarray, threshold: float = 0.7) tuple[list[int], ndarray][source]#
Identify ICs corresponding to blinks by template correlation.
- denoise(X: ndarray, artifact_idx: list[int]) ndarray[source]#
Remove specific ICs and reconstruct sensor data.