Skip to content

Commit

Permalink
solve
Browse files Browse the repository at this point in the history
  • Loading branch information
dweindl committed Dec 4, 2023
1 parent f3cc6f7 commit 072dc18
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions python/sdist/amici/de_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -717,17 +717,18 @@ def __eq__(self, other):

def triggers_at_fixed_timepoint(self) -> bool:
"""Check whether the event triggers at a (single) fixed time-point."""
return (amici_time_symbol - self.get_val()).is_Number
t_root = sp.solve(self.get_val(), amici_time_symbol)
if len(t_root) != 1:
return False
return t_root[0].is_Number

def get_trigger_time(self) -> sp.Float:
"""Get the time at which the event triggers.
Only for events that trigger at a single fixed time-point.
"""

if not self.triggers_at_fixed_timepoint():
raise NotImplementedError(
"This event does not trigger at a fixed timepoint."
)

return amici_time_symbol - self.get_val()
return sp.solve(self.get_val(), amici_time_symbol)[0]

0 comments on commit 072dc18

Please sign in to comment.