-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
35 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |