Skip to content

Commit

Permalink
Fix sensitivities for models with events / extend and cleanup event t…
Browse files Browse the repository at this point in the history
…ests (#2084)

Fixes incorrect sensitivities for models with events with state-dependent trigger functions. 

Add three new event test cases and do some cleanup.

Closes #2086 

Co-authored-by: Paul Stapor <paul.stapor@helmholtz-muenchen.de>
  • Loading branch information
dweindl and paulstapor authored May 16, 2023
1 parent 438812d commit a5398dd
Show file tree
Hide file tree
Showing 4 changed files with 325 additions and 106 deletions.
5 changes: 1 addition & 4 deletions python/sdist/amici/de_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -2021,10 +2021,7 @@ def _compute_equation(self, name: str) -> None:
)

# additional part of chain rule state variables
# This part only works if we use self.eq('xdot')
# instead of self.sym('xdot'). Not immediately clear
# why that is.
tmp_dxdp += smart_multiply(self.eq("xdot"), self.sym("stau").T)
tmp_dxdp += smart_multiply(self.sym("xdot_old"), self.sym("stau").T)

# finish chain rule for the state variables
tmp_eq += smart_multiply(self.eq("ddeltaxdx")[ie], tmp_dxdp)
Expand Down
Loading

0 comments on commit a5398dd

Please sign in to comment.