Skip to content

less_simple_linear_interpolation can be replaced by np.interp. #9865

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

Merged
merged 1 commit into from
Dec 2, 2017

Conversation

anntzer
Copy link
Contributor

@anntzer anntzer commented Nov 27, 2017

Also, in contour (the only place that used it), -1 (instead of nan) is
a perfectly reasonable marker for out of bounds which avoids having to
dance with the errstate.

Replaces #9859: @efiring pointed out and I confirmed that we neither implement nor need linear extrapolation, so np.interp is perfectly sufficient.

Made a separate PR as the approach is somewhat different.

PR Summary

PR Checklist

  • Has Pytest style unit tests
  • Code is PEP 8 compliant
  • New features are documented, with examples if plot related
  • Documentation is sphinx and numpydoc compliant
  • Added an entry to doc/users/next_whats_new/ if major new feature (follow instructions in README.rst there)
  • Documented in doc/api/api_changes.rst if API changed in a backward-incompatible way

@jklymak
Copy link
Member

jklymak commented Nov 28, 2017

Tiny image error on the mac: I don't have time right now, but could try to see what the difference is later tonight.

@jklymak jklymak added this to the v2.2 milestone Nov 28, 2017
@anntzer
Copy link
Contributor Author

anntzer commented Nov 28, 2017

that'd be very helpful, thanks

@jklymak
Copy link
Member

jklymak commented Nov 28, 2017

The image error is:

E           matplotlib.testing.exceptions.ImageComparisonFailure: images not close (RMS 0.015):
E           	result_images/test_patheffects/collection.png
E           	result_images/test_patheffects/collection-expected.png

If I look at the diff image, I can't see where the difference is, and the images look fine. I'd suggest raising the tolerance for this one.

@jklymak
Copy link
Member

jklymak commented Nov 28, 2017

Not sure if github keeps the resolution:

collection-failed-diff

@anntzer
Copy link
Contributor Author

anntzer commented Nov 28, 2017

We're probably running into some 32-vs-64 bit rounding error that's a bit bigger for interp; that test actually already had a nonzero tolerance so I feel comfortable increasing it a bit.

@@ -289,6 +289,7 @@ def get_label_width(self, lev, fmt, fsize):

return lw

@cbook.deprecated("2.2")
Copy link
Member

Choose a reason for hiding this comment

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

This seems unrelated. Can you remove it or add an API changes doc?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

moved to its own PR

@@ -3404,6 +3404,7 @@ def griddata(x, y, z, xi, yi, interp='nn'):
##################################################
# Linear interpolation algorithms
##################################################
@cbook.deprecated("2.2", alternative="np.interp")
Copy link
Member

Choose a reason for hiding this comment

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

This needs API changes docs.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

Also, in contour (the only place that used it), -1 (instead of nan) is
a perfectly reasonable marker for out of bounds which avoids having to
dance with the errstate.
@jklymak jklymak merged commit 27090ee into matplotlib:master Dec 2, 2017
@jklymak
Copy link
Member

jklymak commented Dec 2, 2017

Thanks @anntzer

@anntzer anntzer deleted the linear-interp-2 branch December 2, 2017 22:25
@QuLogic QuLogic modified the milestones: needs sorting, v2.2.0 Feb 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants