API Reference#

This section contains the complete API documentation for eegprep. The API is organized into logical modules covering core functionality, preprocessing, independent component analysis, signal processing, input/output operations, and utility functions.

Core Classes#

eegprep.EEGobj(EEG_or_path)

Wrapper class for EEG datasets stored as dictionaries.

Data Loading and Saving#

eegprep.pop_loadset([file_path])

Load EEGLAB dataset from .set or .mat file.

eegprep.loadset(*args, **kwargs)

Wrap pop_loadset.

eegprep.pop_loadset_h5(file_name)

Load EEG data from HDF5 file.

eegprep.pop_saveset(EEG, file_name)

Save EEG data to file.

eegprep.pop_load_frombids(filename, *[, ...])

Load an EEG data file of a supported format from a BIDS dataset.

Preprocessing Functions#

Artifact Removal#

eegprep.clean_artifacts(EEG[, ...])

All-in-one artifact removal, port of MATLAB clean_artifacts.

eegprep.clean_asr(EEG[, cutoff, window_len, ...])

Run the Artifact Subspace Reconstruction (ASR) method on EEG data.

eegprep.clean_flatlines(EEG[, ...])

Remove (near-) flat-lined channels.

eegprep.clean_drifts(EEG[, transition, ...])

Remove drifts from the data using a forward-backward high-pass filter.

eegprep.clean_windows(EEG[, ...])

Remove periods with abnormally high-power content from continuous data.

Channel Operations#

eegprep.clean_channels(EEG[, ...])

Remove channels with problematic data from a continuous data set.

eegprep.clean_channels_nolocs(EEG[, ...])

Remove channels with abnormal data from a continuous data set.

eegprep.eeg_interp(EEG, bad_chans[, method, ...])

Interpolate missing or bad EEG channels using spherical spline.

eegprep.pop_reref(EEG, ref)

Re-reference EEG data to average reference.

Signal Processing#

eegprep.pop_resample(EEG, freq[, engine])

Resample EEG data to a new sampling rate.

eegprep.pop_eegfiltnew(EEG[, locutoff, ...])

Filter EEG data using EEGLAB's pop_eegfiltnew.

eegprep.eeg_picard(EEG[, engine, posact, ...])

Perform ICA decomposition using Picard algorithm.

Independent Component Analysis#

eegprep.iclabel(EEG[, algorithm, engine])

Apply ICLabel to classify independent components.

eegprep.ICL_feature_extractor(EEG[, ...])

Extract features for ICLabel classification.

Spectral Analysis#

eegprep.eeg_rpsd(EEG[, nfreqs, pct_data])

Compute relative power spectral density for ICA components.

eegprep.eeg_autocorr(EEG[, pct_data])

Compute autocorrelation of ICA components.

eegprep.eeg_autocorr_welch(EEG[, pct_data])

Compute autocorrelation of EEG ICA components using Welch method.

eegprep.eeg_autocorr_fftw(EEG[, pct_data])

Compute autocorrelation of EEG ICA components using FFT.

Epoching and Selection#

eegprep.pop_epoch(EEG[, types, lim])

Convert a continuous EEG dataset to epoched data by extracting data epochs time locked to specified event types or event indices.

eegprep.pop_select(EEG, **kwargs)

Python port of EEGLAB's pop_select for dict-based EEG.

eegprep.eeg_eegrej(EEG, regions)

Reject EEG data segments specified by regions.

eegprep.eegrej(*args, **kwargs)

Wrap eeg_eegrej.

Visualization#

eegprep.topoplot(datavector, chan_locs, **kwargs)

Plot a 2D topographic map of EEG data.

Format Conversion#

eegprep.eeg_mne2eeg(raw)

Convert MNE Raw object to EEG data structure.

eegprep.eeg_mne2eeg_epochs(epochs, ica)

Convert MNE epochs with ICA to EEGLAB dataset format.

eegprep.eeg_eeg2mne(EEG)

Convert EEG data structure to MNE Raw object.

Utilities#

eegprep.eeg_checkset(EEG[, load_data])

Validate and set up EEG dataset structure.

eegprep.eeg_compare(eeg1, eeg2[, ...])

Compare two EEG-like structures, reporting differences to stderr.

eegprep.eeg_decodechan(chanlocs, chanstr[, ...])

Resolve channel identifiers to 0-based indices and labels.

eegprep.eeg_lat2point(lat_array, ...[, timeunit])

Convert latencies in time units (relative to per-epoch time 0) to latencies in data points assuming concatenated epochs (EEGLAB style).

eegprep.eeg_point2lat(lat_array[, ...])

Convert event latencies in data points to latencies in time units (default seconds).

eegprep.bids_list_eeg_files(root[, ...])

Return a list of all EEG raw-data files in a BIDS dataset.

eegprep.bids_preproc(root, *[, ...])

Apply data cleaning to EEG files in a BIDS dataset.

BIDS Pipeline#

eegprep.bids_preproc(root, *[, ...])

Apply data cleaning to EEG files in a BIDS dataset.

eegprep.bids_list_eeg_files(root[, ...])

Return a list of all EEG raw-data files in a BIDS dataset.

eegprep.pop_load_frombids(filename, *[, ...])

Load an EEG data file of a supported format from a BIDS dataset.

Configuration#

eegprep.EEG_OPTIONS

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2).