Skip to content

Commit

Permalink
Fix issue with bounding box when creating WCS for tests. (#181)
Browse files Browse the repository at this point in the history
* Add methods necessary for resample.

* Small changes to accommodate both JWST and RST datamodels.

* Add CHANGES.rst entry.

* Add PR number to CHANGES.rst entry.

* use protocols

* temp

* add dependencies

* add CI testing to alignment branch

* add CI testing to alignment branch

* fix test

* Add setting of number_extended_events (#178)

* Add setting of number_extended_events

This was not being set when in single processing mode.

* Update CHANGES.rst

* Update CHANGES.rst

* Update test_jump.py

---------

Co-authored-by: Howard Bushouse <bushouse@stsci.edu>

* Rename variables with FITS keywords names.

* Style reformating.

* Update docs to include stcal.alignment.

* Revert "Rename variables with FITS keywords names."

This reverts commit 0eea0e5.

* Updates to address most comments.

* Fix misplaced comment.

* Code refactoring and additional unit test.

* Silencing style check warning F403.

* Small style refactoring.

* Set minimum asdf version.

* Update matplotlib's inventory URL.

* Set lower version for gwcs.

* Bump astropy version to >= 5.1.

* Fix docs style issues.

* Style check fix.

* Fix issue with bounding boxes in tests.

* Fix issue with bounding boxes in tests.

---------

Co-authored-by: Nadia Dencheva <nadia.dencheva@gmail.com>
Co-authored-by: mwregan2 <mregan@stsci.edu>
Co-authored-by: Howard Bushouse <bushouse@stsci.edu>
  • Loading branch information
4 people authored Aug 2, 2023
1 parent dc47316 commit f03a11c
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions tests/test_alignment.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ def _create_wcs_object_without_distortion(
wcs_obj = WCS(pipeline)

wcs_obj.bounding_box = (
(-0.5, shape[0] - 0.5),
(-0.5, shape[0] - 0.5),
(0, shape[0] - 1),
(0, shape[0] - 1),
)

return wcs_obj
Expand Down Expand Up @@ -158,26 +158,21 @@ def test_wcs_from_footprints():
dm_1 = _create_wcs_and_datamodel(fiducial_world, shape, pscale)
wcs_1 = dm_1.meta.wcs

# shift fiducial by one pixel in both directions and create a new WCS
# shift fiducial by the size of a pixel projected onto the sky in both directions
# and create a new WCS
fiducial_world = (
fiducial_world[0] - 0.000028,
fiducial_world[1] - 0.000028,
)
dm_2 = _create_wcs_and_datamodel(fiducial_world, shape, pscale)
wcs_2 = dm_2.meta.wcs

# check overlapping pixels have approximate the same world coordinate
assert all(np.isclose(wcs_1(0, 1), wcs_2(1, 2)))
assert all(np.isclose(wcs_1(1, 0), wcs_2(2, 1)))
assert all(np.isclose(wcs_1(0, 0), wcs_2(1, 1)))
assert all(np.isclose(wcs_1(1, 1), wcs_2(2, 2)))

wcs = wcs_from_footprints([dm_1, dm_2])

# check that center of calculated WCS matches the
# expected position onto wcs_1 and wcs_2
assert all(np.isclose(wcs(2, 2), wcs_1(0.5, 0.5)))
assert all(np.isclose(wcs(2, 2), wcs_2(1.5, 1.5)))
assert all(np.isclose(wcs(2, 2), wcs_1(1, 1)))
assert all(np.isclose(wcs(2, 2), wcs_2(2, 2)))


def test_validate_wcs_list():
Expand Down

0 comments on commit f03a11c

Please sign in to comment.