CompartmentalSystemBuilder#
- class pharmpy.model.CompartmentalSystemBuilder(cs=None)[source]#
Bases:
object
Builder for CompartmentalSystem
Methods Summary
add_compartment
(compartment)Add compartment to system
add_dose
(compartment, dose)Add dose to compartment.
add_flow
(source, destination, rate)Add flow between two compartments
find_compartment
(name)move_dose
(source, destination[, admid])Move a dose input from one compartment to another
remove_compartment
(compartment)Remove compartment from system
remove_dose
(compartment[, admid])Remove dose of compartment.
remove_flow
(source, destination)Remove flow between two compartments
set_bioavailability
(compartment, bioavailability)Set bioavailability of compartment
set_dose
(compartment, dose)Set dose of compartment, replacing the previous.
set_input
(compartment, input)Set zero order input of compartment
set_lag_time
(compartment, lag_time)Set lag time of compartment
Methods Documentation
- add_compartment(compartment)[source]#
Add compartment to system
The compartment will be added without any flows to other compartments. Use the add_flow method to add flows to and from the newly added compartment.
- Parameters:
compartment (Compartment) – Compartment to add
Examples
>>> from pharmpy.model import CompartmentalSystemBuilder >>> cb = CompartmentalSystemBuilder() >>> central = cb.add_compartment("CENTRAL")
- add_dose(compartment, dose)[source]#
Add dose to compartment.
- Parameters:
compartment (Compartment) – Compartment for which to add dose
dose (Dose) – New dose
- Returns:
Compartment – The new updated compartment
- add_flow(source, destination, rate)[source]#
Add flow between two compartments
- Parameters:
source (Compartment) – Source compartment
destination (Compartment) – Destination compartment
rate (Expression) – Symbolic rate of flow
Examples
>>> from pharmpy.model import Compartment, CompartmentalSystemBuilder >>> cb = CompartmentalSystemBuilder() >>> depot = Compartment.create("DEPOT") >>> cb.add_compartment(depot) >>> central = Compartment.create("CENTRAL") >>> cb.add_compartment(central) >>> cb.add_flow(depot, central, "KA")
- move_dose(source, destination, admid=None)[source]#
Move a dose input from one compartment to another
- Parameters:
source (Compartment) – Source compartment
destination (Compartment) – Destination compartment
admid (int) – Move dose with specified admid, move all if None. Default is None.
- remove_compartment(compartment)[source]#
Remove compartment from system
- Parameters:
compartment (Compartment) – Compartment object to remove from system
Examples
>>> from pharmpy.model import Compartment, CompartmentalSystemBuilder >>> cb = CompartmentalSystemBuilder() >>> central = Compartment.create("CENTRAL") >>> cb.add_compartment(central) >>> cb.remove_compartment(central)
- remove_dose(compartment, admid=None)[source]#
Remove dose of compartment.
Removes dose(s) of compartment. If admid is specified, only doses of that admid will be removed.
- Parameters:
compartment (Compartment) – Compartment for which to remove dose
admid (int) – Remove dose of compartment with specified admid, remove all if None. Default is None.
- Returns:
Compartment – The new updated compartment
- remove_flow(source, destination)[source]#
Remove flow between two compartments
- Parameters:
source (Compartment) – Source compartment
destination (Compartment) – Destination compartment
Examples
>>> from pharmpy.model import Compartment, CompartmentalSystemBuilder >>> cb = CompartmentalSystemBuilder() >>> depot = Compartment.create("DEPOT") >>> cb.add_compartment(depot) >>> central = Compartment.create("CENTRAL") >>> cb.add_compartment(central) >>> cb.add_flow(depot, central, "KA") >>> cb.remove_flow(depot, central)
- set_bioavailability(compartment, bioavailability)[source]#
Set bioavailability of compartment
- Parameters:
compartment (Compartment) – Compartment for which to change bioavailability
bioavailability (expr) – New bioavailability
- Returns:
Compartment – The new updated compartment
- set_dose(compartment, dose)[source]#
Set dose of compartment, replacing the previous.
- Parameters:
compartment (Compartment) – Compartment for which to set dose
dose (Dose) – New dose
- Returns:
Compartment – The new updated compartment