From 8a10e8fdb46b78b752ec5c93e8608c5fbe676365 Mon Sep 17 00:00:00 2001 From: William Jamieson Date: Mon, 5 Feb 2024 11:07:30 -0500 Subject: [PATCH 1/3] Add pyerfa to dev tests to fix failures --- requirements-dev.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/requirements-dev.txt b/requirements-dev.txt index bf10060a..f42d2cc6 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -6,6 +6,7 @@ git+https://github.com/astropy/asdf-astropy # Use weekly astropy dev build --extra-index-url https://pypi.anaconda.org/astropy/simple astropy --pre +--extra-index-url https://pypi.anaconda.org/liberfa/simple pyerfa --pre # Use Bi-weekly numpy/scipy dev builds --extra-index-url https://pypi.anaconda.org/scientific-python-nightly-wheels/simple From 9cf16895818cf9f596e60e246658f881cfa40854 Mon Sep 17 00:00:00 2001 From: William Jamieson Date: Mon, 5 Feb 2024 11:18:45 -0500 Subject: [PATCH 2/3] Attempt to fix the docs --- src/roman_datamodels/datamodels/_datamodels.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/roman_datamodels/datamodels/_datamodels.py b/src/roman_datamodels/datamodels/_datamodels.py index af6aab72..7165ac9a 100644 --- a/src/roman_datamodels/datamodels/_datamodels.py +++ b/src/roman_datamodels/datamodels/_datamodels.py @@ -58,7 +58,7 @@ def append_individual_image_meta(self, meta): Parameters ---------- - meta : stnode or dict + meta : roman_datamodels.stnode._node.DNode or dict Metadata from a component image of the mosiac. """ From c2384774c15763b89a472a08c88db460eb50e64d Mon Sep 17 00:00:00 2001 From: William Jamieson Date: Mon, 5 Feb 2024 11:47:56 -0500 Subject: [PATCH 3/3] Attempt to fix dev --- .../maker_utils/_common_meta.py | 23 ++++++++++++++++++- .../maker_utils/_datamodels.py | 7 +++--- 2 files changed, 25 insertions(+), 5 deletions(-) diff --git a/src/roman_datamodels/maker_utils/_common_meta.py b/src/roman_datamodels/maker_utils/_common_meta.py index acaf6e92..a7a9c53f 100644 --- a/src/roman_datamodels/maker_utils/_common_meta.py +++ b/src/roman_datamodels/maker_utils/_common_meta.py @@ -1,6 +1,9 @@ -from astropy import time +from astropy import coordinates, time from astropy import units as u +from astropy.modeling import models from astropy.table import QTable +from gwcs import coordinate_frames +from gwcs.wcs import WCS from roman_datamodels import stnode @@ -773,3 +776,21 @@ def mk_individual_image_meta(**kwargs): imm["wcsinfo"] = kwargs.get("wcsinfo", QTable(table_dct)) return imm + + +def mk_wcs(): + pixelshift = models.Shift(-500) & models.Shift(-500) + pixelscale = models.Scale(0.1 / 3600.0) & models.Scale(0.1 / 3600.0) # 0.1 arcsec/pixel + tangent_projection = models.Pix2Sky_TAN() + celestial_rotation = models.RotateNative2Celestial(30.0, 45.0, 180.0) + + det2sky = pixelshift | pixelscale | tangent_projection | celestial_rotation + + detector_frame = coordinate_frames.Frame2D(name="detector", axes_names=("x", "y"), unit=(u.pix, u.pix)) + sky_frame = coordinate_frames.CelestialFrame(reference_frame=coordinates.ICRS(), name="icrs", unit=(u.deg, u.deg)) + return WCS( + [ + (detector_frame, det2sky), + (sky_frame, None), + ] + ) diff --git a/src/roman_datamodels/maker_utils/_datamodels.py b/src/roman_datamodels/maker_utils/_datamodels.py index 93d81a71..45e8097f 100644 --- a/src/roman_datamodels/maker_utils/_datamodels.py +++ b/src/roman_datamodels/maker_utils/_datamodels.py @@ -1,13 +1,12 @@ import warnings -import gwcs import numpy as np from astropy import units as u from roman_datamodels import stnode from ._base import MESSAGE, save_node -from ._common_meta import mk_common_meta, mk_guidewindow_meta, mk_mosaic_meta, mk_msos_stack_meta, mk_photometry_meta +from ._common_meta import mk_common_meta, mk_guidewindow_meta, mk_mosaic_meta, mk_msos_stack_meta, mk_photometry_meta, mk_wcs from ._tagged_nodes import mk_cal_logs @@ -137,7 +136,7 @@ def mk_level2_image(*, shape=(4088, 4088), n_groups=8, filepath=None, **kwargs): ) wfi_image["cal_logs"] = mk_cal_logs(**kwargs) - wfi_image["meta"]["wcs"] = gwcs.WCS(output_frame="icrs") + wfi_image["meta"]["wcs"] = mk_wcs() return save_node(wfi_image, filepath=filepath) @@ -192,7 +191,7 @@ def mk_level3_mosaic(*, shape=(4088, 4088), n_images=2, filepath=None, **kwargs) ) wfi_mosaic["cal_logs"] = mk_cal_logs(**kwargs) - wfi_mosaic["meta"]["wcs"] = gwcs.WCS(output_frame="icrs") + wfi_mosaic["meta"]["wcs"] = mk_wcs() return save_node(wfi_mosaic, filepath=filepath)