Skip to content

Commit

Permalink
Wrap cast to uint8 to ignore invalid warnings.
Browse files Browse the repository at this point in the history
  • Loading branch information
erykoff committed Aug 28, 2023
1 parent a35e63b commit 1918b8c
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 1918b8c

Please sign in to comment.