Skip to content

rescale_intensity in imshow_utils uses np.float_, removed in NumPy 2 #5893

Open

Description

@youssef-elaasri

plotly/express/imshow_utils.py (vendored from scikit-image) still returns np.float_ in _output_dtype. NumPy 2.0 removed it, so:

import numpy as np
from plotly.express.imshow_utils import rescale_intensity
rescale_intensity(np.arange(4, dtype=np.uint8), out_range=(0, 1))
# AttributeError: `np.float_` was removed in the NumPy 2.0 release. Use `np.float64` instead.

To be upfront about impact: px.imshow only calls it with out_range=np.uint8, so nothing breaks through the public API. I found this with a static checker, not from a user report, and I didn't find external code that calls rescale_intensity with a pair. It only affects direct callers of this helper. It's the one alias left over from #3997, which removed the other deprecated NumPy types from this file.

The fix is a one-line change (#5890). If it isn't worth the review time, feel free to close both.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions