torchcell.metabolism.media.MediaBounds

class MediaBounds(*, media_name: str, model_id: str, policy: ~torchcell.metabolism.media.UptakePolicy, bounds: dict[str, ~torchcell.metabolism.media.ExchangeBound] = <factory>, resolutions: list[~torchcell.metabolism.media.ComponentResolution] = <factory>)[source]

Bases: ModelStrict

A medium expressed as exchange bounds for one specific model.

Pure data: it holds no reference to the cobra.Model it was built against, only that model’s id, so it serializes to JSON and can be diffed against another medium.

property n_components: int

Components in the ontology object that produced this vector.

property n_resolved: int

Components that became at least one exchange bound.

property unresolved_names: list[str]

Components we tried and failed to place on an exchange reaction.

property excluded_names: list[str]

Components a constraint-based model structurally cannot represent.

apply(model: cobra.Model) → None[source]

Close every exchange on model, then open exactly this medium.

Mutates the model, so callers use cobra’s with model: context to scope it. Closing first is what makes a medium a statement about the whole boundary rather than an additive patch on whatever the model shipped with.

model_config: ClassVar[ConfigDict] = {'extra': 'forbid', 'frozen': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].