diff --git a/python/tests/test_de_model.py b/python/tests/test_de_model.py new file mode 100644 index 0000000000..7dec534da9 --- /dev/null +++ b/python/tests/test_de_model.py @@ -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