Skip to content

Commit

Permalink
Addresses MAC OS numpy singularity handling
Browse files Browse the repository at this point in the history
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).
  • Loading branch information
danineamati authored Aug 15, 2024
1 parent 99dab10 commit 7f4d516
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions tests/utils/test_dop.py
Original file line number Diff line number Diff line change
Expand Up @@ -412,18 +412,23 @@ def test_singularity_dop(navdata):
# is an issue in comparing nan > number).
# Note: we use np.any() since we can get small values in the DOP matrix
# even if singular (i.e., in the off-diagonal entries).
for _, val in dop_dict.items():
print("1:",val)
assert np.any(np.isnan(val)) or np.any(np.abs(val) > 1e6)
dop_mat = dop_dict['dop_matrix']
print("1 (singularity flag not raised): DOP matrix is:")
print(dop_mat)
assert np.any(np.isnan(dop_mat)) or np.any(np.abs(dop_mat) > 1e6)

dop_scalars = [val for key, val in dop_dict.items() if key != 'dop_matrix']
print("1: DOP Values are:", dop_scalars)
assert np.any(np.isnan(dop_scalars)) or np.any(np.abs(dop_scalars) > 1e6)

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

# Now check that we get all NaNs for the DOP values when we have a
# singularity
for _, val in dop_dict.items():
print("2:",val)
for key, val in dop_dict.items():
print("2:", key, " : ", val)
assert np.all(np.isnan(val))


Expand Down

0 comments on commit 7f4d516

Please sign in to comment.