mne.io.read_raw_edf not loading data with mne>=0.23.0

Hi, I’m new to MNE and I’ve been having issues loading data with the newer versions of MNE. At first I thought it was something in the formatting of my data (from Emotiv Epoch) despite it being perfectly readable with edfbrowser, so I downloaded a toy file from edfbrowser, but I keep getting the same issues.

  • MNE-Python version >= 0.23.0
  • numpy version: same behavior with numpy-1.21.4, numpy-1.20.3
  • operating system: OSX 12.0.1

Behavior with versions >= 0.23.0:

>>> import mne
>>> mne.__version__
'0.23.0'
>>> mne.io.read_raw_edf("/Users/neako/Downloads/eeg_recording/ma0844az_1-1+.edf")
Extracting EDF parameters from /Users/neako/Downloads/eeg_recording/ma0844az_1-1+.edf...
EDF file detected
Setting channel info structure...
Creating raw.info structure...
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/neako/anaconda3/lib/python3.7/site-packages/mne/io/edf/edf.py", line 1222, in read_raw_edf
    verbose=verbose)
  File "<decorator-gen-197>", line 24, in __init__
  File "/Users/neako/anaconda3/lib/python3.7/site-packages/mne/io/edf/edf.py", line 137, in __init__
    description=desc, orig_time=None))
  File "<decorator-gen-183>", line 24, in set_annotations
  File "/Users/neako/anaconda3/lib/python3.7/site-packages/mne/io/base.py", line 661, in set_annotations
    new_annotations.crop(0, self.times[-1] + delta,
  File "/Users/neako/anaconda3/lib/python3.7/site-packages/mne/io/base.py", line 1580, in times
    out = _arange_div(self.n_times, float(self.info['sfreq']))
TypeError: expected dtype object, got 'numpy.dtype[float64]'

Previous behavior: there was an issue when using the function read_info but it wasn’t blocking the reading of data, info was still read when reading the file. Also the error is different.

>>> import mne
>>> mne.__version__
'0.22.1'
>>> mne.io.read_info("/Users/neako/Downloads/eeg_recording/ma0844az_1-1+.edf")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<decorator-gen-25>", line 24, in read_info
  File "/Users/neako/anaconda3/lib/python3.7/site-packages/mne/io/meas_info.py", line 917, in read_info
    f, tree, _ = fiff_open(fname)
  File "<decorator-gen-6>", line 24, in fiff_open
  File "/Users/neako/anaconda3/lib/python3.7/site-packages/mne/io/open.py", line 127, in fiff_open
    return _fiff_open(fname, fid, preload)
  File "/Users/neako/anaconda3/lib/python3.7/site-packages/mne/io/open.py", line 145, in _fiff_open
    raise ValueError('file does not start with a file id tag')
ValueError: file does not start with a file id tag
>>> s = mne.io.read_raw_edf("/Users/neako/Downloads/eeg_recording/ma0844az_1-1+.edf", preload=True)
Extracting EDF parameters from /Users/neako/Downloads/eeg_recording/ma0844az_1-1+.edf...
EDF file detected
Setting channel info structure...
Creating raw.info structure...
Reading 0 ... 363619  =      0.000 ...  1818.095 secs...
>>> s.info
<Info | 7 non-empty values
 bads: []
 ch_names: EEG FP1, EEG FP2, EEG F3, EEG F4, EEG C3, EEG C4, EEG P3, EEG ...
 chs: 37 EEG
 custom_ref_applied: False
 highpass: 0.0 Hz
 lowpass: 100.0 Hz
 meas_date: 2005-09-15 10:18:42 UTC
 nchan: 37
 projs: []
 sfreq: 200.0 Hz
>

can you share the file with us?

thx
A

The file I mention in the example I downloaded from this link:
https://www.teuniz.net/edf_bdf_testfiles/

The other file I was trying to load:

thx for your answer!

I just tried to load ma0844az_1-1+.edf and it works on 0.24.

OK thx so the issue would be with my setup? (0.24 was the first I tried)
Do you have an idea where precisely it could come from?

Probably. How did you set up Python and MNE?

Python version is 3.7.6, installed with Anaconda. MNE was installed a while ago and was uploaded recently. But it’s not a clean python install and it might generate conflicts (I should probably have tested this first though :grimacing: sry)
Seems that if I create a venv with only MNE it’s working, so I’ll just have to test every lib I’m using on my project to get to the bottom of this.

thx!

1 Like

@neako, FYI when you’re trying to isolate the problem: there’s a decent chance that the problem is with numba; we have different code that runs depending on whether numba is installed or not, and the traceback you posted hits some of that code.