Skip to content

Commit

Permalink
Fix bug in assign_wcs.util.bounding_box_from_subarray function (#5543)
Browse files Browse the repository at this point in the history
* Fix bug in assign_wcs.util.bounding_box_from_subarray function

* Update CHANGES.rst
  • Loading branch information
jdavies-st committed Dec 16, 2020
1 parent 862b6f7 commit b592569
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 2 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ assign_wcs

- Added SIP approximation to WCS for imaging modes. FITS WCS keywords added to meta.wcsinfo. [#5507]

- Fix bug where subarray bounding boxes were 1 pixel too small. [#5543]

associations
------------

Expand Down
2 changes: 1 addition & 1 deletion jwst/assign_wcs/tests/test_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,4 +101,4 @@ def test_bounding_box_from_subarray():
im.meta.subarray.ystart = 6
im.meta.subarray.xsize = 400
im.meta.subarray.ysize = 600
assert bounding_box_from_subarray(im) == ((-.5, 598.5), (-.5, 398.5))
assert bounding_box_from_subarray(im) == ((-.5, 599.5), (-.5, 399.5))
5 changes: 2 additions & 3 deletions jwst/assign_wcs/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -830,10 +830,9 @@ def bounding_box_from_subarray(input_model):
bb_yend = -0.5

if input_model.meta.subarray.xsize is not None:
# Implicitely there's bb_xstart + 0.5 and xsize -1 - 0.5
bb_xend = input_model.meta.subarray.xsize - 1 - 0.5
bb_xend = input_model.meta.subarray.xsize - 0.5
if input_model.meta.subarray.ysize is not None:
bb_yend = input_model.meta.subarray.ysize - 1 - 0.5
bb_yend = input_model.meta.subarray.ysize - 0.5

bbox = ((bb_ystart, bb_yend), (bb_xstart, bb_xend))
return bbox
Expand Down

0 comments on commit b592569

Please sign in to comment.