Skip to content

Commit

Permalink
Fix dev testing (#312)
Browse files Browse the repository at this point in the history
  • Loading branch information
WilliamJamieson authored Feb 5, 2024
1 parent 2af32d9 commit b398edb
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 6 deletions.
1 change: 1 addition & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/roman_datamodels/datamodels/_datamodels.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
"""

Expand Down
23 changes: 22 additions & 1 deletion src/roman_datamodels/maker_utils/_common_meta.py
Original file line number Diff line number Diff line change
@@ -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

Expand Down Expand Up @@ -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),
]
)
7 changes: 3 additions & 4 deletions src/roman_datamodels/maker_utils/_datamodels.py
Original file line number Diff line number Diff line change
@@ -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


Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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)

Expand Down

0 comments on commit b398edb

Please sign in to comment.