wfdb-python icon indicating copy to clipboard operation
wfdb-python copied to clipboard

IndexError when plotting annotations out of range

Open bemoody opened this issue 3 years ago • 0 comments

If you pass annotations to plot_items or plot_wfdb that are before the start or after the end of the supplied signals, it will give an error

Exception: IndexError: try setting shift_samps=True in the "rdann" function?

The error message has a valid point, in that if you load a subset using sampfrom then the default behavior of rdrecord and rdann is different, which can be confusing.

Still, it's quite possible to load annotations that are outside the time range of the signals you're plotting. In such a case it's often desirable to either:

  • hide all annotations that occur before/after the signal time range

  • plot the annotations anyway (with a y-value of zero), and extend the horizontal range of the plot (or maybe not)

So it'd be nice to have one or both of these behaviors as an option at least. Not sure what the default for plot_wfdb should be.

bemoody avatar Mar 16 '22 16:03 bemoody