Skip to content

Commit

Permalink
Fix issues in outlier det. due to GWCS.inverse enforcing bbox
Browse files Browse the repository at this point in the history
  • Loading branch information
mcara committed Dec 16, 2024
1 parent 4953380 commit f43c2ab
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/stcal/outlier_detection/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,20 @@ def calc_gwcs_pixmap(in_wcs, out_wcs, in_shape):
log.debug("Bounding box from data shape: {}".format(bb))

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

# temporarily disable the bounding box:
if hasattr(out_wcs, "bounding_box"):
orig_bbox = getattr(out_wcs, "bounding_box", None)
out_wcs.bounding_box = None
else:
orig_bbox = None

Check warning on line 293 in src/stcal/outlier_detection/utils.py

View check run for this annotation

Codecov / codecov/patch

src/stcal/outlier_detection/utils.py#L293

Added line #L293 was not covered by tests
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

Check warning on line 298 in src/stcal/outlier_detection/utils.py

View check run for this annotation

Codecov / codecov/patch

src/stcal/outlier_detection/utils.py#L298

Added line #L298 was not covered by tests

return pixmap


def reproject(wcs1, wcs2):
Expand Down

0 comments on commit f43c2ab

Please sign in to comment.