get_unit_of#

pharmpy.modeling.get_unit_of(model, variable)[source]#

Derive the physical unit of a variable in the model

Unit information for the dataset needs to be available. The variable can be defined in the code, a dataset olumn, a parameter or a random variable.

Parameters:
  • model (Model) – Pharmpy model object

  • variable (str or Symbol) – Find physical unit of this variable

Returns:

Unit – A unit expression

Examples

>>> from pharmpy.modeling import load_example_model, get_unit_of
>>> model = load_example_model("pheno")
>>> get_unit_of(model, "Y")
milligram/liter
>>> get_unit_of(model, "V")
liter
>>> get_unit_of(model, "WGT")
kilogram