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
Fix WCSAxes sometimes emitting RuntimeWarning with NumPy 1.24 #14211
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This comment was marked as outdated.
This comment was marked as outdated.
ayshih
force-pushed
the
trunc
branch
2 times, most recently
from
December 22, 2022 17:02
fbf154e
to
f7c8289
Compare
ayshih
requested review from
astrofrog,
Cadair and
larrybradley
as code owners
December 22, 2022 18:27
pllim
added
Bug
💤 backport-v5.0.x
on-merge: backport to v5.0.x
💤 backport-v5.2.x
on-merge: backport to v5.2.x
labels
Dec 23, 2022
Since this actually fixes something, I think we need a change log. Can you please add one? Thanks! |
Cadair
approved these changes
Dec 23, 2022
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 good to me.
Change log aside, a rebase would also get rid of the failures. Thanks! |
Changelog added, and rebased |
pllim
reviewed
Dec 24, 2022
[ci skip]
This comment was marked as resolved.
This comment was marked as resolved.
meeseeksmachine
pushed a commit
to meeseeksmachine/astropy
that referenced
this pull request
Dec 24, 2022
…ing with NumPy 1.24
This comment was marked as resolved.
This comment was marked as resolved.
pllim
added a commit
that referenced
this pull request
Dec 24, 2022
…211-on-v5.2.x Backport PR #14211 on branch v5.2.x (Fix WCSAxes sometimes emitting RuntimeWarning with NumPy 1.24)
pllim
added a commit
to pllim/astropy
that referenced
this pull request
Dec 27, 2022
Merge pull request astropy#14211 from ayshih/trunc Fix WCSAxes sometimes emitting RuntimeWarning with NumPy 1.24 (cherry picked from commit 9ee4a46)
10 tasks
Manual backport to v5.0.x at #14234 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Bug
visualization.wcsaxes
💤 backport-v5.0.x
on-merge: backport to v5.0.x
💤 backport-v5.2.x
on-merge: backport to v5.2.x
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
As of NumPy 1.24 (specifically, numpy/numpy#21437), casting a NaN to an integer produces a
RuntimeWarning
.astropy.visualization.wcsaxes.coordinate_range.find_coordinate_range()
uses.astype(int)
to truncate an array to integers, but the array can have NaNs because it is the result of a transformation to world coordinates. Not only does that produce aRuntimeWarning
, the resulting array has garbage integers where the NaNs were, which is silly because the array is immediately turned back into a float array.This PR replaces those uses with
np.trunc()
.