Skip to content

Commit

Permalink
respect the bounding box on the inverse transform
Browse files Browse the repository at this point in the history
  • Loading branch information
Nadia authored and nden committed Nov 8, 2024
1 parent 088212b commit e51d239
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 7 deletions.
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ dependencies = [
"asdf-astropy >=0.5.0",
"astropy >=5.3.0",
"crds >=11.16.16",
"gwcs >=0.21.0",
#"gwcs >=0.21.0",
"gwcs @ git+https://github.com/nden/gwcs.git@inverse-bbox",
"jsonschema >=4.8",
"numpy >=1.23",
"photutils >=1.13.0",
Expand Down
19 changes: 14 additions & 5 deletions romancal/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,10 +237,19 @@ def base_image():
"""

def _base_image(shift_1=0, shift_2=0):
l2 = maker_utils.mk_level2_image(shape=(100, 100))
l2_im = rdm.ImageModel(l2)
_create_wcs(l2_im)
l2_im.meta.wcsinfo.vparity = -1
return l2_im
model = maker_utils.mk_level2_image(shape=(100, 100))
model.meta.wcsinfo["vparity"] = -1
model.meta.wcsinfo["ra_ref"] = 178.37567
model.meta.wcsinfo["dec_ref"] = -2.674389
model.meta.wcsinfo["v2_ref"] = 2216.3796908471754
model.meta.wcsinfo["v3_ref"] = 130.234233411109
model.meta.wcsinfo["v3yangle"] = -60.0
model.meta.wcsinfo["roll_ref"] = 60.0
img = rdm.ImageModel(model)
transform = pointing.v23tosky(img)
img.meta.wcs.set_transform('detector', 'icrs', transform)
img.meta.wcs.bounding_box = ((-0.5, 2300), (-0.5, 200))

return img

return _base_image
11 changes: 10 additions & 1 deletion romancal/resample/tests/test_resample_step.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from gwcs import coordinate_frames as cf
from roman_datamodels import datamodels, maker_utils

from romancal.assign_wcs import pointing
from romancal.resample import ResampleStep, resample_utils


Expand Down Expand Up @@ -337,8 +338,16 @@ def test_build_driz_weight_multiple_good_bits(
def test_set_good_bits_in_resample_meta(base_image, good_bits):
model = maker_utils.mk_level2_image(shape=(100, 100))
model.meta.wcsinfo["vparity"] = -1

model.meta.wcsinfo["ra_ref"] = 178.37567
model.meta.wcsinfo["dec_ref"] = -2.674389
model.meta.wcsinfo["v2_ref"] = 2216.3796908471754
model.meta.wcsinfo["v3_ref"] = 130.234233411109
model.meta.wcsinfo["v3yangle"] = -60.0
model.meta.wcsinfo["roll_ref"] = 60.0
img = datamodels.ImageModel(model)
transform = pointing.v23tosky(img)
img.meta.wcs.set_transform('detector', 'icrs', transform)
img.meta.wcs.bounding_box = ((-0.5, 2300), (-0.5, 200))

img.data *= img.meta.photometry.conversion_megajanskys / img.data

Expand Down

0 comments on commit e51d239

Please sign in to comment.