1

使用 pyedflib 导入 edf 文件,是否可以直接从其源导入数据集?还是总是需要下载数据并在本地导入?

例如,我想这样做:

pyedflib.EdfReader("https://www.physionet.org/pn6/chbmit/chb02/chb02_02.edf")

---------------------------------------------------------------------------
IOError                                   Traceback (most recent call last)
<ipython-input-64-d123ce671a2f> in <module>()
----> 1 pyedflib.EdfReader("https://www.physionet.org/pn6/chbmit/chb02/chb02_02.edf")

pyedflib/_extensions/_pyedflib.pyx in pyedflib._extensions._pyedflib.CyEdfReader.__init__()

pyedflib/_extensions/_pyedflib.pyx in pyedflib._extensions._pyedflib.CyEdfReader.open()

pyedflib/_extensions/_pyedflib.pyx in pyedflib._extensions._pyedflib.CyEdfReader.check_open_ok()

IOError: can not open file, no such file or directory
4

1 回答 1

0

在 GitHub 页面上收到的答案

import pyedflib
import os
url = "https://www.physionet.org/pn6/chbmit/chb01/chb01_01.edf"
filename = "./chb.edf"
try:
    from urllib import urlretrieve # Python 2

except ImportError:
    from urllib.request import urlretrieve # Python 3

urlretrieve(url,filename)
pyedflib.EdfReader(filename)
os.remove(filename)

https://github.com/holgern/pyedflib/issues/22#issuecomment-341649760

于 2017-11-07T13:56:30.060 回答