New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ENH: add method
arg to interpolate.Akima1DInterpolator
#19696
Conversation
070e5bc
to
72dafee
Compare
scipy/interpolate/_cubic.py
Outdated
modified : bool, optional | ||
If ``True``, use the modified Akima interpolation[1991]. | ||
Defaults to ``False``, use the Akima interpolation[1970]. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think some additional documentation is needed, perhaps in the notes section, explain what the difference is and why you should consider using one or the other
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agreed, but I couldn't come up with a good sentence. 😢
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ideally, we'd have explicit formulas for the slopes in the Notes section, similar to https://docs.scipy.org/doc/scipy/reference/generated/scipy.interpolate.PchipInterpolator.html
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wrote it based on references. Please let me know if there are any better expressions.
Co-authored-by: Jake Bowhay <60778417+j-bowhay@users.noreply.github.com>
Co-authored-by: Jake Bowhay <60778417+j-bowhay@users.noreply.github.com>
Co-authored-by: Jake Bowhay <60778417+j-bowhay@users.noreply.github.com>
Co-authored-by: Jake Bowhay <60778417+j-bowhay@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks reasonable, modulo an API tweak.
scipy/interpolate/_cubic.py
Outdated
modified : bool, optional | ||
If ``True``, use the modified Akima interpolation[1991]. | ||
Defaults to ``False``, use the Akima interpolation[1970]. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ideally, we'd have explicit formulas for the slopes in the Notes section, similar to https://docs.scipy.org/doc/scipy/reference/generated/scipy.interpolate.PchipInterpolator.html
modified
arg to interpolate.Akima1DInterpolator
method
arg to interpolate.Akima1DInterpolator
Co-authored-by: Jake Bowhay <60778417+j-bowhay@users.noreply.github.com>
scipy/interpolate/_cubic.py
Outdated
.. [2] A method of univariate interpolation that has the accuracy of | ||
a third-degree polynomial. Hiroshi Akima, J. ACM, September 1991, | ||
17(3), 341-366. :doi:`10.1145/114697.116810` | ||
.. [3] Makima Piecewise Cubic Interpolation. Cleve Moler and Cosmin Ionita, 2019. | ||
https://blogs.mathworks.com/cleve/2019/04/29/makima-piecewise-cubic-interpolation/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.. [2] A method of univariate interpolation that has the accuracy of | |
a third-degree polynomial. Hiroshi Akima, J. ACM, September 1991, | |
17(3), 341-366. :doi:`10.1145/114697.116810` | |
.. [3] Makima Piecewise Cubic Interpolation. Cleve Moler and Cosmin Ionita, 2019. | |
https://blogs.mathworks.com/cleve/2019/04/29/makima-piecewise-cubic-interpolation/ | |
.. [2] Makima Piecewise Cubic Interpolation. Cleve Moler and Cosmin Ionita, 2019. | |
https://blogs.mathworks.com/cleve/2019/04/29/makima-piecewise-cubic-interpolation/ |
I misunderstood.
% We modify Akima's formula to eliminate overshoot and undershoot
% when the data is constant for more than two consecutive nodes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM thanks @n-takumasa, will wait to see if @ev-br is happy before merging
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Reference issue
No. But I found a discussion on the mailing list.
What does this implement/fix?
Add a functionally to use the modified Akima interpolation.
Additional information
https://www.mathworks.com/help/matlab/ref/makima.html