Skip to content

Selection policy

See How values are selected for the policy itself.

pourbase.SelectionPolicy dataclass

SelectionPolicy(name: str, classes: tuple[EvidenceClass, ...], family_patterns: tuple[tuple[str, tuple[str, ...]], ...], tie_breaks: tuple[str, ...] = TIE_BREAKS, review_threshold_J_mol: float = 5000.0, ineligible_statuses: tuple[str, ...] = ('superseded_source_value', 'terminal_evidence_gap'), overrides: tuple[Override, ...] = (), exclusions: tuple[Override, ...] = (), version: str = '', source_text: str = '')

An ordered rule for choosing recommended values; see data/selection-policy.toml.

fingerprint property

fingerprint: str

A short hash identifying both policy configuration and selector behavior.

with_class_order

with_class_order(names: Iterable[str]) -> SelectionPolicy

The same policy with the classes in a new order.

with_family_order

with_family_order(class_name: str, families: Iterable[str]) -> SelectionPolicy

The same policy with the families of one class in a new order.

rank_of

rank_of(family: str) -> tuple[int, int]

(class position, family position); unknown families rank last.

pourbase.select

select(database: ThermodynamicDatabase, policy: SelectionPolicy | None = None, properties: Iterable[str] = PROPERTIES) -> dict[tuple[str, str], Selection]

The recommended value of every species and property under policy (default policy).

pourbase.with_policy

with_policy(database: ThermodynamicDatabase, policy: SelectionPolicy | str | Path) -> PolicyDatabase

database calculating with the Gibbs energies chosen by policy (a policy or a TOML path).

pourbase.PolicyDatabase

PolicyDatabase(base: ThermodynamicDatabase, policy: SelectionPolicy)

Bases: ThermodynamicDatabase

A database whose recommended values, and so its calculations, follow a selection policy.

On the bundled or another pourbase file the policy derives every recommended value. On a database that adds its own species to another (with_user_species), the policy replaces the Gibbs energies of the species it covers.

pourbase.compare_policies

compare_policies(database: ThermodynamicDatabase, first: SelectionPolicy, second: SelectionPolicy, properties: Iterable[str] = PROPERTIES) -> tuple[PolicyChange, ...]

Every species and property for which the two policies choose different values.