Skip to content

Commit 92a530b

Browse files
authored
Fix RDataReporting::observables_likelihood (#2633)
Fixes #2627. ReturnData.sllh was always NaN because it wasn't 0-initialized.
1 parent 1716181 commit 92a530b

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

python/tests/test_swig_interface.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -623,7 +623,9 @@ def test_reporting_mode_obs_llh(sbml_example_presimulation_module):
623623
assert rdata.sy.size > 0
624624
assert rdata.ssigmay.size > 0
625625
assert rdata.sllh.size > 0
626+
assert not np.isnan(rdata.sllh).any()
626627
case amici.SensitivityMethod.adjoint:
627628
assert rdata.sy is None
628629
assert rdata.ssigmay is None
629630
assert rdata.sllh.size > 0
631+
assert not np.isnan(rdata.sllh).any()

src/rdata.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -811,6 +811,7 @@ void ReturnData::applyChainRuleFactorToSimulationResults(Model const& model) {
811811

812812
void ReturnData::initializeObjectiveFunction(bool enable_chi2) {
813813
if (rdata_reporting == RDataReporting::likelihood
814+
|| rdata_reporting == RDataReporting::observables_likelihood
814815
|| rdata_reporting == RDataReporting::full) {
815816
llh = 0.0;
816817
std::fill(sllh.begin(), sllh.end(), 0.0);

0 commit comments

Comments
 (0)