Compartment#

class pharmpy.Compartment(name, dose=None, lag_time=None, bioavailability=None)[source]#

Bases: object

Compartment for a compartmental system

Parameters:
  • name (str) – Compartment name

  • dose (Dose) – Dose object for dose into this compartment. Default None for no dose.

  • lag_time (Expression) – Lag time for doses entering this compartment. Default 0

  • bioavailability (Expression) – Bioavailability fraction for doses entering this compartment. Default 1

Examples

>>> from pharmpy import Bolus, Compartment
>>> comp = Compartment("CENTRAL")
>>> comp
Compartment(CENTRAL)
>>> comp = Compartment("DEPOT", lag_time="ALAG")
>>> comp
Compartment(DEPOT, lag_time=ALAG)
>>> dose = Bolus.create("AMT")
>>> comp = Compartment("DEPOT", dose=dose)
>>> comp
Compartment(DEPOT, dose=Bolus(AMT))

Attributes Summary

amount

Symbol for the amount in the compartment

bioavailability

Bioavailability fraction for doses into compartment

dose

free_symbols

Get set of all free symbols in the compartment

lag_time

Lag time for doses into compartment

name

Compartment name

Methods Summary

create(name[, dose, lag_time, bioavailability])

subs(substitutions)

Substitute expressions or symbols in compartment

Attributes Documentation

amount#

Symbol for the amount in the compartment

Examples

>>> from pharmpy import Compartment
>>> comp = Compartment("CENTRAL")
>>> comp.amount
A_CENTRAL
bioavailability#

Bioavailability fraction for doses into compartment

dose#
free_symbols#

Get set of all free symbols in the compartment

Examples

>>> from pharmpy import Bolus, Compartment
>>> dose = Bolus.create("AMT")
>>> comp = Compartment("CENTRAL", dose=dose, lag_time="ALAG")
>>> comp.free_symbols  
{ALAG, AMT}
lag_time#

Lag time for doses into compartment

name#

Compartment name

Methods Documentation

classmethod create(name, dose=None, lag_time=None, bioavailability=None)[source]#
subs(substitutions)[source]#

Substitute expressions or symbols in compartment

Examples

>>> from pharmpy import Bolus, Compartment
>>> dose = Bolus.create("AMT")
>>> comp = Compartment("CENTRAL", dose=dose)
>>> comp.subs({"AMT": "DOSE"})
Compartment(CENTRAL, dose=Bolus(DOSE))