如何在 Python 3 中读取 edf 数据

Min*_*ndy 8 python time-series european-data-format mne-python

如何使用 Python 读取 edf 数据?我想分析一个 edf 文件的数据,但我无法使用pyEDFlib读取它。它抛出了错误OSError: The file is discontinous and cannot be read,我不知道为什么。

Bos*_*ova 12

我假设您的数据是像脑电图这样的生物时间序列,这是正确的吗?如果是这样,您可以使用 MNE 库。

您必须先安装它,因为它不是标准库,请参见此处:https : //martinos.org/mne/dev/getting_started.html

然后就可以使用 read_raw_edf 方法了,看这里:https ://martinos.org/mne/dev/generated/mne.io.read_raw_edf.html

例如:

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
Run Code Online (Sandbox Code Playgroud)

有关数据对象的其他属性,请参阅上面链接中的文档