sme.Model.compartments

property Model.compartments

the compartments in this model

a list of Compartment that can be iterated over, or indexed into by name or position in the list.

Examples

the list of compartments can be iterated over:

>>> import sme
>>> model = sme.open_example_model()
>>> for compartment in model.compartments:
...     print(compartment.name)
Outside
Cell
Nucleus

or a compartment can be found using its name:

>>> cell = model.compartments["Cell"]
>>> print(cell.name)
Cell

or indexed by its position in the list:

>>> last_compartment = model.compartments[-1]
>>> print(last_compartment.name)
Nucleus
Type:

CompartmentList