make_declarative#

pharmpy.modeling.make_declarative(model)[source]#

Make the model statments declarative

Each symbol will only be declared once.

Parameters:

model (Model) – Pharmpy model

Returns:

Model – Pharmpy model object

Examples

>>> from pharmpy.modeling import *
>>> model = load_example_model("pheno")
>>> model.statements.before_odes
TVCL = POP_CL⋅WGT
TVV = POP_VC⋅WGT
      ⎧TVV⋅(COVAPGR + 1)  for APGR < 5

TVV = ⎩       TVV          otherwise
           ETA_CL
CL = TVCL⋅ℯ
          ETA_VC
VC = TVV⋅ℯ
V = VC
S₁ = VC
>>> model = make_declarative(model)
>>> model.statements.before_odes
TVCL = POP_CL⋅WGT
      ⎧POP_VC⋅WGT⋅(COVAPGR + 1)  for APGR < 5

TVV = ⎩       POP_VC⋅WGT          otherwise
           ETA_CL
CL = TVCL⋅ℯ
          ETA_VC
VC = TVV⋅ℯ
V = VC
S₁ = VC