Skip to content

Commit

Permalink
..
Browse files Browse the repository at this point in the history
  • Loading branch information
dweindl committed Oct 9, 2024
1 parent 8559b8e commit 20db8dc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 4 additions & 0 deletions python/tests/test_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
Expand Down Expand Up @@ -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!
}
Expand Down
6 changes: 3 additions & 3 deletions python/tests/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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()
Expand All @@ -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
Expand Down

0 comments on commit 20db8dc

Please sign in to comment.