Skip to content

Commit edb5f12

Browse files
authored
Fix: Indent code to ensure 'j' is within for-loop in GQRS algorithm (#499)
As discussed in #489: > "The variable j was not properly scoped within the for-loop in the sm method, leading to an UnboundLocalError when j was accessed outside the loop." #489 needs rebasing on the main branch to allow tests to run. This pull request is just a cherry-pick of the commit in #489, on top of the current version of main (I can't push to the other branch directly, because its on a forked repo).
2 parents 634c6a1 + a27336c commit edb5f12

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

wfdb/processing/qrs.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1230,20 +1230,20 @@ def sm(self, at_t):
12301230
smtpj = self.at(smt + j)
12311231
smtlj = self.at(smt - j)
12321232
v += int(smtpj + smtlj)
1233-
self.smv_put(
1234-
smt,
1235-
(v << 1)
1236-
+ self.at(smt + j + 1)
1237-
+ self.at(smt - j - 1)
1238-
- self.adc_zero * (smdt << 2),
1239-
)
1240-
1241-
self.SIG_SMOOTH.append(
1242-
(v << 1)
1243-
+ self.at(smt + j + 1)
1244-
+ self.at(smt - j - 1)
1245-
- self.adc_zero * (smdt << 2)
1246-
)
1233+
self.smv_put(
1234+
smt,
1235+
(v << 1)
1236+
+ self.at(smt + j + 1)
1237+
+ self.at(smt - j - 1)
1238+
- self.adc_zero * (smdt << 2),
1239+
)
1240+
1241+
self.SIG_SMOOTH.append(
1242+
(v << 1)
1243+
+ self.at(smt + j + 1)
1244+
+ self.at(smt - j - 1)
1245+
- self.adc_zero * (smdt << 2)
1246+
)
12471247
self.c.smt = smt
12481248

12491249
return self.smv_at(at_t)

0 commit comments

Comments
 (0)