From 4f3df74914bba9bd5aa826c17c198ca42f9f09f2 Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Mon, 9 Dec 2024 16:23:40 +0200 Subject: [PATCH] Fix wrapping of computed angles in test_constructorBetweenFactorPose2s --- python/gtsam/tests/test_ShonanAveraging.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/python/gtsam/tests/test_ShonanAveraging.py b/python/gtsam/tests/test_ShonanAveraging.py index 19b9f8dc1a..9636698972 100644 --- a/python/gtsam/tests/test_ShonanAveraging.py +++ b/python/gtsam/tests/test_ShonanAveraging.py @@ -197,9 +197,8 @@ def test_constructorBetweenFactorPose2s(self) -> None: wRi_list = [result_values.atRot2(i) for i in range(num_images)] thetas_deg = np.array([wRi.degrees() for wRi in wRi_list]) - # map all angles to [0,360) - thetas_deg = thetas_deg % 360 - thetas_deg -= thetas_deg[0] + # map all angles to [-180,180) + thetas_deg = (thetas_deg - thetas_deg[0] + 180) % 360 - 180 expected_thetas_deg = np.array([0.0, 90.0, 0.0]) np.testing.assert_allclose(thetas_deg, expected_thetas_deg, atol=0.1)