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: interpolate: allow Akima extrapolation #20304
Conversation
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.
Thanks @psmd-iberutaru can you add some test coverage for this new functionality
Apologies @j-bowhay. Added the missing unit test(s). If there is a missing test, please let me know so I may add it. |
I guess the doc of the argument “extrapolate” should read “If bool, …” instead of “If true, …” to be consistent with the doc of CubicHermiteSpline and PPoly. @psmd-iberutaru |
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 modulo a couple of tolerances in tests. Generally, it's better to explicitly set e.g. assert_allclose(x, y, atol=1e-15)
to signal equality in the floating point.
ak_none = Akima1DInterpolator(x, y, extrapolate=None) | ||
# None should default to False; extrapolated points are NaN. | ||
assert_allclose(ak_false(x_ext), ak_none(x_ext), equal_nan=True) | ||
assert_equal(ak_false(x_ext)[0:4], np.full(4, np.nan)) |
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.
TIL that assert_equal(np.nan, np.nan)
is True not False.
Jake @j-bowhay , your review is red on GH, is there something you'd like to see in this PR? |
Past comment resolved, have not had time to review again
CI is green, review comments are addressed, the patch LGTM and is merged. Thank you @psmd-iberutaru, all. And congrats with your first scipy contribution! Keep them coming :-). |
Reference issue
Minor change. Closes #20247
What does this implement/fix?
We add the extrapolation parameter to the construction; passing it to the parent classes. We keep False as the default as that is the behavior of the function before this change.
Additional information