Skip to content

Commit b87309a

Browse files
committed
Updated wrap_0_to_2pi and tests
1 parent ffbaa7d commit b87309a

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

gnss_lib_py/utils/coordinates.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -564,6 +564,7 @@ def wrap_0_to_2pi(angles):
564564
Angles wrapped between 0 and 2pi in radians.
565565
566566
"""
567+
angles = np.mod(angles, 2*np.pi)
567568
while np.any(angles < 0.):
568569
angles = np.where(angles<0. , 2.*np.pi+angles, angles)
569570
while np.any(angles >= 2*np.pi):

tests/utils/test_coordinates.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,7 @@ def test_wrap_0_to_2pi():
441441
angles_out = np.linspace(0,7*np.pi/4.,8)
442442
np.testing.assert_array_almost_equal(wrap_0_to_2pi(angles_in),angles_out)
443443

444-
# test greater than loop
444+
# test less than loop
445445
angles_in = np.linspace(0,7*np.pi/4.,8) - 12*np.pi
446446
angles_out = np.linspace(0,7*np.pi/4.,8)
447447
np.testing.assert_array_almost_equal(wrap_0_to_2pi(angles_in),angles_out)
@@ -452,7 +452,7 @@ def test_wrap_0_to_2pi():
452452
np.linspace(0,3*np.pi/4.,4)))
453453
np.testing.assert_array_almost_equal(wrap_0_to_2pi(angles_in),angles_out)
454454

455-
# test positive offset loop
455+
# test negative offset loop
456456
angles_in = np.linspace(0,7*np.pi/4.,8) - 11*np.pi
457457
angles_out = np.concatenate((np.linspace(np.pi,7*np.pi/4.,4),
458458
np.linspace(0,3*np.pi/4.,4)))

0 commit comments

Comments
 (0)