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 c5fff59
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 5 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,13 @@ jobs:
envs: |
- linux: check-style
- linux: check-security
- linux: py310-xdist
- linux: py311-xdist
- linux: py313-xdist
- macos: py312-xdist
- windows: py312-xdist
- linux: py312-xdist-cov
coverage: codecov
- linux: py312-xdist-devdeps
secrets:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
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
16 changes: 15 additions & 1 deletion drizzle/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,21 @@ 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:
if hasattr(wcs_to, "bounding_box"):
orig_bbox = getattr(wcs_to, "bounding_box", None)
wcs_to.bounding_box = None
else:
orig_bbox = None
try:
x, y = wcs_to.world_to_pixel_values(
*wcs_from.pixel_to_world_values(x, y)
)
finally:
if orig_bbox is not None:
wcs_to.bounding_box = orig_bbox

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 @@ -6,8 +6,8 @@ authors = [
{ name = "STScI", email = "[email protected]" },
]
dependencies = [
"numpy",
"astropy",
"numpy",
]
dynamic = [
"version",
Expand Down

0 comments on commit c5fff59

Please sign in to comment.