Skip to content

Commit

Permalink
remove usages of numpy float, Fixes #50 (#51)
Browse files Browse the repository at this point in the history
  • Loading branch information
ricoms authored Jan 17, 2023
1 parent 5518b7f commit 1fb11b2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion ipyplot/_img_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def _img_to_base64(
""" # NOQA E501
# if statements to convert image to PIL.Image object
if isinstance(image, np.ndarray):
if image.dtype in [np.float, np.float32, np.float64]:
if image.dtype in [np.float32, np.float64]:
# if dtype is float and values range is from 0.0 to 1.0
# we need to normalize it to 0-255 range
image = image * 255 if image.max() <= 1.0 else image
Expand Down
2 changes: 1 addition & 1 deletion tests/test_plotting.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
(np.asarray(BASE_NP_IMGS), LABELS[1], LABELS[0]),
(np.asarray(BASE_INTERNET_URLS), LABELS[1], LABELS[0]),
(np.asarray(BASE_LOCAL_URLS), LABELS[1], LABELS[0]),
(np.asarray(BASE_NP_IMGS, dtype=np.float) / 255, LABELS[1], LABELS[0]),
(np.asarray(BASE_NP_IMGS, dtype=np.float32) / 255, LABELS[1], LABELS[0]),
(LOCAL_URLS_AS_PIL, LABELS[0], LABELS[0]),
(LOCAL_URLS_AS_PIL, LABELS[1], LABELS[1]),
(LOCAL_URLS_AS_PIL, LABELS[2], LABELS[2]),
Expand Down

0 comments on commit 1fb11b2

Please sign in to comment.