Skip to content

Issue with mne.io.read_raw_eeglab in EEGLAB File Loading #13094

@balandongiv

Description

@balandongiv

Description of the problem

When using mne version 1.9.0 to load an EEGLAB .set file with mne.io.read_raw_eeglab, a KeyError: 'nodatchans' error may occur.

Steps to reproduce

Below is the code snippet that triggers the error:

import mne

file_path = "s01_061102n.set"
raw = mne.io.read_raw_eeglab(file_path, preload=True)

Below is the full error trace

Traceback (most recent call last):
  File "main.py", line 8, in <module>
    raw = mne.io.read_raw_eeglab(file_path, preload=True)
  File "...\site-packages\mne\io\eeglab\eeglab.py", line 328, in read_raw_eeglab
    return RawEEGLAB(
  File "<decorator-gen-267>", line 12, in __init__
  File "...\site-packages\mne\io\eeglab\eeglab.py", line 459, in __init__
    info, eeg_montage, _ = _get_info(eeg, eog=eog, montage_units=montage_units)
  File "...\site-packages\mne\io\eeglab\eeglab.py", line 230, in _get_info
    ch_names, ch_types, eeg_montage = _get_montage_information(
  File "...\site-packages\mne\io\eeglab\eeglab.py", line 165, in _get_montage_information
    if hasattr(eeg, "chaninfo") and isinstance(eeg.chaninfo["nodatchans"], dict):
KeyError: 'nodatchans'

Process finished with exit code 1

The output for mne.sys_info()

 + mne               1.9.0 (latest release)
 + numpy             2.2.1 (OpenBLAS 0.3.28 with 24 threads)
 + scipy             1.15.1
 + matplotlib        3.10.0 (backend=tkagg)

Numerical (optional)
 + sklearn           1.6.1
 + pandas            2.2.3
 - unavailable       numba, nibabel, nilearn, dipy, openmeeg, cupy, h5io, h5py

Visualization (optional)
 - unavailable       pyvista, pyvistaqt, vtk, qtpy, ipympl, pyqtgraph, mne-qt-browser, ipywidgets, trame_client, trame_server, trame_vtk, trame_vuetify

Ecosystem (optional)
 - unavailable       mne-bids, mne-nirs, mne-features, mne-connectivity, mne-icalabel, mne-bids-pipeline, neo, eeglabio, edfio, mffpy, pybv
None

Link to data

The file used to reproduce this issue can be downloaded from figshare.

Expected results

no error

Actual results

no error

Additional information

This issue has been highlighted at mne discourse

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions