Skip to content

Commit

Permalink
Fix some of the unit test failures due to GWCS.invert using bbox
Browse files Browse the repository at this point in the history
  • Loading branch information
mcara committed Dec 19, 2024
1 parent 9f1bbbd commit 1c2f9a8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
12 changes: 11 additions & 1 deletion jwst/resample/resample_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,17 @@ def calc_gwcs_pixmap(in_wcs, out_wcs, shape=None):
log.debug("Bounding box from WCS: {}".format(in_wcs.bounding_box))

grid = gwcs.wcstools.grid_from_bounding_box(bb)
pixmap = np.dstack(reproject(in_wcs, out_wcs)(grid[0], grid[1]))

if hasattr(out_wcs, "bounding_box"):
orig_bbox = getattr(out_wcs, "bounding_box", None)
out_wcs.bounding_box = None
else:
orig_bbox = None
try:
pixmap = np.dstack(reproject(in_wcs, out_wcs)(grid[0], grid[1]))
finally:
if orig_bbox is not None:
out_wcs.bounding_box = orig_bbox

return pixmap

Expand Down
1 change: 1 addition & 0 deletions jwst/skymatch/skymatch_step.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ def _imodel2skyim(self, image_model, index):
.format(image_model.meta.filename))

wcs = deepcopy(image_model.meta.wcs)
wcs.bounding_box = None

sky_im = SkyImage(
image=image_model.data,
Expand Down

0 comments on commit 1c2f9a8

Please sign in to comment.