Repository navigation
[TEST,CLEANUP] Cover SignalToNoiseEstimatorMedianRapid empty-window fallback, drop unused boost includes - #9994
Conversation
Follow-up to review feedback on the SignalToNoiseEstimatorMedianRapid speedup. Add test coverage for the zero-median fallback path. The existing test data has no zero intensities and a uniform m/z grid, so no window is ever empty and the fallback branch was never executed by any test. Two cases are added: - An m/z gap that leaves the window [300, 400) without any data point, so computeMedian_ returns 0 and the imputed (mean + 3*stdev)/60 value is used. - An all-zero intensity array, where the imputed fallback is itself 0. This pins down the cache flag: a cache keyed on the value rather than on a separate bool would silently recompute for every window. Both cases were verified to produce identical results before and after the speedup change, so they are regression guards rather than a codification of new behaviour. Remove the unused boost includes. No boost::accumulators symbol appears in the translation unit; mean and stdev are computed with std::accumulate and std::inner_product. The serialization/array_wrapper include and its OPENMS_BOOST_VERSION_MINOR guard existed only to support the accumulators headers. Those headers were also transitively supplying <cmath>, so add it (and <iterator>, for std::distance/advance/iterator_traits) explicitly to keep the translation unit self-contained. Co-Authored-By: Claude <[email protected]> Claude-Session: https://claude.ai/code/session_01PfBYxKS6C1aUUhgSUSycQA
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
Included review availability: Your plan provides up to 4 included reviews per hour; 2 remain after this review. 📝 WalkthroughWalkthroughThe change removes unused Boost includes from ChangesMedian noise estimation
Poem
Merge Risk: ⚪ Minimal · up to This change adds regression coverage for empty-window noise handling and makes the implementation's standard-library dependencies explicit without changing product behavior. No actionable merge-blocking risk remains beyond normal checks and review. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Full details: Docstring CoverageExplanation No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 2 files. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Description
Two independent follow-ups to the review of #9782, split out so they can land on their own.
Both changes were written against
developand hold before and after the speedup in #9782, so they are regression guards rather than a codification of new behaviour. Merging them first gives #9782 a safety net for the exact code path it reworks.1. Test coverage for the zero-median fallback
computeNoiseInWindows_imputes(mean + 3*stdev)/60whenever a window's median is exactly 0. No existing test ever executed that branch: the class test's intensity array contains no zeros and its m/z grid is uniform, so no window is ever empty. The whole fallback path could be broken and CI would stay green.Two cases are added to the existing
estimateNoisesection:window_length = 100, leaving[300, 400)without any data point.computeMedian_returns 0 and the imputed value0.23528073283is stored. The odd-grid value andget_noise_valueat the same position are asserted too, so the even/odd averaging over an imputed window is covered.0.0. This distinguishes a fallback cache keyed on a flag from one keyed on the value: aif (fallback == 0.0)sentinel would silently recompute mean/stdev for every window and nothing would catch it. It also pinsget_noise_valueclamping to1.0, so clients dividing by the noise estimate stay safe.This matters for #9782, which makes that branch stateful and cached.
2. Remove unused boost includes
No
boost::accumulatorssymbol appears anywhere in the translation unit — mean and stdev are computed withstd::accumulate/std::inner_product. Theboost/serialization/array_wrapper.hppinclude and itsOPENMS_BOOST_VERSION_MINORguard (the issue #2790 workaround) existed only to support the accumulators headers, so all four go.<cmath>. Removing them without compensating breaks the build on thestd::sqrtused for the stdev:So
<cmath>is added explicitly, along with<iterator>forstd::distance/std::advance/std::iterator_traits, which were likewise only incidentally available. The translation unit is now self-contained.Verification
Compiled the real translation unit against the real header with
-Wall -Wextra— clean, no warnings — then linked it into a harness running the new assertions plus all 25 pre-existing ones from the class test, against this branch's (i.e.develop's) implementation:The same 32 assertions also pass against the #9782 head, which is what makes these safe to merge in either order.
Checklist
🤖 Generated with Claude Code
https://claude.ai/code/session_01PfBYxKS6C1aUUhgSUSycQA
Generated by Claude Code
Summary by CodeRabbit
Bug Fixes
Tests