Skip to content

Commit f1abf53

Browse files
authored
Merge pull request #575 from astrofrog/hips-fixes-3
Fixes to NaN padding in HiPS
2 parents c7aebc0 + 436a361 commit f1abf53

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

reproject/hips/_trim_utils.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,12 @@ def fits_getdata_untrimmed(filename, *, tile_size, tile_depth):
4444
tile_size - shape[2] - pad_before[2],
4545
)
4646

47-
data = np.pad(data, list(zip(pad_before, pad_after, strict=False)))
47+
data = np.pad(
48+
data,
49+
list(zip(pad_before, pad_after, strict=False)),
50+
mode="constant",
51+
constant_values=np.nan,
52+
)
4853

4954
assert data.shape == (tile_depth, tile_size, tile_size)
5055

reproject/hips/high_level.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -471,7 +471,7 @@ def process(index):
471471
if tile_format == "fits":
472472
generated_properties["hips_pixel_bitpix"] = -64
473473
if not np.isinf(pixel_min) and not np.isinf(pixel_max):
474-
properties["hips_pixel_cut"] = f"{pixel_min} {pixel_max}"
474+
generated_properties["hips_pixel_cut"] = f"{pixel_min} {pixel_max}"
475475

476476
generated_properties.update(properties)
477477

@@ -583,7 +583,7 @@ def compute_lower_resolution_tiles(
583583
if ndim == 2:
584584

585585
if tile_format == "fits":
586-
array = np.zeros((tile_size, tile_size))
586+
array = np.zeros((tile_size, tile_size)) * np.nan
587587
elif tile_format == "png":
588588
array = np.zeros((tile_size, tile_size, 4), dtype=np.uint8)
589589
else:

0 commit comments

Comments
 (0)