Skip to content

Commit

Permalink
Use astropy pixel_to_pixel in calc_pixmap
Browse files Browse the repository at this point in the history
  • Loading branch information
mcara committed Jan 20, 2025
1 parent d0179b6 commit 1ad0459
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
4 changes: 3 additions & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@
Release Notes
=============

2.0.1 (Unreleased)
2.0.1 (unreleased)
==================

- Use ``astropy``'s ``pixel_to_pixel()`` in ``utils.calc_pixmap()``. [#161]

- Update ``utils.calc_pixmap`` code to be ready for upcoming changes in GWCS
due to which inverse WCS transformations will respect bounding box by
allowing the caller of ``utils.calc_pixmap`` to disable the bounding box(es)
Expand Down
6 changes: 3 additions & 3 deletions drizzle/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import numpy as np

from astropy.wcs.utils import pixel_to_pixel

__all__ = ["calc_pixmap", "decode_context", "estimate_pixel_scale_ratio"]

_DEG2RAD = math.pi / 180.0
Expand Down Expand Up @@ -112,9 +114,7 @@ def calc_pixmap(wcs_from, wcs_to, shape=None, disable_bbox="to"):
if disable_bbox in ["to", "both"] and bbox_to is not None:
wcs_to.bounding_box = None
try:
x, y = wcs_to.world_to_pixel_values(
*wcs_from.pixel_to_world_values(x, y)
)
x, y = pixel_to_pixel(wcs_from, wcs_to, x, y)
finally:
if bbox_from is not None:
wcs_from.bounding_box = bbox_from
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ authors = [
]
dependencies = [
"numpy",
"astropy>=5.0",
]
dynamic = [
"version",
Expand Down

0 comments on commit 1ad0459

Please sign in to comment.