Skip to content

Commit

Permalink
Merge pull request #827 from lsst/tickets/DM-40525
Browse files Browse the repository at this point in the history
DM-40525: Fix numpy invalid warnings with numpy 1.24
  • Loading branch information
erykoff committed Aug 28, 2023
2 parents a35e63b + 1918b8c commit 68a3911
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion python/lsst/pipe/tasks/hips.py
Original file line number Diff line number Diff line change
Expand Up @@ -1152,7 +1152,9 @@ def _write_hips_image(self, hips_base_path, order, pixel, image, png_mapping, sh

# And make a grayscale png as well

vals = 255 - png_mapping.map_intensity_to_uint8(image.array).astype(np.uint8)
with np.errstate(invalid="ignore"):
vals = 255 - png_mapping.map_intensity_to_uint8(image.array).astype(np.uint8)

vals[~np.isfinite(image.array) | (image.array < 0)] = 0
im = Image.fromarray(vals[::-1, :], "L")

Expand Down

0 comments on commit 68a3911

Please sign in to comment.