直接从 python 中的在线存档导入 .edf 文件

Import .edf file directly from online archive in python

使用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

在 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