From f9691244b3b134249175c88d79aad20ff520db7b Mon Sep 17 00:00:00 2001 From: Braden Date: Thu, 21 Mar 2024 09:34:22 -0600 Subject: [PATCH 1/6] Test diagnostic changes --- .github/workflows/ubi8.yml | 2 +- .../camera_calibration/test/test_camera_calibration.py | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ubi8.yml b/.github/workflows/ubi8.yml index fce7d68b4..fbdb2cec2 100644 --- a/.github/workflows/ubi8.yml +++ b/.github/workflows/ubi8.yml @@ -40,4 +40,4 @@ jobs: run: | python3 -m pip install -r ../requirements.txt export PYTHONPATH=$PWD/../ - pytest --color=yes -rs -vv --cov=. --cov-report term --cov-config=.coveragerc \ No newline at end of file + pytest --color=yes -rs -vv --cov=. --cov-report term --cov-config=.coveragerc -s -k test_image_points \ No newline at end of file diff --git a/opencsp/app/camera_calibration/test/test_camera_calibration.py b/opencsp/app/camera_calibration/test/test_camera_calibration.py index 3b13feb9e..d645f0dfc 100644 --- a/opencsp/app/camera_calibration/test/test_camera_calibration.py +++ b/opencsp/app/camera_calibration/test/test_camera_calibration.py @@ -133,6 +133,16 @@ def setup_class(cls, regenerate=False): cls.calibration_error_exp = data['calibration_error'] cls.reprojection_errors_exp = data['reprojection_errors'] + print([a.data[:, :2] for a in p_image[:2]]) + print('\n') + print(np.array([a.data[:, :2] for a in p_image[:2]])) + print('\n') + print(cls.p_image_points[:2, :2, :2]) + # pts_test = cls.p_image_points[:2, :2, :2] + # pts_test_exp = cls.p_image_points_exp[:2, :2, :2] + # print(pts_test_exp) + # print(pts_test) + def test_image_points(self): np.testing.assert_allclose(self.p_image_points, self.p_image_points_exp) From a2956a65feca70e09257b9ce0acdcf2bdd6be111 Mon Sep 17 00:00:00 2001 From: Braden Date: Thu, 21 Mar 2024 09:51:21 -0600 Subject: [PATCH 2/6] Data shape print statement --- .../test/test_camera_calibration.py | 20 ++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/opencsp/app/camera_calibration/test/test_camera_calibration.py b/opencsp/app/camera_calibration/test/test_camera_calibration.py index d645f0dfc..3e7cadac5 100644 --- a/opencsp/app/camera_calibration/test/test_camera_calibration.py +++ b/opencsp/app/camera_calibration/test/test_camera_calibration.py @@ -133,11 +133,21 @@ def setup_class(cls, regenerate=False): cls.calibration_error_exp = data['calibration_error'] cls.reprojection_errors_exp = data['reprojection_errors'] - print([a.data[:, :2] for a in p_image[:2]]) - print('\n') - print(np.array([a.data[:, :2] for a in p_image[:2]])) - print('\n') - print(cls.p_image_points[:2, :2, :2]) + # idx = np.argmin(np.abs(cls.p_image_points - 1304.8412)) + idx = np.argmin(np.abs(cls.p_image_points - 1409.4342)) + print(idx) + print(cls.p_image_points.flatten()[idx]) + + loc = np.where(cls.p_image_points == cls.p_image_points.flatten()[idx]) + print(loc) + + print(cls.p_image_points.shape) + + # print([a.data[:, :2] for a in p_image[:2]]) + # print('\n') + # print(np.array([a.data[:, :2] for a in p_image[:2]])) + # print('\n') + # print(cls.p_image_points[:2, :2, :2]) # pts_test = cls.p_image_points[:2, :2, :2] # pts_test_exp = cls.p_image_points_exp[:2, :2, :2] # print(pts_test_exp) From 600d0989077195447a62e8c59e6e7d61f5c8ca41 Mon Sep 17 00:00:00 2001 From: Braden Date: Thu, 21 Mar 2024 09:55:10 -0600 Subject: [PATCH 3/6] Sorting list --- opencsp/app/camera_calibration/test/test_camera_calibration.py | 1 + 1 file changed, 1 insertion(+) diff --git a/opencsp/app/camera_calibration/test/test_camera_calibration.py b/opencsp/app/camera_calibration/test/test_camera_calibration.py index 3e7cadac5..27ac20e19 100644 --- a/opencsp/app/camera_calibration/test/test_camera_calibration.py +++ b/opencsp/app/camera_calibration/test/test_camera_calibration.py @@ -40,6 +40,7 @@ def setup_class(cls, regenerate=False): # Find all files files = glob(image_pattern) + files.sort() # Load images and find corners images = [] From f944aff881ef0c9e05620b225d8a3f194ace9fbe Mon Sep 17 00:00:00 2001 From: Braden Date: Thu, 21 Mar 2024 10:00:46 -0600 Subject: [PATCH 4/6] Revert "Data shape print statement" This reverts commit a2956a65feca70e09257b9ce0acdcf2bdd6be111. Reverting diagnostic code --- .../test/test_camera_calibration.py | 20 +++++-------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/opencsp/app/camera_calibration/test/test_camera_calibration.py b/opencsp/app/camera_calibration/test/test_camera_calibration.py index 27ac20e19..5083cf296 100644 --- a/opencsp/app/camera_calibration/test/test_camera_calibration.py +++ b/opencsp/app/camera_calibration/test/test_camera_calibration.py @@ -134,21 +134,11 @@ def setup_class(cls, regenerate=False): cls.calibration_error_exp = data['calibration_error'] cls.reprojection_errors_exp = data['reprojection_errors'] - # idx = np.argmin(np.abs(cls.p_image_points - 1304.8412)) - idx = np.argmin(np.abs(cls.p_image_points - 1409.4342)) - print(idx) - print(cls.p_image_points.flatten()[idx]) - - loc = np.where(cls.p_image_points == cls.p_image_points.flatten()[idx]) - print(loc) - - print(cls.p_image_points.shape) - - # print([a.data[:, :2] for a in p_image[:2]]) - # print('\n') - # print(np.array([a.data[:, :2] for a in p_image[:2]])) - # print('\n') - # print(cls.p_image_points[:2, :2, :2]) + print([a.data[:, :2] for a in p_image[:2]]) + print('\n') + print(np.array([a.data[:, :2] for a in p_image[:2]])) + print('\n') + print(cls.p_image_points[:2, :2, :2]) # pts_test = cls.p_image_points[:2, :2, :2] # pts_test_exp = cls.p_image_points_exp[:2, :2, :2] # print(pts_test_exp) From ab00b30b71ac6b9a1334b6b17c1c1c0ddd533d3f Mon Sep 17 00:00:00 2001 From: Braden Date: Thu, 21 Mar 2024 10:01:03 -0600 Subject: [PATCH 5/6] Revert "Test diagnostic changes" This reverts commit f9691244b3b134249175c88d79aad20ff520db7b. Reverting more test diagnostic code --- .github/workflows/ubi8.yml | 2 +- .../camera_calibration/test/test_camera_calibration.py | 10 ---------- 2 files changed, 1 insertion(+), 11 deletions(-) diff --git a/.github/workflows/ubi8.yml b/.github/workflows/ubi8.yml index fbdb2cec2..fce7d68b4 100644 --- a/.github/workflows/ubi8.yml +++ b/.github/workflows/ubi8.yml @@ -40,4 +40,4 @@ jobs: run: | python3 -m pip install -r ../requirements.txt export PYTHONPATH=$PWD/../ - pytest --color=yes -rs -vv --cov=. --cov-report term --cov-config=.coveragerc -s -k test_image_points \ No newline at end of file + pytest --color=yes -rs -vv --cov=. --cov-report term --cov-config=.coveragerc \ No newline at end of file diff --git a/opencsp/app/camera_calibration/test/test_camera_calibration.py b/opencsp/app/camera_calibration/test/test_camera_calibration.py index 5083cf296..d2edb7c31 100644 --- a/opencsp/app/camera_calibration/test/test_camera_calibration.py +++ b/opencsp/app/camera_calibration/test/test_camera_calibration.py @@ -134,16 +134,6 @@ def setup_class(cls, regenerate=False): cls.calibration_error_exp = data['calibration_error'] cls.reprojection_errors_exp = data['reprojection_errors'] - print([a.data[:, :2] for a in p_image[:2]]) - print('\n') - print(np.array([a.data[:, :2] for a in p_image[:2]])) - print('\n') - print(cls.p_image_points[:2, :2, :2]) - # pts_test = cls.p_image_points[:2, :2, :2] - # pts_test_exp = cls.p_image_points_exp[:2, :2, :2] - # print(pts_test_exp) - # print(pts_test) - def test_image_points(self): np.testing.assert_allclose(self.p_image_points, self.p_image_points_exp) From b350dc111f5d4feb88d18548079be1e9af1de025 Mon Sep 17 00:00:00 2001 From: Braden Date: Thu, 21 Mar 2024 10:12:16 -0600 Subject: [PATCH 6/6] Added missing test_ prefix --- opencsp/app/camera_calibration/test/test_camera_calibration.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/opencsp/app/camera_calibration/test/test_camera_calibration.py b/opencsp/app/camera_calibration/test/test_camera_calibration.py index d2edb7c31..528b0f782 100644 --- a/opencsp/app/camera_calibration/test/test_camera_calibration.py +++ b/opencsp/app/camera_calibration/test/test_camera_calibration.py @@ -158,7 +158,7 @@ def test_V_cam_object(self): def test_calibration_error(self): np.testing.assert_allclose(self.calibration_error, self.calibration_error_exp) - def reprojection_errors(self): + def test_reprojection_errors(self): np.testing.assert_allclose( self.reprojection_errors, self.reprojection_errors_exp )