gedai.gedai.MultibandGedai🔗
- class gedai.gedai.MultibandGedai(wavelet_type='haar', wavelet_level=8)[source]🔗
Multiband Generalized Eigenvalue De-Artifacting Instrument.
A multiband extension of the standard
Gedaithat applies GEDAI algorithm separately to different frequency bands (via wavelet decomposition). This approach allows for more targeted artifact removal while preserving neural signals. See [1].Warning
For EEG channels, Gedai will set average reference internally to match the leadfield covariance reference. Gedai will not modify the input data in-place, but will create copies when necessary to ensure the original data remains unchanged.
- Parameters:
- wavelet_type
str Wavelet to use for the decomposition. The default is
'haar'. Seepywt.wavedec()for the list of available wavelets.- wavelet_level
int Wavelet decomposition level. Must be greater than
0. The default is4.
- wavelet_type
Attributes
Get the channel names used during fitting.
Methods
fit_epochs(epochs[, picks, reference_cov, ...])Fit the GEDAI model to the epochs data.
fit_raw(raw[, picks, duration, overlap, ...])Fit the GEDAI model to the raw data.
plot_fit()Plot the fitting results.
transform_epochs(epochs[, n_jobs, verbose])Transform epochs data using the fitted model.
transform_raw(raw[, overlap, n_jobs, verbose])Transform raw data using the fitted model.
References
- fit_epochs(epochs, picks='eeg', reference_cov='leadfield', sensai_method='optimize', noise_multiplier=3.0, wavelet_low_cutoff='auto', n_jobs=None, verbose=None)[source]🔗
Fit the GEDAI model to the epochs data.
- Parameters:
- epochs
mne.Epochs The epochs data to fit the model to.
- picks
str|list|slice Channels to include. Note that all channels selected must have the same type. Slices and lists of integers will be interpreted as channel indices. In lists, channel name strings (e.g.
['Fp1', 'Fp2']) will pick the given channels. Can also be the string values"all"to pick all channels, or"data"to pick data channels. The default is"eeg"to pick all EEG channels.- reference_cov
str|mne.Covariance The reference covariance to use. If
'leadfield', use a pre-computed covariance. The precomputed covariance if computed from a leadfield made using 1005 EEG channels layout and fsaverage head model. Ifmne.Covariance, use a pre-computed covariance. Seecompute_covariance_from_forward()for more details on how to compute a covariance from a forward solution.- sensai_method
str The method to use for threshold optimization. Can be
'gridsearch'or'optimize'. The default is'optimize'.- noise_multiplier
float The noise multiplier to use for artefact threshold rejection optimization.
- wavelet_low_cutoff
float|None If a float is provided, zero out all wavelet levels whose upper frequency bound is below this cutoff frequency in Hz. If
None, no frequency band is zeroed out. If"auto", the cutoff is automatically determined based on the info[‘highpass’] value of the fitted instance. While reading data from a file, info[‘highpass’] might be missing (i.e., equal to 0.0). If you know that your data has been high-pass filtered, make sure to setwavelet_low_cutoffto the high-pass cutoff frequency. The default is"auto".- n_jobs
int|None The number of jobs to run in parallel. If
-1, use all available CPU cores. If1orNone, computations are run serially.- verbose
int|str|bool|None Sets the verbosity level. The verbosity increases gradually between
"CRITICAL","ERROR","WARNING","INFO"and"DEBUG". If None is provided, the verbosity is set to"WARNING". If a bool is provided, the verbosity is set to"WARNING"for False and to"INFO"for True.
- epochs
- fit_raw(raw, picks='eeg', duration=1.0, overlap=0.75, reject_by_annotation=False, reference_cov='leadfield', sensai_method='optimize', noise_multiplier=3.0, wavelet_low_cutoff='auto', n_jobs=None, verbose=None)[source]🔗
Fit the GEDAI model to the raw data.
- Parameters:
- raw
mne.io.BaseRaw The raw data to fit the model to.
- picks
str|list|slice Channels to include. Note that all channels selected must have the same type. Slices and lists of integers will be interpreted as channel indices. In lists, channel name strings (e.g.
['Fp1', 'Fp2']) will pick the given channels. Can also be the string values"all"to pick all channels, or"data"to pick data channels. The default is"eeg"to pick all EEG channels.- duration
float Duration of each epoch in seconds. The default is
1.0.- overlap
float The overlap ratio between consecutive epochs, between
0and1. The default is0.5(50%% overlap). For example,0.5means 50%% overlap and0.75means 75%% overlap.- reject_by_annotation
bool Whether annotated bad segments should be rejected. It is recommended to set this to
Falsefor fitting, since the algorithm needs to learn from bad segments. The default isFalse.- reference_cov
str|mne.Covariance The reference covariance to use. If
'leadfield', use a pre-computed covariance. The precomputed covariance if computed from a leadfield made using 1005 EEG channels layout and fsaverage head model. Ifmne.Covariance, use a pre-computed covariance. Seecompute_covariance_from_forward()for more details on how to compute a covariance from a forward solution.- sensai_method
str The method to use for threshold optimization. Can be
'gridsearch'or'optimize'. The default is'optimize'.- noise_multiplier
float The noise multiplier to use for artefact threshold rejection optimization.
- wavelet_low_cutoff
float|None If a float is provided, zero out all wavelet levels whose upper frequency bound is below this cutoff frequency in Hz. If
None, no frequency band is zeroed out. If"auto", the cutoff is automatically determined based on the info[‘highpass’] value of the fitted instance. While reading data from a file, info[‘highpass’] might be missing (i.e., equal to 0.0). If you know that your data has been high-pass filtered, make sure to setwavelet_low_cutoffto the high-pass cutoff frequency. The default is"auto".- n_jobs
int|None The number of jobs to run in parallel. If
-1, use all available CPU cores. If1orNone, computations are run serially.- verbose
int|str|bool|None Sets the verbosity level. The verbosity increases gradually between
"CRITICAL","ERROR","WARNING","INFO"and"DEBUG". If None is provided, the verbosity is set to"WARNING". If a bool is provided, the verbosity is set to"WARNING"for False and to"INFO"for True.
- raw
- plot_fit()[source]🔗
Plot the fitting results.
- Returns:
- figs
listofmatplotlib.figure.Figure A list of figures showing the fitting results for each wavelet band that was not ignored.
- figs
- transform_epochs(epochs, n_jobs=None, verbose=None)[source]🔗
Transform epochs data using the fitted model.
- Parameters:
- epochs
mne.Epochs The epochs to transform.
- n_jobs
int|None The number of jobs to run in parallel. If
-1, use all available CPU cores. If1orNone, computations are run serially.- verbose
int|str|bool|None Sets the verbosity level. The verbosity increases gradually between
"CRITICAL","ERROR","WARNING","INFO"and"DEBUG". If None is provided, the verbosity is set to"WARNING". If a bool is provided, the verbosity is set to"WARNING"for False and to"INFO"for True.
- epochs
- Returns:
- epochs
mne.Epochs The transformed epochs.
- epochs
- transform_raw(raw, overlap=0.75, n_jobs=None, verbose=None)[source]🔗
Transform raw data using the fitted model.
- Parameters:
- raw
mne.io.BaseRaw The raw data to fit the model to.
- overlap
float The overlap ratio between consecutive epochs, between
0and1. The default is0.5(50%% overlap). For example,0.5means 50%% overlap and0.75means 75%% overlap.- n_jobs
int|None The number of jobs to run in parallel. If
-1, use all available CPU cores. If1orNone, computations are run serially.- verbose
int|str|bool|None Sets the verbosity level. The verbosity increases gradually between
"CRITICAL","ERROR","WARNING","INFO"and"DEBUG". If None is provided, the verbosity is set to"WARNING". If a bool is provided, the verbosity is set to"WARNING"for False and to"INFO"for True.
- raw
- Returns:
- raw_corrected
mne.io.BaseRaw The corrected raw data.
- raw_corrected