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 committed Jun 13, 2024
1 parent 6b1c696 commit c4156a2
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 10 deletions.
4 changes: 3 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.22",
"photutils >=1.10.0",
Expand All @@ -29,6 +30,7 @@ dependencies = [
"roman_datamodels @ git+https://github.com/spacetelescope/roman_datamodels.git",
"scipy >=1.11",
"stcal>=1.7.0",
"stcal @ git+https://github.com/nden/stcal.git@fix-reproject",
# "stcal @ git+https://github.com/spacetelescope/stcal.git@main",
"stpipe >=0.5.0",
"tweakwcs >=0.8.6",
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
15 changes: 11 additions & 4 deletions romancal/resample/tests/test_resample_step.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,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 @@ -343,12 +344,18 @@ 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))

step = ResampleStep

res = step.call(img, good_bits=good_bits)
res = ResampleStep.call(img, good_bits=good_bits)

assert res.meta.resample.good_bits == good_bits

Expand Down

0 comments on commit c4156a2

Please sign in to comment.