Skip to content

Commit

Permalink
Add configuration to choose jpg/png for Allsky file.
Browse files Browse the repository at this point in the history
  • Loading branch information
erykoff committed Sep 13, 2023
1 parent 266fd58 commit f34a2d8
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion python/lsst/pipe/tasks/hips.py
Original file line number Diff line number Diff line change
Expand Up @@ -835,6 +835,15 @@ class GenerateHipsConfig(pipeBase.PipelineTaskConfig,
default=64,
check=_is_power_of_two,
)
allsky_filetype = pexConfig.ChoiceField(
dtype=str,
doc="Allsky image file format.",
default="jpg",
allowed={
"jpg": "Create Allsky.jpg image.",
"png": "Create Allsky.png image.",
},
)
png_gray_asinh_minimum = pexConfig.Field(
doc="AsinhMapping intensity to be mapped to black for grayscale png scaling.",
dtype=float,
Expand Down Expand Up @@ -1534,6 +1543,7 @@ def _write_allsky_file(self, hips_base_path, allsky_order):
allsky_order : `int`
HEALPix order of the minimum order to make allsky file.
"""
file_type = self.config.allsky_filetype
tile_size = self.config.allsky_tilesize
n_tiles_per_side = int(np.sqrt(hpg.nside_to_npixel(hpg.order_to_nside(allsky_order))))

Expand Down Expand Up @@ -1564,7 +1574,7 @@ def _write_allsky_file(self, hips_base_path, allsky_order):
)
allsky_image.paste(tile_image_shrunk, box)

uri = allsky_order_uri.join("Allsky.png")
uri = allsky_order_uri.join(f"Allsky.{file_type}")

with ResourcePath.temporary_uri(suffix=uri.getExtension()) as temporary_uri:
allsky_image.save(temporary_uri.ospath)
Expand Down

0 comments on commit f34a2d8

Please sign in to comment.