From f03a11cb6e5eff191c2380e974884aea0d531293 Mon Sep 17 00:00:00 2001 From: mairan Date: Wed, 2 Aug 2023 10:37:06 -0400 Subject: [PATCH] Fix issue with bounding box when creating WCS for tests. (#181) * 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 * Rename variables with FITS keywords names. * Style reformating. * Update docs to include stcal.alignment. * Revert "Rename variables with FITS keywords names." This reverts commit 0eea0e5d4902286dd7b1966537dc648ef3f14cbf. * 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 Co-authored-by: mwregan2 Co-authored-by: Howard Bushouse --- tests/test_alignment.py | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/tests/test_alignment.py b/tests/test_alignment.py index 5f7ab792..8888fcf0 100644 --- a/tests/test_alignment.py +++ b/tests/test_alignment.py @@ -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 @@ -158,7 +158,8 @@ 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, @@ -166,18 +167,12 @@ def test_wcs_from_footprints(): 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():