Enhance numerical stability of Savitzky-Golay coefficient computation.#1
Open
MothNik wants to merge 11 commits intoWarrenWeckesser:mainfrom
Open
Enhance numerical stability of Savitzky-Golay coefficient computation.#1MothNik wants to merge 11 commits intoWarrenWeckesser:mainfrom
MothNik wants to merge 11 commits intoWarrenWeckesser:mainfrom
Conversation
Added a numerically stabilised version of the Savitzky Golay filter computation as described in Scipy Issue #20825 scipy/scipy#20825 (comment)
Author
|
The adaption mentioned here seems possible without loss of accuracy. |
…y avoiding the explicit computation of the pseudoinverse
…h `np.linalg.lstsq`
…tion for the super stabilised Savitzky Golay coefficients - in this context, the derivative pre-factor was incorporated into the correction factors as a single rather than multiple multiplications
…on coefficients of the super stabilised Savitzky Golay coefficients. It does not provide any benefit and `math.factorial` is more direct. Yet, it's a micro-optimization.
…this could ever be encountered in this context
…/ 2`` in super stabilised Savitzky Golay coefficient computation by using a simplified solution in this case - made relative error test in main truly insensitive to ZeroDivision (`inf` was never used in case of zero division because Python does not evaluate lazily) - added a more extensive test for the coefficients against the correct solution to main to avoid thing like the first bullet point happening
…Golay coefficients safe against floating point errors in the zero-check
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.
This PR adds a numerically stabilised version of the Savitzky Golay filter computation as described for the Scipy Issue #20825 in this comment.