diff --git a/changes/1528.general.rst b/changes/1528.general.rst new file mode 100644 index 000000000..e7dc8c4f0 --- /dev/null +++ b/changes/1528.general.rst @@ -0,0 +1 @@ +Update romancal to use proper APE 14 API for GWCS interactions. diff --git a/romancal/resample/resample.py b/romancal/resample/resample.py index aa01c1b11..0e11fd629 100644 --- a/romancal/resample/resample.py +++ b/romancal/resample/resample.py @@ -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") @@ -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. diff --git a/romancal/tweakreg/tests/test_tweakreg.py b/romancal/tweakreg/tests/test_tweakreg.py index 288b860db..3c44ba976 100644 --- a/romancal/tweakreg/tests/test_tweakreg.py +++ b/romancal/tweakreg/tests/test_tweakreg.py @@ -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)) @@ -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")