set_initial_condition#

pharmpy.modeling.set_initial_condition(model, compartment, expression, time=0)[source]#

Set an initial condition for the ode system

If the initial condition is already set it will be updated. If the initial condition is set to zero at time zero it will be removed (since the default is 0).

Parameters:
  • model (Model) – Pharmpy model

  • compartment (str) – Name of the compartment

  • expression (Union[str, Expr]) – The expression of the initial condition

  • time (Union[str, Expr]) – Time point. Default 0

Returns:

model – Updated Pharmpy model

Examples

>>> from pharmpy.modeling import *
>>> model = load_example_model("pheno")
>>> model = set_initial_condition(model, "CENTRAL", 10)
>>> get_initial_conditions(model)
{A_CENTRAL(0): 10}