From 9eb9bc40570b1bc587830bb07a21a713a3adc513 Mon Sep 17 00:00:00 2001 From: Mihai Cara Date: Mon, 27 Jan 2025 20:14:42 -0500 Subject: [PATCH 1/2] Test calc_pixmap --- jwst/resample/resample_utils.py | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/jwst/resample/resample_utils.py b/jwst/resample/resample_utils.py index da917d7e41..9a61ba3e1d 100644 --- a/jwst/resample/resample_utils.py +++ b/jwst/resample/resample_utils.py @@ -125,21 +125,24 @@ def shape_from_bounding_box(bounding_box): """ return tuple(int(axs[1] - axs[0] + 0.5) for axs in bounding_box[::-1]) +from drizzle.utils import calc_pixmap def calc_gwcs_pixmap(in_wcs, out_wcs, shape=None): """ Return a pixel grid map from input frame to output frame. """ - if shape: - bb = wcs_bbox_from_shape(shape) - log.debug("Bounding box from data shape: {}".format(bb)) - else: - bb = in_wcs.bounding_box - log.debug("Bounding box from WCS: {}".format(in_wcs.bounding_box)) + return calc_pixmap(in_wcs, out_wcs, shape=shape, disable_bbox="none") + + # if shape: + # bb = wcs_bbox_from_shape(shape) + # log.debug("Bounding box from data shape: {}".format(bb)) + # else: + # bb = in_wcs.bounding_box + # 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])) + # grid = gwcs.wcstools.grid_from_bounding_box(bb) + # pixmap = np.dstack(reproject(in_wcs, out_wcs)(grid[0], grid[1])) - return pixmap + # return pixmap def reproject(wcs1, wcs2): From b1f5a946b6aa1d84b0b5466380d9f498c13eb028 Mon Sep 17 00:00:00 2001 From: Mihai Cara Date: Mon, 27 Jan 2025 20:48:10 -0500 Subject: [PATCH 2/2] fix drizzle version --- pyproject.toml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 6de7c48487..8d82e40214 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -22,7 +22,8 @@ dependencies = [ "astropy>=6.1", "BayesicFitting>=3.0.1", "crds>=12.0.3", - "drizzle>=2.0.0", + # "drizzle>=2.0.0", + "drizzle @ git+https://github.com/mcara/drizzle.git@use-p2p-in-calc-pixmap", # "gwcs>=0.22.0,<0.23.0", "gwcs @ git+https://github.com/spacetelescope/gwcs.git@master", "numpy>=1.25,<2.0",