PTB-M4D / PyDynamic

Python library for the analysis of dynamic measurements
https://ptb-m4d.github.io/PyDynamic/
GNU Lesser General Public License v3.0
25 stars 13 forks source link

Introduce an absolute tolerance into all assert_allclose() statements #333

Closed mgrub closed 3 months ago

mgrub commented 4 months ago

This PR defines a variable "custom_atol=100*machine_epsilon" in the conftest.py and uses it in all assert_allclose statements, that did not already declare a (larger) absolute tolerance previously.

Motivation: numpy.testing.assert_allclose uses default values of rtol=1e-7 and atol=0. This is sometimes difficult to achieve if mathematically equivalent but numerically different routines are compared, especially for array entries close to zero. The proposed absolute tolerance should provide a good compromise between achievable numerical accuracy and detecting true deviation of arrays in tests.

codecov-commenter commented 3 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 77.53%. Comparing base (b9debd7) to head (05bc0d5). Report is 2 commits behind head on main.

:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #333 +/- ## ========================================== - Coverage 77.83% 77.53% -0.31% ========================================== Files 30 30 Lines 2333 2333 Branches 378 378 ========================================== - Hits 1816 1809 -7 - Misses 390 394 +4 - Partials 127 130 +3 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.