You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Third loop in wfdb.processing.peaks.find_local_peaks will not be executed and can be removed #474
In find_local_peaks() in wfdb.processing.peaks, the last of three loops will not be execute because the condition i < len(sig) is already false when the second loop exits:
[first loop omitted]
while i < len(sig):
if sig[i] == max(sig[i - radius : i + radius]):
peak_inds.append(i)
i += radius
else:
i += 1
while i < len(sig):
if sig[i] == max(sig[i - radius :]):
peak_inds.append(i)
i += radius
else:
i += 1
I think this one can be closed: #573 replaced the three loops in find_local_peaks with a single loop over a window clipped to the edges of the signal, so the unreachable third loop is gone.
Confirmed fixed by #573 (commit 4d7fa00). find_local_peaks now uses one loop over the whole signal with the search window clipped to the signal edges, so the unreachable third loop is gone. Closing this issue.
Activity
Include the right edge in find_local_peaks window
Include the right edge in find_local_peaks window (#573)
TheNetherWatcher commentedon Nov 1, 2026
I think this one can be closed: #573 replaced the three loops in
find_local_peakswith a single loop over a window clipped to the edges of the signal, so the unreachable third loop is gone.tompollard commentedon Nov 21, 2026
Confirmed fixed by #573 (commit 4d7fa00). find_local_peaks now uses one loop over the whole signal with the search window clipped to the signal edges, so the unreachable third loop is gone. Closing this issue.