-
Notifications
You must be signed in to change notification settings - Fork 312
Closed
Labels
Description
The following code either has the annotations in the incorrect place or results in an IndexError, depending on the specific choices of sampfrom and sampto:
record = wfdb.rdrecord('mitdb/100', sampfrom=360, sampto=1080)
annotation = wfdb.rdann('mitdb/100', 'atr', sampfrom=360, sampto=1080)
wfdb.plot_wfdb(record=record, annotation=annotation, time_units='seconds')
I believe the issue is that when plotting the record only, the x-axis begins at 0 regardless. But the x-axis of the annotation-only plot begins at the corresponding time. In this example,
wfdb.plot_wfdb(record=record, annotation=None, time_units='seconds')
plots from 0 to 2 seconds, whereas
wfdb.plot_wfdb(record=None, annotation=annotation, time_units='seconds')
plots from 1 to 3 seconds.
So when trying to plot both,
wfdb.plot_wfdb(record=record, annotation=annotation, time_units='seconds')
you typically get an IndexError (because the annotation index in out of bounds) or sometimes a graph with annotations that don't line up.
I'm not sure what the best solution is. It makes sense that the annotations are associated with a sample number. Maybe the record should be too?
soso-maitha