MIT-LCP / wfdb-python

Native Python WFDB package
MIT License
730 stars 298 forks source link

ann2rr returns ghost beats #479

Open OliverFaust opened 3 months ago

OliverFaust commented 3 months ago

Hi,

If the input file, say `atr', contains additional labels, such as (N and (AFIB, ann2rr returns surplus rr intervals at the location of these labels.

Details: In ann2rr in hr.py the rr intervals are calculated:
rr_interval = calc_rr(ann.sample, fs=ann.fs)

ann.sample contains the beat locations + the annotation location. Hence, ann2rr splits the rr interval which spans over each annotation location into two. This changes the heart rhythm at critical points. For example, at the beginning and end of atrial fibrillation, i.e. at (AFIB and (N.