Skip to content

Commit 9cdaf94

Browse files
Resolve issues with GWCS API (#1528)
1 parent e2d5fb9 commit 9cdaf94

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

changes/1528.general.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Update romancal to use proper APE 14 API for GWCS interactions.

romancal/resample/resample.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -876,7 +876,7 @@ def calc_pa(wcs, ra, dec):
876876
The position angle in degrees.
877877
878878
"""
879-
delta_pix = [v for v in wcs.world_to_pixel(ra, dec)]
879+
delta_pix = [v for v in wcs.world_to_pixel_values(ra, dec)]
880880
delta_pix[1] += 1
881881
delta_coord = wcs.pixel_to_world(*delta_pix)
882882
coord = SkyCoord(ra, dec, frame="icrs", unit="deg")
@@ -885,7 +885,7 @@ def calc_pa(wcs, ra, dec):
885885

886886

887887
def populate_mosaic_basic(
888-
output_model: datamodels.MosaicModel, input_models: [List, ModelLibrary]
888+
output_model: datamodels.MosaicModel, input_models: list | ModelLibrary
889889
):
890890
"""
891891
Populate basic metadata fields in the output mosaic model based on input models.

romancal/tweakreg/tests/test_tweakreg.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,10 @@ def get_catalog_data(input_dm, **kwargs):
349349
gaia_cat = get_catalog(right_ascension=ra, declination=dec, search_radius=sr)
350350
gaia_source_coords = [(ra, dec) for ra, dec in zip(gaia_cat["ra"], gaia_cat["dec"])]
351351
catalog_data = np.array(
352-
[input_dm.meta.wcs.world_to_pixel(ra, dec) for ra, dec in gaia_source_coords]
352+
[
353+
input_dm.meta.wcs.world_to_pixel_values(ra, dec)
354+
for ra, dec in gaia_source_coords
355+
]
353356
)
354357
if add_shifts:
355358
rng = np.random.default_rng(seed=int(ra + dec))
@@ -796,7 +799,7 @@ def test_tweakreg_rotated_plane(tmp_path, theta, offset_x, offset_y, request):
796799

797800
# calculate original (x,y) for Gaia sources
798801
original_xy_gaia_sources = np.array(
799-
[original_wcs.world_to_pixel(ra, dec) for ra, dec in gaia_source_coords]
802+
[original_wcs.world_to_pixel_values(ra, dec) for ra, dec in gaia_source_coords]
800803
)
801804
# move Gaia sources around by applying linear transformations
802805
# to their coords in the projected plane (same as a "wrong WCS")

0 commit comments

Comments
 (0)