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?
I struggled with this myself recently. WFDB's
rdrecordexpects 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.You could use
wfdb.io.convert.read_edf(docs) to read the files with WFDB.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_edfraises an error due to the wrong file extension. Easiest might be to rename the.recfiles on disk to.edfand read as follows: