-
Notifications
You must be signed in to change notification settings - Fork 33
Closed
Labels
Description
What did you expect to happen?
AMICI should support events which trigger at time 0. Often one wants to change values at time zero via events, for instance to set dosing protocols.
To Reproduce
Example attached.
icg_body_flat_v2.zip
yaml_file: Path = "icg.yaml"
petab_problem = petab.Problem.from_yaml(yaml_file)
amici_model = amici.petab_import.import_petab_problem(petab_problem)
results in
Traceback (most recent call last):
File "/home/mkoenig/git/pkdb_models/pkdb_models/models/icg/fit_petab/icg_amici.py", line 28, in <module>
amici_model = amici.petab_import.import_petab_problem(petab_problem)
File "/home/mkoenig/envs/pkdb_models/lib/python3.8/site-packages/amici/petab_import.py", line 305, in import_petab_problem
import_model_sbml(
File "/home/mkoenig/envs/pkdb_models/lib/python3.8/site-packages/amici/logging.py", line 194, in wrapper_timer
rval = func(*args, **kwargs)
File "/home/mkoenig/envs/pkdb_models/lib/python3.8/site-packages/amici/petab_import.py", line 579, in import_model_sbml
sbml_importer.sbml2amici(
File "/home/mkoenig/envs/pkdb_models/lib/python3.8/site-packages/amici/sbml_import.py", line 358, in sbml2amici
self._process_sbml(constant_parameters)
File "/home/mkoenig/envs/pkdb_models/lib/python3.8/site-packages/amici/logging.py", line 194, in wrapper_timer
rval = func(*args, **kwargs)
File "/home/mkoenig/envs/pkdb_models/lib/python3.8/site-packages/amici/sbml_import.py", line 406, in _process_sbml
self.check_support()
File "/home/mkoenig/envs/pkdb_models/lib/python3.8/site-packages/amici/sbml_import.py", line 469, in check_support
self.check_event_support()
File "/home/mkoenig/envs/pkdb_models/lib/python3.8/site-packages/amici/sbml_import.py", line 515, in check_event_support
raise SBMLException(
amici.sbml_import.SBMLException: Event event_IVDOSE_icg_0 has a trigger that has an initial value of False. This is currently not supported in AMICI.
How to fix
Read out the initialValue flag of the event which sets the initialValue to either false or true. Evaluate the event trigger at time zero and if it is true fire the event. This is just an event at time 0 which used the initialValue to decide about the transition. AMICI already supports events, this is just the special case of events at time 0 (which is a very typical scenario).
Best Matthias