From f5d949d505eab76e80b25faf976673a63925166f Mon Sep 17 00:00:00 2001 From: Bernd Porr Date: Sun, 21 Jan 2024 12:37:16 +0000 Subject: [PATCH] Bugfix reported in https://github.com/berndporr/py-ecg-detectors/issues/24 The wrong array is checked for length. Thanks for @purpl3F0x for spotting it. --- ecgdetectors.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ecgdetectors.py b/ecgdetectors.py index 4b3b825..e69162a 100644 --- a/ecgdetectors.py +++ b/ecgdetectors.py @@ -110,7 +110,7 @@ def hamilton_detector(self, unfiltered_ecg): QRS.append(peak) idx.append(i) s_pks.append(ma[peak]) - if len(n_pks)>8: + if len(s_pks)>8: s_pks.pop(0) s_pks_ave = np.mean(s_pks)