Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Third loop in wfdb.processing.peaks.find_local_peaks will not be executed and can be removed

Open
#474 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
1/5
Estimated time
Under an hour
Newbie friendliness
52/100
Issue type
Refactor
Clarity
Clearly specified
Activity status
Stale
Tech stack
python
Domain
data

Research direction

Start in wfdb.processing.peaks.find_local_peaks and inspect the loop order and exit condition shown in the issue. Confirm that the final loop is unreachable after the preceding loop, remove only that dead loop, and verify that the function’s existing behavior remains unchanged.

Written by the indexing model from the issue text.

Description

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
Dominant language
Jupyter Notebook
Stars
853
Forks
322
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from MIT-LCP/wfdb-python

All issues in MIT-LCP/wfdb-python

Similar issues

More Data Engineering issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.