Skip to content

fix: preserve unexpected peak refinement failures - #140

Merged
petercorke merged 3 commits into
petercorke:mainfrom
RoboX2020:fix/peak-fit-exceptions
Oct 17, 2026
Merged

petercorke merged 3 commits into
petercorke:mainfrom
RoboX2020:fix/peak-fit-exceptions

Conversation

@RoboX2020

Copy link
Copy Markdown
Contributor

Addresses the findpeaks.py part of #115.

Polynomial refinement now skips only ValueError and NumPy LinAlgError failures. It emits a RuntimeWarning, pointing to the caller, instead of printing to stdout. Unrelated exceptions and user interrupts are no longer swallowed.

Added a real boundary-neighbourhood regression and injected-error tests for RuntimeError and KeyboardInterrupt. All three assertions fail with the original bare except.

Validation on Python 3.11:

  • Peak suite: 52 passed plus 2 subtests, on OpenCV 4.12.0.88 and 5.0.0.93.
  • Full suite on OpenCV 5: 961 passed, 97 skipped, 7 subtests passed.
  • Both changed files pass black; tests pass ruff. Two existing source lint findings (unused eps and a wildcard import in the demo) remain unchanged.

Full suite on OpenCV 4 was not run. Other exception sites in #115 are left to separate changes.

@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.

@petercorke
petercorke merged commit ca5ee04 into petercorke:main Oct 17, 2026
39 checks passed
@github-actions github-actions Bot mentioned this pull request Oct 17, 2026
@petercorke

Copy link
Copy Markdown
Owner

Thanks — turning the swallowed fit failure into a RuntimeWarning and letting real errors through is just right. Merged.

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