Third loop in wfdb.processing.peaks.find_local_peaks will not be executed and can be removed
Open
Nobody has claimed this yet.
- Dominant language
- Jupyter Notebook
- Stars
- 853
- Forks
- 322
- PR merge metrics
- No merged PRs in 30d
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
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
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.
Assessment
- Tech stack
- python
- Domain
- data
- Issue type
- Refactor
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 52/100