Я запускаю приложение с 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')
выдает код ошибки:
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-14-9ebb6f5d549b> in <module>()
2 #annotation=[ann.sample, ann.sample],
3 title='MIT-BIH Record 100', time_units='seconds',
----> 4 figsize=(10,4), ecg_grids='all')
~/anaconda3/lib/python3.6/site-packages/wfdb/plot/plot.py in plot_items(signal, ann_samp, ann_sym, fs, time_units, sig_name, sig_units, ylabel, title, sig_style, ann_style, ecg_grids, figsize, return_fig)
99
100 # Figure out number of subplots required
--> 101 sig_len, n_sig, n_annot, n_subplots = get_plot_dims(signal, ann_samp)
102
103 # Create figure
~/anaconda3/lib/python3.6/site-packages/wfdb/plot/plot.py in get_plot_dims(signal, ann_samp)
126 "Figure out the number of plot channels"
127 if signal is not None:
--> 128 if signal.ndim == 1:
129 sig_len = len(signal)
130 n_sig = 1
AttributeError: 'tuple' object has no attribute 'ndim'
Какой код plot_items прямо из документации, так что он должен работать, поскольку данные, которые я использую, поступают прямо из их библиотеки. Это ошибка или я что-то упустил? Я закомментировал код аннотации, потому что он возвращает:
TypeError: plot_items() got an unexpected keyword argument 'annotation'
Что сбивает с толку, так как этот код прямо из документации.
Я попытался сделать более простую команду, которая пришла с другим кодом ошибки, который я не могу понять.
wfdb.plot.plot_wfdb(record=record)
С выводом:
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-15-c3814c09f768> in <module>()
----> 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'