Skip to content
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

MAINT: interpolate/RGI: avoid unnecessary validation of data size #19591

Merged
merged 1 commit into from Nov 25, 2023

Conversation

ev-br
Copy link
Member

@ev-br ev-br commented Nov 25, 2023

RegularGridInterpolator allows changing the interpolation method at call site; if it is changed, data sizes need re-validation for a new method (cubics require at least four points and so on).

At the call site, __call__(..., method=None) means that the interpolation method is the same as self.method and thus there is no need to re-validate self.values.
Take this into account and avoid re-validation if method is None

RegularGridInterpolator allows changing the interpolation method
at call site; if it is changed, data sizes need re-validation for
a new method (cubics require at least four points and so on).

At the call site, `__call__(..., method=None)` means that the interpolation
method is the same as self.method and thus there is no need to re-validate
self.values.

RGI's interpolaton method (linear, cubic, etc) can be supplied in both
`__init__` and `__call__`. The former is stored on the instance, and
the latter allows changing the method for this particular call.
Further, `__call__(..., method=None)` means 'use self.method'.
@ev-br ev-br added scipy.interpolate maintenance Items related to regular maintenance tasks labels Nov 25, 2023
Copy link
Member

@j-bowhay j-bowhay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good spot!

@j-bowhay j-bowhay added this to the 1.12.0 milestone Nov 25, 2023
@j-bowhay j-bowhay merged commit 5ae735d into scipy:main Nov 25, 2023
22 of 23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
maintenance Items related to regular maintenance tasks scipy.interpolate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants