eegprep.eeg_interp#

eegprep.eeg_interp(EEG, bad_chans, method='spherical', t_range=None, params=None, dtype='float32')#

Interpolate missing or bad EEG channels using spherical spline.

interpolation.

Parameters#

EEGdict

EEG data structure with ‘data’, ‘chanlocs’, ‘nbchan’, etc.

bad_chanslist, array-like, or list of dicts

Can be one of: - List of channel names (strings): e.g., [‘Fp1’, ‘Fp2’] - List of channel indices (integers): e.g., [0, 1, 2] - List of chanloc structures (dicts): e.g., [{‘labels’: ‘T7’, ‘X’: 0.8, ‘Y’: 0.0, ‘Z’: 0.6}, …]

When chanloc structures are provided, the function supports three modes: 1. If chanlocs are identical to EEG[‘chanlocs’], returns data unchanged 2. If no overlap with existing channels, appends new channels and interpolates them 3. If existing channels are a subset, remaps data to new channel structure

methodstr, optional

Interpolation method (‘spherical’, ‘sphericalKang’, ‘sphericalCRD’, ‘sphericalfast’)

t_rangetuple, optional

Time range for interpolation

paramstuple, optional

Method-specific parameters

dtype: str | dtype, optional

Optionally the precision in which to perform the computation; * ‘float32’ : matches MATLAB, but limits precision (default) * ‘float64’: operate at full precision; requires twice the memory

Returns#

EEGdict

Updated EEG structure with interpolated channels