Reading .rec EEG file

I am using MNE for my research.

I am unable to open .rec EEG file using the mne.io.read function.
Does MNE support .rec format?

I appreciate your help

  • MNE-Python version: 0.22
  • operating system: Linux

Hello @blrk and welcome to the forum!

Have you tried using mne.io.read_raw_edf? I read somewhere that .rec may refer to EDF files.

Good luck,
Richard

using mne.io.read_raw_edf throws NotImplementedError: Only EDF files are supported by read_raw_edf, got rec

here is my code

import os
import mne
from google.colab import drive

drive.mount('/content/drive')
os.chdir('/content/drive/MyDrive/sleep_EDF_N/sleep_data/')
eeg_data = '/content/drive/MyDrive/sleep_EDF_N/sleep_data/sc4002e0.rec'
hyp_data = '/content/drive/MyDrive/sleep_EDF_N/sleep_data/sc4002e0.hyp'
raw_train = mne.io.read_raw_edf(eeg_data, preload=True)

NotImplementedError Traceback (most recent call last)
in ()
----> 1 raw_train = mne.io.read_raw_edf(eeg_data, preload=True)

/usr/local/lib/python3.7/dist-packages/mne/io/edf/edf.py in read_raw_edf(input_fname, eog, misc, stim_channel, exclude, preload, verbose)
1217 if ext != ‘edf’:
1218 raise NotImplementedError(
→ 1219 ‘Only EDF files are supported by read_raw_edf, got %s’ % (ext,))
1220 return RawEDF(input_fname=input_fname, eog=eog, misc=misc,
1221 stim_channel=stim_channel, exclude=exclude, preload=preload,

NotImplementedError: Only EDF files are supported by read_raw_edf, got rec

Can you rename the file to sc4002e0.edf and try again?

Awesome. It is working! Thank you @richard
eeg_data = '/content/drive/MyDrive/sleep_EDF_N/sleep_data/sc4002e0.edf' raw_train = mne.io.read_raw_edf(eeg_data, preload=True)
Extracting EDF parameters from /content/drive/MyDrive/sleep_EDF_N/sleep_data/sc4002e0.edf…
EDF file detected
Setting channel info structure…
Creating raw.info structure…
Reading 0 … 8489999 = 0.000 … 84899.990 secs…

1 Like