'How to read edf data in Python 3

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.



Solution 1:[1]

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

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Jaroslav Bezděk