Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
dweindl committed Dec 11, 2023
1 parent 7e4ed05 commit 8a04f7f
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions python/tests/test_de_model.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import sympy as sp
from amici.de_model import Event
from amici.import_utils import amici_time_symbol


def test_event_trigger_time():
e = Event(
sp.Symbol("event1"), "event name", amici_time_symbol - 10, sp.Float(0)
)
assert e.triggers_at_fixed_timepoint() is True
assert e.get_trigger_time() == 10

# fixed, but multiple timepoints - not (yet) supported
e = Event(
sp.Symbol("event1"),
"event name",
sp.sin(amici_time_symbol),
sp.Float(0),
)
assert e.triggers_at_fixed_timepoint() is False

e = Event(
sp.Symbol("event1"), "event name", amici_time_symbol / 2, sp.Float(0)
)
assert e.triggers_at_fixed_timepoint() is True
assert e.get_trigger_time() == 0

# parameter-dependent triggers - not (yet) supported
e = Event(
sp.Symbol("event1"),
"event name",
amici_time_symbol - sp.Symbol("delay"),
sp.Float(0),
)
assert e.triggers_at_fixed_timepoint() is False

0 comments on commit 8a04f7f

Please sign in to comment.