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 MultibandGedai that 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 using MultibandGedai instead, 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_typestr

Wavelet to use for the decomposition. The default is 'haar'. See pywt.wavedec() for the list of available wavelets.

wavelet_levelint

Wavelet decomposition level. Must be greater than 0. The default is 4.

cycles_per_waveletint

Minimum number of cycles targeted per wavelet band. Lower-frequency bands use longer epochs to satisfy this target. The default is 12.

Attributes

ch_names

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:
rawmne.io.BaseRaw

The raw data to fit the model to.

picksstr | 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.

overlapfloat

The overlap ratio between consecutive epochs, between 0 and 1. The default is 0.5 (50%% overlap). For example, 0.5 means 50%% overlap and 0.75 means 75%% overlap.

reject_by_annotationbool

Whether annotated bad segments should be rejected. It is recommended to set this to False for fitting, since the algorithm needs to learn from bad segments. The default is False.

reference_covstr | 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. If mne.Covariance, use a pre-computed covariance. See compute_covariance_from_forward() for more details on how to compute a covariance from a forward solution.

sensai_methodstr

The method to use for threshold optimization. Can be 'gridsearch' or 'optimize'. The default is 'optimize'.

noise_multiplierfloat

The noise multiplier to use for artefact threshold rejection optimization.

wavelet_low_cutofffloat | 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 set wavelet_low_cutoff to the high-pass cutoff frequency. The default is "auto".

n_jobsint | None

The number of jobs to run in parallel. If -1, use all available CPU cores. If 1 or None, computations are run serially.

verboseint | 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.

plot_fit()[source]🔗

Plot the fitting results.

Returns:
figslist of matplotlib.figure.Figure

A list of figures showing the fitting results for each wavelet band.

transform_raw(raw, overlap=0.75, n_jobs=None, verbose=None)[source]🔗

Transform raw data using the fitted model.

Parameters:
rawmne.io.BaseRaw

The raw data to fit the model to.

overlapfloat

The overlap ratio between consecutive epochs, between 0 and 1. The default is 0.5 (50%% overlap). For example, 0.5 means 50%% overlap and 0.75 means 75%% overlap.

n_jobsint | None

The number of jobs to run in parallel. If -1, use all available CPU cores. If 1 or None, computations are run serially.

verboseint | 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.

Returns:
raw_correctedmne.io.BaseRaw

The corrected raw data.

property ch_names🔗

Get the channel names used during fitting.

Returns:
ch_nameslist of str

The channel names that were used during model fitting.