Skip to content

fix: exclude endpoint peaks in findpeaks - #285

Open
draarivpatel-ui wants to merge 1 commit into
petercorke:mainfrom
draarivpatel-ui:fix/findpeaks-endpoint-peaks
Open

draarivpatel-ui wants to merge 1 commit into
petercorke:mainfrom
draarivpatel-ui:fix/findpeaks-endpoint-peaks

Conversation

@draarivpatel-ui

Copy link
Copy Markdown

Thanks for contributing to MVTB!

Summary

findpeaks documents that the first and last scale samples can never be returned as maxima. The upper edge filter used an inclusive comparison, so a peak in the final sample could be returned. This makes the upper edge comparison strict and keeps the filtered index array an integer dtype when it is empty.

Related issue

No existing issue found.

Checklist

  • PR title follows Conventional Commits (type: description)
  • Tests pass locally (pytest)
  • Added/updated tests for this change
  • New/changed code is type-hinted with modern syntax
  • Docstrings updated where needed

Validation

  • Added regression test failed before the fix with AssertionError: 1 != 0 for findpeaks(np.array([0, 0, 1]), scale=1).
  • nice -n 19 python -m pytest tests/base/test_findpeaks.py -q: 53 passed, 2 subtests passed.
  • With OpenCV 4.14.0, nice -n 19 python -m pytest -q: 1896 passed, 119 skipped, 75 subtests passed.
  • ruff format --check on both changed files: passed.
  • ruff check tests/base/test_findpeaks.py: passed.
  • mypy src/machinevisiontoolbox/base/findpeaks.py: passed.
  • Full mypy reported 11 pre-existing unused-ignore errors in PointCloud.py and Sources.py in this local environment.
  • The initially resolved OpenCV 5.1.0 environment had 8 unrelated AKAZE/BRISK detector failures because those factories were absent from cv2; validation was repeated with the OpenCV 4 line used by CI.

AI assistance disclosure: this change was prepared with Devin, powered by SWE-2.1 Max.

Copilot AI balanced review requested due to automatic review settings November 25, 2026 01:33

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 0 complexity · 0 duplication

Metric Results
Complexity 0
Duplication 0

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants