toasty/fits_tiler.py: check if hips_{pixel_cut,data_range} are present

In one test image I have, hipsgen produces a "BAD PIXEL CUT" warning and
doesn't emit this information. (I think it's because the file has an
integer data type.) Avoid the crash if this is the case.
This commit is contained in:
Peter Williams 2022-08-24 08:07:23 -04:00
Родитель 8c45b1c45c
Коммит 07832f7710
1 изменённых файлов: 14 добавлений и 6 удалений

Просмотреть файл

@ -388,11 +388,19 @@ class FitsTiler(object):
self.builder.imgset.base_degrees_per_tile = float(
hips_properties["hips_initial_fov"]
)
pixel_cut = hips_properties["hips_pixel_cut"].split(" ")
self.builder.imgset.pixel_cut_low = float(pixel_cut[0])
self.builder.imgset.pixel_cut_high = float(pixel_cut[1])
data_range = hips_properties["hips_data_range"].split(" ")
self.builder.imgset.data_min = float(data_range[0])
self.builder.imgset.data_max = float(data_range[1])
pixel_cut = hips_properties.get("hips_pixel_cut")
if pixel_cut is not None:
pixel_cut = pixel_cut.split(" ")
self.builder.imgset.pixel_cut_low = float(pixel_cut[0])
self.builder.imgset.pixel_cut_high = float(pixel_cut[1])
data_range = hips_properties.get("hips_data_range")
if data_range is not None:
data_range = data_range.split(" ")
self.builder.imgset.data_min = float(data_range[0])
self.builder.imgset.data_max = float(data_range[1])
self.builder.imgset.url = "Norder{0}/Dir{1}/Npix{2}"