Repository navigation
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
IPSA sorts the data by
x_data, but usesroiin that sorted array without translating its input indices. Withoriginal_criteria=True, reversing or shuffling the same spectrum and region can change the tolerance history and when smoothing stops.Before: 27 versus 31 iterations, with maximum baseline difference about
0.27165. After: both use 27 iterations and the baselines are identical.Translate the selected original indices into sorted positions before calculating either the default tolerance or the original stopping criterion. Preserve slice, integer-index and Boolean-mask selections. The ordinary stopping criterion and
roi=Nonepath remain unchanged.Twelve coordinate-order regressions fail before and pass after. On eight recorded Raman spectra, a separate implementation derives quadratic smoothing weights from a Vandermonde pseudoinverse and uses direct convolution. All 384 cases now match it: 192 stopping-history mismatches and 76 wrong baselines are corrected, with maximum relative baseline error below
4.9e-13. All 192 ordered/all-point controls and 96 ordinary-criterion controls retain identical baseline and history hashes. This checks region selection and smoothing, not spectral identification quality.Type of Pull Request
Pull Request Checklist
ruff check .passes)Validated on Linux/Python 3.12. The correction is limited to the original criterion's ROI mapping; other algorithm choices and parallel behavior were not changed.