From 20db8dcedfad999608c03998bff47c534ad1223b Mon Sep 17 00:00:00 2001 From: Daniel Weindl Date: Wed, 9 Oct 2024 16:52:10 +0200 Subject: [PATCH] .. --- python/tests/test_events.py | 4 ++++ python/tests/util.py | 6 +++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/python/tests/test_events.py b/python/tests/test_events.py index 6909416d38..7aca3b3d8c 100644 --- a/python/tests/test_events.py +++ b/python/tests/test_events.py @@ -139,9 +139,12 @@ def model_definition_events_plus_heavisides(): "k2": 0.01, "k3": 5, "alpha": 2, + # FIXME: adjoint sensitivities w.r.t. beta are slightly off "beta": 3, "gamma": 2, "delta": 3, + # FIXME: adjoint sensitivities w.r.t. eta are slightly off + # changing eta to e.g. 2.5 "fixes" python/tests/test_events.py::test_models[events_plus_heavisides] "eta": 1, "zeta": 5, } @@ -281,6 +284,7 @@ def model_definition_nested_events(): "k2": 0, "inflow_1": 4, "decay_1": 2, + # FIXME adjoint sensitivities w.r.t. decay_2 are slightly off "decay_2": 5, "bolus": 0, # for bolus != 0, nested event sensitivities are off! } diff --git a/python/tests/util.py b/python/tests/util.py index 1cc542e1e1..3902e20fa9 100644 --- a/python/tests/util.py +++ b/python/tests/util.py @@ -199,8 +199,8 @@ def check_trajectories_with_adjoint_sensitivities(amici_model: AmiciModel): solver.setRelativeTolerance(1e-14) solver.setAbsoluteToleranceB(1e-16) solver.setRelativeToleranceB(1e-15) - solver.setAbsoluteToleranceQuadratures(1e-16) - solver.setRelativeToleranceQuadratures(1e-10) + solver.setAbsoluteToleranceQuadratures(1e-14) + solver.setRelativeToleranceQuadratures(1e-8) rdata_asa = runAmiciSimulation(amici_model, solver=solver, edata=edata) assert_allclose(rdata_fsa.x, rdata_asa.x, atol=1e-14, rtol=1e-10) @@ -215,7 +215,6 @@ def check_trajectories_with_adjoint_sensitivities(amici_model: AmiciModel): ) df["abs_diff"] = df["fsa"] - df["asa"] df["rel_diff"] = df["abs_diff"] / df["fsa"] - print(df) # Also test against finite differences parameters = amici_model.getUnscaledParameters() @@ -237,6 +236,7 @@ def check_trajectories_with_adjoint_sensitivities(amici_model: AmiciModel): rdata_m = runAmiciSimulation(amici_model, solver=solver, edata=edata) sllh_fd.append((rdata_p["llh"] - rdata_m["llh"]) / (2 * eps)) df["fd"] = sllh_fd + print(df) # test less strict in terms of absolute error, as the gradient are # typically in the order of 1e3