Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

FIX: Handle uint8 indices properly for colormap lookups#24970

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
QuLogic merged 1 commit intomatplotlib:mainfromgreglucas:cmap-cast
Jan 14, 2023

Conversation

@greglucas
Copy link
Contributor

PR Summary

Since we use subtraction to compute the lookup table indices we need to castuints in addition tofloats, so we can move the cast outside of the float block.

closes#24865

PR Checklist

Documentation and Tests

  • Has pytest style unit tests (andpytest passes)
  • [N/A] Documentation is sphinx and numpydoc compliant (the docs shouldbuild without error).
  • [N/A] New plotting related features are documented with examples.

Release Notes

  • [N/A] New features are marked with a.. versionadded:: directive in the docstring and documented indoc/users/next_whats_new/
  • [N/A] API changes are marked with a.. versionchanged:: directive in the docstring and documented indoc/api/next_api_changes/
  • [N/A] Release notes conform with instructions innext_whats_new/README.rst ornext_api_changes/README.rst

xa[xa==self.N]=self.N-1
# Avoid converting large positive values to negative integers.
np.clip(xa,-1,self.N,out=xa)
withnp.errstate(invalid="ignore"):
Copy link
Contributor

Choose a reason for hiding this comment

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

Is the errstate even still needed? AFAICT casting nan to int doesn't trigger an "invalid" error.

Copy link
ContributorAuthor

@greglucasgreglucasJan 13, 2023
edited
Loading

Choose a reason for hiding this comment

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

I get one with it and get lots of failures in the pytest suite without ignoring.

python -c "import numpy; numpy.array([numpy.nan]).astype(int)"<string>:1: RuntimeWarning: invalid value encountered in cast

@QuLogicQuLogic merged commit99d39bd intomatplotlib:mainJan 14, 2023
meeseeksmachine pushed a commit to meeseeksmachine/matplotlib that referenced this pull requestJan 14, 2023
rcomer added a commit that referenced this pull requestJan 14, 2023
…970-on-v3.7.xBackport PR#24970 on branch v3.7.x (FIX: Handle uint8 indices properly for colormap lookups)
@greglucasgreglucas deleted the cmap-cast branchJanuary 31, 2023 17:32
@ksundenksunden mentioned this pull requestFeb 20, 2023
6 tasks
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@anntzeranntzeranntzer left review comments

@tacaswelltacaswelltacaswell approved these changes

@QuLogicQuLogicQuLogic approved these changes

Assignees

No one assigned

Projects

None yet

Milestone

v3.7.0

Development

Successfully merging this pull request may close these issues.

[Bug]: NumPy 1.24 deprecation warnings

4 participants

@greglucas@tacaswell@QuLogic@anntzer

[8]ページ先頭

©2009-2025 Movatter.jp