ICB-DCM / pyPESTO

python Parameter EStimation TOolbox
https://pypesto.readthedocs.io
BSD 3-Clause "New" or "Revised" License
206 stars 44 forks source link

Relative: fix log of zero for default 0 sigma values #1377

Closed Doresic closed 2 months ago

Doresic commented 2 months ago

If an observable has hierarchical noise, but has no measurement at some simulation timepoint for which the model is simulated, then the edata.getObservedData will be nan but the rdata.sigmay for that condition, observable and timepoint will be 0.

This was causing an issue in the direct calculation of the NLLH as we were taking the log(2 * np.pi * sigma_i**2) where sigma_i was rdata.sigmay. This gave RuntimeWarning: divide by zero encountered in log errors.

The fix is simple: mask the sigma_i array with the mask for which the data is not nan. Already available in problem.data_mask.

Was raised in issue #1375

codecov-commenter commented 2 months ago

Codecov Report

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

Project coverage is 53.72%. Comparing base (3b1a12f) to head (b057c50).

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

Additional details and impacted files ```diff @@ Coverage Diff @@ ## develop #1377 +/- ## ============================================ - Coverage 84.41% 53.72% -30.69% ============================================ Files 157 157 Lines 12919 12928 +9 ============================================ - Hits 10905 6946 -3959 - Misses 2014 5982 +3968 ```

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