Skip to content

BaseAdapter class

The BaseAdapter is the parent of all model adapters

acidwatch_models.base.BaseAdapter(*, concentrations: dict[str, int | float] | None = None, parameters: dict[str, str | bool | int | float] | None, conditions: Conditions | None = None)

conditions: Conditions instance-attribute

parameters instance-attribute

model_id: Annotated[str, Doc('Unique model identifier')] instance-attribute

Unique model identifier

display_name: Annotated[str, Doc('User-friendly model name which is displayed in the frontend')] instance-attribute

User-friendly model name which is displayed in the frontend

description: Annotated[str, Doc('A Markdown description for the model.')] instance-attribute

A Markdown description for the model.

category: Annotated[Literal['ChemicalEquilibrium', 'PhaseEquilibrium'], Doc('Category of the model: ChemicalEquilibrium (chemical reactions) or PhaseEquilibrium (phase changes)')] instance-attribute

Category of the model: ChemicalEquilibrium (chemical reactions) or PhaseEquilibrium (phase changes)

valid_substances: Annotated[list[str], Doc('Substances that this model can use')] instance-attribute

Substances that this model can use

base_url: Annotated[str | None, Doc('BaseURL for accessing a remote model')] class-attribute instance-attribute

BaseURL for accessing a remote model

client: httpx.AsyncClient property

A ready-to-use client to communicate with an external model

ATTRIBUTE DESCRIPTION
base_url

The external base URL. MUST be set to use this property.

RAISES DESCRIPTION
ValueError

If base_url is not set

concentrations: dict[str, float | int] property

passthrough_concentrations: dict[str, float | int] property

description_as_html() -> str cached classmethod

Get the description as rendered HTML

set_concentrations(value: dict[str, float | int]) -> None

merge_passthrough(phases: list[Phase]) -> list[Phase]

validate_concentrations(value: dict[str, float | int]) -> None

run() -> RunResult async

Run the simulation and return the results

ATTRIBUTE DESCRIPTION
concentrations

Initial concentrations

parameters

If defined, contains pydantic-validated model parameter instance