6.1.1.2.1.1. equilibrator_api.model.bounds

Define lower and upper bounds on compounds.

6.1.1.2.1.1.1. Module Contents

class equilibrator_api.model.bounds.BaseBounds[source]

Bases: object

A base class for declaring bounds on things.

abstract copy()[source]

Return a (deep) copy of self.

abstract get_lower_bound(compound: Union[str, equilibrator_cache.Compound])[source]

Get the lower bound for this key.

Parameters

key – a compound

abstract get_upper_bound(compound: Union[str, equilibrator_cache.Compound])[source]

Get the upper bound for this key.

Parameters

key – a compound

get_lower_bounds(compounds: Iterable[Union[str, equilibrator_cache.Compound]]) Iterable[equilibrator_api.Q_][source]

Get the bounds for a set of keys in order.

Parameters

compounds – an iterable of Compounds or strings

Returns

an iterable of the lower bounds

get_upper_bounds(compounds: Iterable[Union[str, equilibrator_cache.Compound]]) Iterable[equilibrator_api.Q_][source]

Get the bounds for a set of keys in order.

Parameters

compounds – an iterable of Compounds or strings

Returns

an iterable of the upper bounds

get_bound_tuple(compound: Union[str, equilibrator_cache.Compound]) Tuple[equilibrator_api.Q_, equilibrator_api.Q_][source]

Get both upper and lower bounds for this key.

Parameters

compound – a Compound object or string

Returns

a 2-tuple (lower bound, upper bound)

get_bounds(compounds: Iterable[Union[str, equilibrator_cache.Compound]]) Tuple[Iterable[equilibrator_api.Q_], Iterable[equilibrator_api.Q_]][source]

Get the bounds for a set of compounds.

Parameters

compounds – an iterable of Compounds

Returns

a 2-tuple (lower bounds, upper bounds)

static conc2ln_conc(b: equilibrator_api.Q_) float[source]

Convert a concentration to log-concentration.

Parameters

b – a concentration

Returns

the log concentration

get_ln_bounds(compounds: Iterable[Union[str, equilibrator_cache.Compound]]) Tuple[Iterable[float], Iterable[float]][source]

Get the log-bounds for a set of compounds.

Parameters

compounds – an iterable of Compounds or strings

Returns

a 2-tuple (log lower bounds, log upper bounds)

get_ln_lower_bounds(compounds: Iterable[Union[str, equilibrator_cache.Compound]]) Iterable[float][source]

Get the log lower bounds for a set of compounds.

Parameters

compounds – an iterable of Compounds or strings

Returns

an iterable of log lower bounds

get_ln_upper_bounds(compounds: Iterable[Union[str, equilibrator_cache.Compound]]) Iterable[float][source]

Get the log upper bounds for a set of compounds.

Parameters

compounds – an iterable of Compounds or strings

Returns

an iterable of log upper bounds

set_bounds(compound: Union[str, equilibrator_cache.Compound], lb: equilibrator_api.Q_, ub: equilibrator_api.Q_) None[source]

Set bounds for a specific key.

Parameters
  • key – a Compounds or string

  • lb – the lower bound value

  • ub – the upper bound value

class equilibrator_api.model.bounds.Bounds(lower_bounds: Dict[Union[str, equilibrator_cache.Compound], equilibrator_api.Q_] = None, upper_bounds: Dict[Union[str, equilibrator_cache.Compound], equilibrator_api.Q_] = None, default_lb: equilibrator_api.Q_ = default_conc_lb, default_ub: equilibrator_api.Q_ = default_conc_ub)[source]

Bases: BaseBounds

Contains upper and lower bounds for various keys.

Allows for defaults.

DEFAULT_BOUNDS[source]
classmethod from_csv(f: TextIO, comp_contrib: equilibrator_api.ComponentContribution, default_lb: equilibrator_api.Q_ = default_conc_lb, default_ub: equilibrator_api.Q_ = default_conc_ub) Bounds[source]

Read Bounds from a CSV file.

Parameters
  • f (TextIO) – an open .csv file stream

  • comp_contrib (ComponentContribution) – used for parsing compound accessions

  • default_lb (Q_) – the default lower bound

  • default_ub (Q_) – the default upper bound

to_data_frame() pandas.DataFrame[source]

Convert the list of bounds to a Pandas DataFrame.

check_bounds() None[source]

Assert the bounds are valid (i.e. that lb <= ub).

copy() Bounds[source]

Return a deep copy of self.

get_lower_bound(compound: Union[str, equilibrator_cache.Compound]) equilibrator_api.Q_[source]

Get the lower bound for this compound.

get_upper_bound(compound: Union[str, equilibrator_cache.Compound]) equilibrator_api.Q_[source]

Get the upper bound for this compound.

static get_default_bounds(comp_contrib: equilibrator_api.ComponentContribution) Bounds[source]

Return the default lower and upper bounds for a pre-determined list.

Parameters

comp_contrib (ComponentContribution) –

Return type

a Bounds object with the default values