Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test calc_pixmap #9099

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 12 additions & 9 deletions jwst/resample/resample_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Loading