Overflow error when trying to read GDF

MNE Version 1.8.0
OS Ubuntu 24.04.1 LTS

Hello

I am trying to read a GDF file for a MI run from Ofner 2017 dataset Upper limb movements can be decoded from the time-domain of low-frequency EEG

When i try to load a single gdf file in, i get the following error:

File "/home/groenborg/venv/lib/python3.12/site-packages/mne/io/edf/edf.py", line 1901, in read_raw_gdf
    return RawGDF(
           ^^^^^^^
  File "<decorator-gen-204>", line 12, in __init__
  File "/home/groenborg/venv/lib/python3.12/site-packages/mne/io/edf/edf.py", line 293, in __init__
    info, edf_info, orig_units = _get_info(
                                 ^^^^^^^^^^
  File "/home/groenborg/venv/lib/python3.12/site-packages/mne/io/edf/edf.py", line 537, in _get_info
    edf_info, orig_units = _read_header(
                           ^^^^^^^^^^^^^
  File "/home/groenborg/venv/lib/python3.12/site-packages/mne/io/edf/edf.py", line 515, in _read_header
    return _read_gdf_header(fname, exclude, include), None
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/groenborg/venv/lib/python3.12/site-packages/mne/io/edf/edf.py", line 1445, in _read_gdf_header
    n_events = n_events + ne[i] * 2 ** (i * 8)
                          ~~~~~~^~~~~~~~~~~~~~
OverflowError: Python integer 256 out of bounds for uint8

My code currently looks like this:

path_to_gdf = "Data/S06_MI/motorimagination_subject6_run4.gdf"
raw = mne.io.read_raw_gdf(path_to_gdf, eog=['EOG left','EOG middle','EOG right'],exclude=(65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96))
events = mne.events_from_annotations(raw)

I thought it would work by exluding all the sensor channels (Exoskeleton and glove sensors) but i get the same error and i have no clue why. I’m very new to MNE in general but could not find anything in the documentation. It does say “GDF file detected” but then it ends with that error.

I think this issue has already been reported here:

@Groenborg14 can you please post the output of mne.sys_info()?

I couldn’t find a definitive answer in that post though i may be overlooking something. Here is the output:

Platform             Linux-6.8.0-47-generic-x86_64-with-glibc2.39
Python               3.12.3 (main, Sep 11 2024, 14:17:37) [GCC 13.2.0]
Executable           /home/groenborg/venv/bin/python
CPU                  x86_64 (12 cores)
Memory               Unavailable (requires "psutil" package)
Core
├☑ mne               1.8.0 (latest release)
├☑ numpy             2.1.2 (unknown linalg bindings (threadpoolctl module not found: No module named 'threadpoolctl'))
├☑ scipy             1.14.1
└☑ matplotlib        3.9.2 (backend=agg)

Numerical (optional)
└☐ unavailable       sklearn, numba, nibabel, nilearn, dipy, openmeeg, cupy, pandas, 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

It is the exact same version as the other person so could very well be the same issue.

I can confirm this problem, which is caused by our GDF reader being incompatible with NumPy >= 2. I’ve opened an issue here. In the meantime, you can downgrade NumPy to e.g. 1.26.4, which fixes this issue.

Roger that, thank you very much!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.