Skip to content

Commit

Permalink
Change world_to_pixel to world_to_pixel_values so that usage conf…
Browse files Browse the repository at this point in the history
…orms to the APE 14 API which GWCS will be explicilty enforcing
  • Loading branch information
WilliamJamieson committed Dec 11, 2024
1 parent e2d5fb9 commit 41d2314
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
4 changes: 2 additions & 2 deletions romancal/resample/resample.py
Original file line number Diff line number Diff line change
Expand Up @@ -876,7 +876,7 @@ def calc_pa(wcs, ra, dec):
The position angle in degrees.
"""
delta_pix = [v for v in wcs.world_to_pixel(ra, dec)]
delta_pix = [v for v in wcs.world_to_pixel_values(ra, dec)]
delta_pix[1] += 1
delta_coord = wcs.pixel_to_world(*delta_pix)
coord = SkyCoord(ra, dec, frame="icrs", unit="deg")
Expand All @@ -885,7 +885,7 @@ def calc_pa(wcs, ra, dec):


def populate_mosaic_basic(
output_model: datamodels.MosaicModel, input_models: [List, ModelLibrary]
output_model: datamodels.MosaicModel, input_models: list | ModelLibrary
):
"""
Populate basic metadata fields in the output mosaic model based on input models.
Expand Down
7 changes: 5 additions & 2 deletions romancal/tweakreg/tests/test_tweakreg.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,10 @@ def get_catalog_data(input_dm, **kwargs):
gaia_cat = get_catalog(right_ascension=ra, declination=dec, search_radius=sr)
gaia_source_coords = [(ra, dec) for ra, dec in zip(gaia_cat["ra"], gaia_cat["dec"])]
catalog_data = np.array(
[input_dm.meta.wcs.world_to_pixel(ra, dec) for ra, dec in gaia_source_coords]
[
input_dm.meta.wcs.world_to_pixel_values(ra, dec)
for ra, dec in gaia_source_coords
]
)
if add_shifts:
rng = np.random.default_rng(seed=int(ra + dec))
Expand Down Expand Up @@ -796,7 +799,7 @@ def test_tweakreg_rotated_plane(tmp_path, theta, offset_x, offset_y, request):

# calculate original (x,y) for Gaia sources
original_xy_gaia_sources = np.array(
[original_wcs.world_to_pixel(ra, dec) for ra, dec in gaia_source_coords]
[original_wcs.world_to_pixel_values(ra, dec) for ra, dec in gaia_source_coords]
)
# move Gaia sources around by applying linear transformations
# to their coords in the projected plane (same as a "wrong WCS")
Expand Down

0 comments on commit 41d2314

Please sign in to comment.