Repository navigation
Replace np.float_ with np.float64 in imshow_utils for NumPy 2 - #5890
Closed
youssef-elaasri wants to merge 2 commits into
Closed
youssef-elaasri wants to merge 2 commits into
youssef-elaasri wants to merge 2 commits into
Conversation
np.float_ was removed in NumPy 2.0, so rescale_intensity(img, out_range=(a, b)) raised AttributeError.
Contributor
|
Thanks for the PR! Could you please open an issue for this and describe a use case where the library breaks due to this problem? Due to the volume of PRs we get, we need to validate issues and judge their impact first. |
2 tasks done
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Link to issue
Closes #5893
Description of change
_output_dtypeinplotly/express/imshow_utils.pyreturnednp.float_, which NumPy 2.0 removed, sorescale_intensity(..., out_range=(min, max))raisedAttributeError. It now returnsnp.float64, which is the typenp.float_aliased on NumPy 1.px.imshowitself only passesout_range=np.uint8, so this affects direct callers ofrescale_intensity.Testing strategy
Added
test_rescale_intensity_out_range_pair, which fails on NumPy 2 without the change and passes with it.Additional information (optional)
Found with pipbreak, a tool I wrote that checks installed packages for APIs their dependencies removed.
Guidelines