Skip to content

AttributeError: 'NoneType' object has no attribute 'shape' for wfdb.plot_wfdb call with an annotation object but no record object #269

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
briangow opened this issue Dec 18, 2020 · 0 comments
Assignees
Labels

Comments

@briangow
Copy link
Contributor

briangow commented Dec 18, 2020

This call will result in the error:

annotation = wfdb.rdann('100', 'atr', sampfrom=100000, sampto=110000,
pn_dir='mitdb')
annotation.fs = 360
wfdb.plot_wfdb(annotation=annotation, time_units='minutes')

as shown here:

wfdb/plot/plot.py in 
plot_items(signal, ann_samp, ann_sym, fs, time_units, sig_name, 
sig_units, xlabel, ylabel, title, sig_style, ann_style, ecg_grids, 
figsize, return_fig,
return_fig_axes)
     129
     130     if ylabel:
 --> 131         if len(ylabel) != signal.shape[1]:
     132             raise Exception('The length of the ylabel must be the
 same as the '
     133                             'signal: {}
 values'.format(signal.shape[1]))
AttributeError: 'NoneType' object has no attribute 'shape'

The wfdb.plot_wfdb function doesn't require a record object but if it isn't passed (and therefore there isn't a signal object), this error will occur if there is a ylabel along with an annotation object.

@Lucas-Mc Lucas-Mc added the bug label Dec 18, 2020
briangow added a commit that referenced this issue Dec 22, 2020
…plots) should match the number of ylabels regardless of whether records or annotations are being passed in.
Lucas-Mc added a commit that referenced this issue Dec 23, 2020
Fix for MIT-LCP/wfdb-python issue #269. The number of subplots (n_sub…
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants