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

DM-40525: Fix numpy invalid warnings with numpy 1.24 #827

Merged
merged 1 commit into from Aug 28, 2023
Merged

Conversation

erykoff
Copy link
Contributor

@erykoff erykoff commented Aug 28, 2023

No description provided.

@erykoff erykoff requested a review from parejkoj August 28, 2023 18:53
Copy link
Contributor

@parejkoj parejkoj left a comment

Choose a reason for hiding this comment

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

Unfortunate, but it's fine.

Comment on lines +1155 to +1156
with np.errstate(invalid="ignore"):
vals = 255 - png_mapping.map_intensity_to_uint8(image.array).astype(np.uint8)
Copy link
Contributor

Choose a reason for hiding this comment

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

Looking into the astropy code (which I contributed from our afw version), it has exactly this context manager, except it doesn't do the astype(uint8) cast (intentionally, per the docstring). It's unfortunate that we need to wrap it twice like this, but I guess it's fine (since the astropy method can't do the cast, due to how it's used internally).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Well, the unfortunate part is that the astropy wrap is unnecessary; or at least I couldn't figure out how to get a warning to trigger with just the clip. But maybe I wasn't giving it the "correct" inputs?

Copy link
Contributor

Choose a reason for hiding this comment

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

Hmmm... those lines go back to RHL's initial implementation circa 2016, so who knows:

https://github.com/lsst/afw/blame/d3e8bac1ddff3274abec121fc06602073268ac50/python/lsst/afw/display/rgb.py

@erykoff erykoff merged commit 68a3911 into main Aug 28, 2023
2 checks passed
@erykoff erykoff deleted the tickets/DM-40525 branch August 28, 2023 21:02
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.

None yet

2 participants