mismatching between channel names and types when read_raw_eeglab


When importing data from EEGLab, there is the possibility of mismatching between channel names and types (for example the type of ECG channels are set as EEG). We need first to check them and in case of mismatching, it can be solved following the code below:

raw = mne.io.read_raw_eeglab(file_to_open, eog = 'auto')

# --- Check types of Channels ---

ch_name_type = dict(zip(raw.ch_names, raw.get_channel_types()))

ch_name_ecg = [name for name in raw.ch_names if name in 'ECG']
dict_ecg = {sub[0] : 'ecg' for sub in (ele.split() for ele in ch_name_ecg)}

Hello @sadafmoaveninejad and welcome to the forum!

I’m not sure if the EEGLAB format provides the metadata necessary to determine the type of a channel when we read it. @sappelhoff and @cbrnr, are you aware of this limitation?

Best wishes

Not sure about it either :thinking:

I don’t know. I would assume that, if at all, it has to be in EEG.chaninfo, which unfortunately does not seem to be documented. I don’t have a real file to check what’s actually contained in that field, but it should be easy enough to check. It could also be stored in EEG.chans, as indicated by this check.

1 Like