How can I read edf data using Python? I want to analyze data of a edf file, but I cannot read it using pyEDFlib. It threw the error OSError: The file is discontinous and cannot be read
and I'm not sure why.
EDF files are the primary file type associated with Edificius and is only supported by Edificius. You can open an EDF file with Edificius by selecting File → Open. If you receive an EDF file and do not have access to Edificius, you can download and install the trial of Edificius from their website to open the file.
pyEDFlib is a python library to read/write EDF+/BDF+ files based on EDFlib. EDF means European Data Format and was firstly published Kemp1992. In 2003, an improved version of the file protocol named EDF+ has been published and can be found at Kemp2003. The EDF/EDF+ format saves all data with 16 Bit.
European Data Format (EDF) is a standard file format designed for exchange and storage of medical time series. Being an open and non-proprietary format, EDF(+) is commonly used to archive, exchange and analyse data from commercial devices in a format that is independent of the acquisition system.
I assume that your data are biological time-series like EEG, is this correct? If so, you can use the MNE library.
You have to install it first. Since it is not a standard library, take a look here. Then, you can use the read_raw_edf()
method.
For example:
import mne
file = "my_path\\my_file.edf"
data = mne.io.read_raw_edf(file)
raw_data = data.get_data()
# you can get the metadata included in the file and a list of all channels:
info = data.info
channels = data.ch_names
See documentation in the links above for other properties of the data object
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With