Thanks to visit codestin.com
Credit goes to github.com

Skip to content

"Demo 7" in demo.ipynb notebook fails with TypeError #168

@tompollard

Description

@tompollard

The following chunk in https://github.com/MIT-LCP/wfdb-python/blob/master/demo.ipynb fails with a TypeError.

# Demo 7 - Read the multi-segment record and plot waveforms from the MIMIC matched waveform database.
# Notice that some channels have no valid values to plot
record = wfdb.rdrecord('sample-data/multi-segment/s00001/s00001-2896-10-10-00-31',
                       sampfrom=3000000, sampto=4000000)
wfdb.plot_wfdb(record, title='Record s00001/s00001-2896-10-10-00-31') 
display(record.__dict__)
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-10-46517ed3fe63> in <module>
      3 record = wfdb.rdrecord('sample-data/multi-segment/s00001/s00001-2896-10-10-00-31',
      4                        sampfrom=3000000, sampto=4000000)
----> 5 wfdb.plot_wfdb(record, title='Record s00001/s00001-2896-10-10-00-31')
      6 display(record.__dict__)
      7 

~/projects/wfdb-python/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,

~/projects/wfdb-python/wfdb/plot/plot.py in get_wfdb_plot_items(record, annotation, plot_sym)
    432         sig_units = record.units
    433         record_name = 'Record: %s' % record.record_name
--> 434         ylabel = ['/'.join(pair) for pair in zip(sig_name, sig_units)]
    435     else:
    436         signal = fs = ylabel = record_name = None

~/projects/wfdb-python/wfdb/plot/plot.py in <listcomp>(.0)
    432         sig_units = record.units
    433         record_name = 'Record: %s' % record.record_name
--> 434         ylabel = ['/'.join(pair) for pair in zip(sig_name, sig_units)]
    435     else:
    436         signal = fs = ylabel = record_name = None

TypeError: sequence item 1: expected str instance, NoneType found

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions