You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
amici.sbml_import.SBMLException: Cannot turn parameter IVDOSE_icg into a constant/fixed parameter since it either has an initial assignment or is the target of an assignment or rate rule.
This is a simple model which has the following rate rule
dIVDOSE_idg/dt = -iv_icg*Mr_icg + Ri_icg
As part of my conditions I want to set IVDOSE_icg[t=0] = value. I assume you handle parameters different then species and compartments, but this is not correct. You have to split the set of parameters in constant parameters and parameters governed by rate rules. Parameters governed by rate rules are just state variables in the ODE and everything which is allowed for species state variables and compartment state variables must also work for parameter state variables!
The condition table specifies constant parameters, or initial values of species, compartments or parameters for specific simulation conditions (generally corresponding to different experimental conditions).
instead of
The condition table specifies parameters, or initial values of species and compartments for specific simulation conditions (generally corresponding to different experimental conditions).
Could you please support the setting of initial conditions for parameters governed by rate rules? This mathematical construct occurs in many models and it would be completely unnatural to encode such parameters as dummy species or compartments just to get PETab to work.
Code example with full error stack below.
# Import yaml
petab_problem = petab.Problem.from_yaml(yaml_file)
# compile the petab problem to an AMICI ODE model
amici_model = amici.petab_import.import_petab_problem(petab_problem)
results in
/home/mkoenig/.virtualenvs/pkdb_models/bin/python /home/mkoenig/git/pkdb_models/pkdb_models/models/icg/fit_petab/icg_amici.py
2022-03-30 16:59:37.272 - amici.petab_import - INFO - Importing model ...
2022-03-30 16:59:37.273 - amici.petab_import - INFO - Model name is 'icg_body'.
Writing model code to '/home/mkoenig/git/pkdb_models/pkdb_models/models/icg/fit_petab/amici_models/icg_body'.
2022-03-30 16:59:37.274 - amici.petab_import - INFO - Species: 12
2022-03-30 16:59:37.274 - amici.petab_import - INFO - Global parameters: 75
2022-03-30 16:59:37.274 - amici.petab_import - INFO - Reactions: 16
2022-03-30 16:59:37.329 - amici.petab_import - INFO - Observables: 5
2022-03-30 16:59:37.329 - amici.petab_import - INFO - Sigmas: 5
2022-03-30 16:59:37.333 - amici.petab_import - DEBUG - Adding output parameters to model: OrderedDict([('noiseParameter1_Cve_icg', None), ('noiseParameter1_Chv_icg', None), ('noiseParameter1_Car_icg', None), ('noiseParameter1_ER_icg', None), ('noiseParameter1_LI__ICGLI2BI', None)])
2022-03-30 16:59:37.333 - amici.petab_import - DEBUG - Adding initial assignments for []
2022-03-30 16:59:37.333 - amici.petab_import - DEBUG - Condition table: (16, 5)
2022-03-30 16:59:37.333 - amici.petab_import - DEBUG - Fixed parameters are ['BW', 'Ri_icg', 'IVDOSE_icg']
2022-03-30 16:59:37.333 - amici.petab_import - INFO - Overall fixed parameters: 3
2022-03-30 16:59:37.333 - amici.petab_import - INFO - Variable parameters: 77
2022-03-30 16:59:37.390 - amici.sbml_import - INFO - Finished gathering local SBML symbols ++ (5.58E-02s)
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/.virtualenvs/pkdb_models/lib/python3.9/site-packages/amici/petab_import.py", line 305, in import_petab_problem
import_model_sbml(
File "/home/mkoenig/.virtualenvs/pkdb_models/lib/python3.9/site-packages/amici/logging.py", line 194, in wrapper_timer
rval = func(*args, **kwargs)
File "/home/mkoenig/.virtualenvs/pkdb_models/lib/python3.9/site-packages/amici/petab_import.py", line 579, in import_model_sbml
sbml_importer.sbml2amici(
File "/home/mkoenig/.virtualenvs/pkdb_models/lib/python3.9/site-packages/amici/sbml_import.py", line 358, in sbml2amici
self._process_sbml(constant_parameters)
File "/home/mkoenig/.virtualenvs/pkdb_models/lib/python3.9/site-packages/amici/logging.py", line 194, in wrapper_timer
rval = func(*args, **kwargs)
File "/home/mkoenig/.virtualenvs/pkdb_models/lib/python3.9/site-packages/amici/sbml_import.py", line 408, in _process_sbml
self._process_parameters(constant_parameters)
File "/home/mkoenig/.virtualenvs/pkdb_models/lib/python3.9/site-packages/amici/logging.py", line 194, in wrapper_timer
rval = func(*args, **kwargs)
File "/home/mkoenig/.virtualenvs/pkdb_models/lib/python3.9/site-packages/amici/sbml_import.py", line 845, in _process_parameters
raise SBMLException(
amici.sbml_import.SBMLException: Cannot turn parameter IVDOSE_icg into a constant/fixed parameter since it either has an initial assignment or is the target of an assignment or rate rule.
Process finished with exit code 1
The text was updated successfully, but these errors were encountered:
Hi all,
trying to load the attached PETab problem
icg_petab_v2.zip
but getting the following error.
This is a simple model which has the following rate rule
As part of my conditions I want to set
IVDOSE_icg[t=0] = value
. I assume you handle parameters different then species and compartments, but this is not correct. You have to split the set of parameters in constant parameters and parameters governed by rate rules. Parameters governed by rate rules are just state variables in the ODE and everything which is allowed for species state variables and compartment state variables must also work for parameter state variables!I.e. the more correct way for the condition table description in
https://petab.readthedocs.io/en/latest/documentation_data_format.html#condition-table
should be
instead of
Could you please support the setting of initial conditions for parameters governed by rate rules? This mathematical construct occurs in many models and it would be completely unnatural to encode such parameters as
dummy
species or compartments just to get PETab to work.Code example with full error stack below.
results in
The text was updated successfully, but these errors were encountered: