@@ -391,21 +391,33 @@ def test_singularity_dop(navdata):
391391 A NavData with only one time entry of a *singular* satellite scenario.
392392
393393 """
394- with pytest .raises (np .linalg .LinAlgError ):
395- enut_matrix = _calculate_enut_matrix (navdata )
396- np .linalg .inv (enut_matrix .T @ enut_matrix )
397394
398- # Now check that we get all NaNs for the DOP values when we have a
399- # singularity
395+ # Run the DOP calculation
400396 dop_dict = calculate_dop (navdata )
401397
402398 # Check the DOP output has all the expected keys
403399 assert dop_dict .keys () == {'dop_matrix' ,
404- 'GDOP' , 'HDOP' , 'VDOP' , 'PDOP' , 'TDOP' }
400+ 'GDOP' , 'HDOP' , 'VDOP' , 'PDOP' , 'TDOP' }
401+
402+ try :
403+ enut_matrix = _calculate_enut_matrix (navdata )
404+ np .linalg .inv (enut_matrix .T @ enut_matrix )
405405
406- # Check these are all NaNs
407- for _ , val in dop_dict .items ():
408- assert np .all (np .isnan (val ))
406+ # If we get here, then we did not get a singularity error
407+ # This is possible due to floating point errors, so we will check
408+ # that the values are unrealistically large.
409+ # Note: we use np.any() since we can get small values in the DOP matrix
410+ for _ , val in dop_dict .items ():
411+ assert np .any (np .abs (val ) > 1e6 )
412+
413+ except np .linalg .LinAlgError :
414+ # We expect a singularity error. If we get the singularity error, then
415+ # the values should all be NaNs
416+
417+ # Now check that we get all NaNs for the DOP values when we have a
418+ # singularity
419+ for _ , val in dop_dict .items ():
420+ assert np .all (np .isnan (val ))
409421
410422
411423#############################################
0 commit comments