Skip to content

Commit

Permalink
Disable bounding box in calc_pixmap
Browse files Browse the repository at this point in the history
  • Loading branch information
mcara committed Dec 16, 2024
1 parent 8978081 commit 52b97fe
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 3 deletions.
8 changes: 8 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@
Release Notes
=============

2.0.1 (2024-12-16)
==================

- Update ``utils.calc_pixmap`` code to be ready for upcoming changes in GWCS
due to which inverse WCS transformations will respect bounding box by
disabling the bounding box when computing pixel map. [#164]


2.0.0 (2024-10-23)
==================

Expand Down
2 changes: 1 addition & 1 deletion drizzle/resample.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

from drizzle import cdrizzle

__all__ = ["blot_image", "Drizzle"]
__all__ = ["Drizzle", "blot_image"]

SUPPORTED_DRIZZLE_KERNELS = [
"square",
Expand Down
12 changes: 11 additions & 1 deletion drizzle/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,17 @@ def calc_pixmap(wcs_from, wcs_to, shape=None):
)

y, x = np.indices(shape, dtype=np.float64)
x, y = wcs_to.world_to_pixel_values(*wcs_from.pixel_to_world_values(x, y))

# temporarily disable the bounding box:
orig_bbox = wcs_to.bounding_box
wcs_to.bounding_box = None
try:
x, y = wcs_to.world_to_pixel_values(

Check warning on line 82 in drizzle/utils.py

View check run for this annotation

Codecov / codecov/patch

drizzle/utils.py#L79-L82

Added lines #L79 - L82 were not covered by tests
*wcs_from.pixel_to_world_values(x, y)
)
finally:
wcs_to.bounding_box = orig_bbox

Check warning on line 86 in drizzle/utils.py

View check run for this annotation

Codecov / codecov/patch

drizzle/utils.py#L86

Added line #L86 was not covered by tests

pixmap = np.dstack([x, y])
return pixmap

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ authors = [
]
dependencies = [
"numpy",
"astropy",
]
dynamic = [
"version",
Expand All @@ -29,6 +28,7 @@ Documentation = "http://spacetelescope.github.io/drizzle/"

[project.optional-dependencies]
test = [
"astropy",
"pytest",
"pytest-cov",
"pytest-doctestplus",
Expand Down

0 comments on commit 52b97fe

Please sign in to comment.