我正在用WFDB启动一个应用程序,(我是新来的库),它会给我错误消息,其中包含我直接从文档中得到的代码。在import wfdb
record = wfdb.rdsamp('mitdb/100', sampto=3000)
#annotation = wfdb.rdann('sampledata/100', 'atr', sampto=3000)
ann = wfdb.rdann('mitdb/100', 'atr', sampto=3000)
wfdb.plot_items(signal=record,
#annotation=[ann.sample, ann.sample],
title='MIT-BIH Record 100', time_units='seconds',
figsize=(10,4), ecg_grids='all')
给出错误代码:
^{pr2}$
这是直接从文档中取出的plot_items代码,所以它应该可以工作,因为我使用的数据直接来自他们的库。这是虫子还是我漏掉了什么?我注释掉了注释代码,因为它返回:TypeError: plot_items() got an unexpected keyword argument 'annotation'
这是令人困惑的,因为这段代码是直接从文档中提取出来的。在
我试着做一个更简单的命令,却得到了一个我无法理解的不同错误代码。在wfdb.plot.plot_wfdb(record=record)
通过输出:---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
in ()
----> 1 wfdb.plot.plot_wfdb(record=record)
~/anaconda3/lib/python3.6/site-packages/wfdb/plot/plot.py in plot_wfdb(record, annotation, plot_sym, time_units, title, sig_style, ann_style, ecg_grids, figsize, return_fig)
405 ylabel, record_name) = get_wfdb_plot_items(record=record,
406 annotation=annotation,
--> 407 plot_sym=plot_sym)
408
409 return plot_items(signal=signal, ann_samp=ann_samp, ann_sym=ann_sym, fs=fs,
~/anaconda3/lib/python3.6/site-packages/wfdb/plot/plot.py in get_wfdb_plot_items(record, annotation, plot_sym)
421 # Get record attributes
422 if record:
--> 423 if record.p_signal is not None:
424 signal = record.p_signal
425 elif record.d_signal is not None:
AttributeError: 'tuple' object has no attribute 'p_signal'