QuantitySelection

compartment_model.QuantitySelection(self, ipm, selection, grouping, aggregation)

A kind of QuantityStrategy describing a sub-selection of IPM quantities (its events and compartments). A selection performs no grouping or aggregation.

Typically you will create one of these by calling methods on a QuantitySelector instance.

QuantitySelection is a frozen dataclass.

Parameters

ipm: BaseCompartmentModel

The original IPM quantities information.

selection: NDArray[np.bool_]

A boolean mask for selection of a subset of IPM quantities.

Attributes

ipm: BaseCompartmentModel

The original IPM quantities information.

selection: NDArray[np.bool_]

A boolean mask for selection of a subset of IPM quantities.

quantities: Sequence[CompartmentDef | EdgeDef]

The quantities in the result. If the strategy performs grouping these may be pseudo-quantities made by combining the quantities in the group.

labels: Sequence[str]

Labels for the quantities in the result, after any grouping.

compartment_index: int

Return the selected compartment index, if and only if there is exactly one compartment in the selection. Otherwise, raises ValueError. See compartment_indices if you want to select possibly multiple indices.

compartment_indices: tuple[int, …]

Return the selected compartment indices. These indices may be useful for instance to access a simulation output’s compartments result array. May be an empty tuple.

event_index: int

Return the selected event index, if and only if there is exactly one event in the selection. Otherwise, raises ValueError. See event_indices if you want to select possibly multiple indices.

event_indices: tuple[int, …]

Return the selected event indices. These indices may be useful for instance to access a simulation output’s events result array. May be an empty tuple.

Methods

Name Description
group Groups quantities according to the given options.