MIT-LCP / MIT-LCP/wfdb-python

IndexError when plotting annotations out of range

Open
#344 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Jupyter Notebook
Stars
853
Forks
322
PR merge metrics
No merged PRs in 30d

Description

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.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the plot_items and plot_wfdb entry points and reproduce the IndexError using annotations outside the supplied signal range. Compare the requested hide-versus-plot behavior and decide how the default should work for plot_wfdb. Done means the chosen behavior is exposed as an option and out-of-range annotations no longer cause the reported error.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data-visualization
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.