From bae04188aff4e74c47a8d71aa56c8378d341e384 Mon Sep 17 00:00:00 2001 From: Mihai Cara Date: Mon, 16 Dec 2024 17:13:01 -0500 Subject: [PATCH] Fix issues in outlier det. due to GWCS.inverse enforcing bbox --- src/stcal/outlier_detection/utils.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/stcal/outlier_detection/utils.py b/src/stcal/outlier_detection/utils.py index 00b577ac..8717bc21 100644 --- a/src/stcal/outlier_detection/utils.py +++ b/src/stcal/outlier_detection/utils.py @@ -284,7 +284,18 @@ 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: + orig_bbox = out_wcs.bounding_box + out_wcs.bounding_box = None + try: + pixmap = np.dstack(reproject(in_wcs, out_wcs)(grid[0], grid[1])) + finally: + # restore bounding box: + if orig_bbox is not None: + out_wcs.bounding_box = orig_bbox + + return pixmap def reproject(wcs1, wcs2):