gedai.gedai.AdaptiveMultibandGedai🔗
- class gedai.gedai.AdaptiveMultibandGedai(wavelet_type='haar', wavelet_level=8, cycles_per_wavelet=12)[source]🔗
Adaptive Multiband Generalized Eigenvalue De-Artifacting Instrument.
A extension of
MultibandGedaithat uses adaptive window lengths for each wavelet band to ensure wavelet decomposition has enough cycles for accurate decomposition.See [1].
Note
Since different epoch lengths are used for each wavelet band, it is not possible to fit the model using
Epochs. If you want to use epochs, consider usingMultibandGedaiinstead, which uses fixed epoch lengths across all wavelet bands.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.- cycles_per_wavelet
int Minimum number of cycles targeted per wavelet band. Lower-frequency bands use longer epochs to satisfy this target. The default is
12.
- wavelet_type
Attributes
Get the channel names used during fitting.
Methods
fit_raw(raw[, picks, overlap, ...])Fit the model to raw data.
plot_fit()Plot the fitting results.
transform_raw(raw[, overlap, n_jobs, verbose])Transform raw data using the fitted model.
References
- fit_raw(raw, picks='eeg', 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 model to 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.- 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.
- figs
- 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