Skip to content

Commit

Permalink
simplify size computation
Browse files Browse the repository at this point in the history
  • Loading branch information
mcara committed Dec 20, 2024
1 parent 221520d commit 456365e
Showing 1 changed file with 15 additions and 20 deletions.
35 changes: 15 additions & 20 deletions src/stcal/alignment/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ def _get_axis_min_and_bounding_box(footprints: list[np.ndarray],
output_bounding_box = []
for axis in ref_wcs.output_frame.axes_order:
axis_min, axis_max = (
domain_bounds[axis].min(),
0.0,
domain_bounds[axis].max(),
)
# populate output_bounding_box
Expand Down Expand Up @@ -327,25 +327,20 @@ def _calculate_new_wcs(wcs: gwcs.wcs.WCS,
wcs_new.bounding_box = output_bounding_box

if shape is None:
if crpix is None:
shape = [
int(axs[1] - axs[0] + 0.5) for axs in output_bounding_box[::-1]
]
else:
shape = []
for k, axs in enumerate(output_bounding_box[::-1]):
upper = int(axs[1] + 0.5)
if upper < 1:
log.warning(
"Input images do not overlap with created WCS. "
"Consider adjusting crval and/or crpix values."
)
log.warning(
"Setting minimum array dimension for axis %d to 10."
% (len(output_bounding_box) - k)
)
upper = 10
shape.append(upper)
shape = []
for k, axs in enumerate(output_bounding_box[::-1]):
upper = int(axs[1] + 0.5)
if upper < 1:
log.warning(
"Input images do not overlap with created WCS. "
"Consider adjusting crval and/or crpix values."
)
log.warning(
"Setting minimum array dimension for axis %d to 10."
% (len(output_bounding_box) - k)
)
upper = 10
shape.append(upper)

wcs_new.pixel_shape = shape[::-1]
wcs_new.array_shape = shape
Expand Down

0 comments on commit 456365e

Please sign in to comment.