Skip to content

Commit

Permalink
Fix: Indent code to ensure 'j' is within for-loop in GQRS algorithm (#…
Browse files Browse the repository at this point in the history
…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).
  • Loading branch information
tompollard authored Jul 10, 2024
2 parents 634c6a1 + a27336c commit edb5f12
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions wfdb/processing/qrs.py
Original file line number Diff line number Diff line change
Expand Up @@ -1230,20 +1230,20 @@ def sm(self, at_t):
smtpj = self.at(smt + j)
smtlj = self.at(smt - j)
v += int(smtpj + smtlj)
self.smv_put(
smt,
(v << 1)
+ self.at(smt + j + 1)
+ self.at(smt - j - 1)
- self.adc_zero * (smdt << 2),
)

self.SIG_SMOOTH.append(
(v << 1)
+ self.at(smt + j + 1)
+ self.at(smt - j - 1)
- self.adc_zero * (smdt << 2)
)
self.smv_put(
smt,
(v << 1)
+ self.at(smt + j + 1)
+ self.at(smt - j - 1)
- self.adc_zero * (smdt << 2),
)

self.SIG_SMOOTH.append(
(v << 1)
+ self.at(smt + j + 1)
+ self.at(smt - j - 1)
- self.adc_zero * (smdt << 2)
)
self.c.smt = smt

return self.smv_at(at_t)
Expand Down

0 comments on commit edb5f12

Please sign in to comment.