Compartment#
- class pharmpy.model.Compartment(name, amount, doses=(), input=0, lag_time=0, bioavailability=1)[source]#
Bases:
CompartmentBase
Compartment for a compartmental system
- Parameters:
name (str) – Compartment name
doses (tuple(Dose)) – Dose object for dose into this compartment. Default None for no dose.
input (Expression) – Expression for other inputs to the compartment
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.model import Bolus, Compartment >>> comp = Compartment.create("CENTRAL") >>> comp Compartment(CENTRAL, amount=A_CENTRAL(t)) >>> comp = Compartment.create("DEPOT", lag_time="ALAG") >>> comp Compartment(DEPOT, amount=A_DEPOT(t), lag_time=ALAG) >>> dose = Bolus.create("AMT") >>> comp = Compartment.create("DEPOT", doses=(dose,)) >>> comp Compartment(DEPOT, amount=A_DEPOT(t), doses=Bolus(AMT, admid=1))
Attributes Summary
Compartment amount symbol
Bioavailability fraction for doses into compartment
Get set of all free symbols in the compartment
Lag time for doses into compartment
Compartment name
Methods Summary
create
(name[, amount, doses, input, ...])from_dict
(d)replace
(**kwargs)subs
(substitutions)Substitute expressions or symbols in compartment
to_dict
()Attributes Documentation
- amount#
Compartment amount symbol
- bioavailability#
Bioavailability fraction for doses into compartment
- doses#
- free_symbols#
Get set of all free symbols in the compartment
Examples
>>> from pharmpy.model import Bolus, Compartment >>> dose = Bolus.create("AMT") >>> comp = Compartment.create("CENTRAL", doses=(dose,), lag_time="ALAG") >>> comp.free_symbols {A_CENTRAL, ALAG, AMT}
- input#
- lag_time#
Lag time for doses into compartment
- name#
Compartment name
Methods Documentation
- subs(substitutions)[source]#
Substitute expressions or symbols in compartment
Examples
>>> from pharmpy.model import Bolus, Compartment >>> dose = Bolus.create("AMT") >>> comp = Compartment.create("CENTRAL", doses=(dose,)) >>> comp.subs({"AMT": "DOSE"}) Compartment(CENTRAL, amount=A_CENTRAL(t), doses=Bolus(DOSE, admid=1))