From 9e7fe95f99016709dcad50c9494ebce4323e4cfd Mon Sep 17 00:00:00 2001 From: Clemens Brunner Date: Mon, 3 Feb 2025 19:46:22 +0100 Subject: [PATCH] Fix EEGLAB import (nodatchans) (#13097) Co-authored-by: Eric Larson --- doc/changes/devel/13097.bugfix.rst | 1 + mne/io/eeglab/eeglab.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 doc/changes/devel/13097.bugfix.rst diff --git a/doc/changes/devel/13097.bugfix.rst b/doc/changes/devel/13097.bugfix.rst new file mode 100644 index 00000000000..02500b91027 --- /dev/null +++ b/doc/changes/devel/13097.bugfix.rst @@ -0,0 +1 @@ +Fix bug when loading certain EEGLAB files that do not contain a ``nodatchans`` field, by `Clemens Brunner`_. \ No newline at end of file diff --git a/mne/io/eeglab/eeglab.py b/mne/io/eeglab/eeglab.py index 3aa611b4e28..10e23b811a0 100644 --- a/mne/io/eeglab/eeglab.py +++ b/mne/io/eeglab/eeglab.py @@ -162,7 +162,7 @@ def _get_montage_information(eeg, get_pos, *, montage_units): ) lpa, rpa, nasion = None, None, None - if hasattr(eeg, "chaninfo") and isinstance(eeg.chaninfo["nodatchans"], dict): + if hasattr(eeg, "chaninfo") and isinstance(eeg.chaninfo.get("nodatchans"), dict): nodatchans = eeg.chaninfo["nodatchans"] types = nodatchans.get("type", []) descriptions = nodatchans.get("description", [])