Skip to content

Commit

Permalink
Remove code that reproduced old bbox behavior.
Browse files Browse the repository at this point in the history
  • Loading branch information
mcara committed Dec 22, 2024
1 parent 77a8176 commit d0a4a76
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 21 deletions.
11 changes: 2 additions & 9 deletions src/stcal/alignment/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,6 @@ def _get_bounding_box_with_offsets(
domain_max = np.max(domain_bounds, axis=1)

native_crpix = ref_wcs.backward_transform(*fiducial)
# DEBUG: code to reproduce old results (for old unit test test_wcs_from_footprints)
native_crpix = (0.0, 0.0)

if crpix is None:
# shift the coordinates by domain_min so that all input footprints
Expand All @@ -216,15 +214,10 @@ def _get_bounding_box_with_offsets(
domain_max += offsets

if shape is None:
# shape = tuple(int(dmax + 0.5) for dmax in domain_max[::-1])
# bounding_box = tuple(
# (-0.5, s - 0.5) for s in shape[::-1]
# )
# DEBUG: code to reproduce old results (for old unit test test_wcs_from_footprints)
shape = tuple(int(dmax + 0.5) for dmax in domain_max[::-1])
bounding_box = tuple(
(0.0, dmax) for dmax in domain_max
(-0.5, s - 0.5) for s in shape[::-1]
)
shape = tuple(int(dmax + 0.5) for dmax in domain_max[::-1])

else:
# trim upper bounding box limits
Expand Down
17 changes: 5 additions & 12 deletions tests/test_alignment.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,18 +214,11 @@ def test_wcs_from_footprints(s_regions):

# check that all elements of footprint match the *vertices* of the new
# combined WCS

# footprnt = wcs.footprint()
# assert all(np.isclose(footprnt[0], wcs(-0.5, -0.5)))
# assert all(np.isclose(footprnt[1], wcs(-0.5, 3.5)))
# assert all(np.isclose(footprnt[2], wcs(3.5, 3.5)))
# assert all(np.isclose(footprnt[3], wcs(3.5, -0.5)))

# DEBUG: code to reproduce the old unit test:
assert all(np.isclose(wcs.footprint()[0], wcs(0, 0)))
assert all(np.isclose(wcs.footprint()[1], wcs(0, 4)))
assert all(np.isclose(wcs.footprint()[2], wcs(4, 4)))
assert all(np.isclose(wcs.footprint()[3], wcs(4, 0)))
footprnt = wcs.footprint()
assert all(np.isclose(footprnt[0], wcs(-0.5, -0.5)))
assert all(np.isclose(footprnt[1], wcs(-0.5, 3.5)))
assert all(np.isclose(footprnt[2], wcs(3.5, 3.5)))
assert all(np.isclose(footprnt[3], wcs(3.5, -0.5)))

# check that fiducials match their expected coords in the new combined WCS
assert all(np.isclose(wcs_1(0, 0), wcs(2.5, 1.5)))
Expand Down

0 comments on commit d0a4a76

Please sign in to comment.