Skip to content

Commit 7f4d516

Browse files
authored
Addresses MAC OS numpy singularity handling
numpy 1.x on MAC OS may not raise a singularity flag where Linux and Windows due. This issue appears to be addressed in numpy 2. Either way, this test should now be more in line with the goals of this test case (i.e., either (a) confirming that the matrix is singular and caught appropriately with nans in the DOP entries or (b) near singular even if the flag is not raised and the relevant DOP entries are non-physical).
1 parent 99dab10 commit 7f4d516

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

tests/utils/test_dop.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -412,18 +412,23 @@ def test_singularity_dop(navdata):
412412
# is an issue in comparing nan > number).
413413
# Note: we use np.any() since we can get small values in the DOP matrix
414414
# even if singular (i.e., in the off-diagonal entries).
415-
for _, val in dop_dict.items():
416-
print("1:",val)
417-
assert np.any(np.isnan(val)) or np.any(np.abs(val) > 1e6)
415+
dop_mat = dop_dict['dop_matrix']
416+
print("1 (singularity flag not raised): DOP matrix is:")
417+
print(dop_mat)
418+
assert np.any(np.isnan(dop_mat)) or np.any(np.abs(dop_mat) > 1e6)
419+
420+
dop_scalars = [val for key, val in dop_dict.items() if key != 'dop_matrix']
421+
print("1: DOP Values are:", dop_scalars)
422+
assert np.any(np.isnan(dop_scalars)) or np.any(np.abs(dop_scalars) > 1e6)
418423

419424
except np.linalg.LinAlgError:
420425
# We expect a singularity error. If we get the singularity error, then
421426
# the values should all be NaNs
422427

423428
# Now check that we get all NaNs for the DOP values when we have a
424429
# singularity
425-
for _, val in dop_dict.items():
426-
print("2:",val)
430+
for key, val in dop_dict.items():
431+
print("2:", key, " : ", val)
427432
assert np.all(np.isnan(val))
428433

429434

0 commit comments

Comments
 (0)