1

I am trying to read EEG signals from the "St. Vincent's University Hospital / University College Dublin Sleep Apnea Database", which can be accessed at this link: https://physionet.org/content/ucddb/1.0.0/

I am using the Waveform Database Software Package (WFDB) library available on the same PhysioNet site: https://physionet.org/content/wfdb-python/4.1.0/

According to the documentation, this library is capable of reading EEG signals.

To read the file I am trying to use the function:

record = wfdb.rdrecord('/content/ucddb002.rec')

However, I always get an error:

No such file or directory: '/directory/ucddb002.rec.hea'

Where ucddb002.rec is one recording from a paciente.

In some research I found out that the ".hea" file is actually a txt file that contains some important information. However, the database I am using does not have this ".hea" file, it only has the ".rec", ".edf" and ".txt" extensions

What do I do to be able to read the files and have access to the EEG data?

Daniel Dantas
  • 145
  • 3
  • 15

1 Answers1

0

I struggled with this myself recently. WFDB's rdrecord expects a record name without extension and then looks for RECORDNAME.dat and RECORDNAME.hea, which is the so-called MIT format. After a lot of trial and error, I finally found the solution in the dataset documentation.

The files named with .rec suffixes contain these signals in EDF format.

You could use wfdb.io.convert.read_edf (docs) to read the files with WFDB.

import wfdb.io.convert

record = wfdb.io.convert.read_edf("path/to/ucddb003.rec")

However, this implementation is really slow (10+ seconds for me). Since you tagged MNE, you could use that as well, but mne.io.read_raw_edf raises an error due to the wrong file extension. Easiest might be to rename the .rec files on disk to .edf and read as follows:

import mne

record = mne.io.read_raw_edf("path/to/ucddb003.edf")
SamProell
  • 371
  • 2
  • 12