Result API Reference

This page is the Sphinx/autodoc reference for the public result-model classes. For narrative examples, see Result classes.

Equilibrium Results

class equilipy.results.equilib.EquilibResult(context: ResultContext | None = None)[source]

Container for one or more equilibrium calculation points.

The public API normalizes single and batch results through point and points while preserving scalar convenience properties for one-point results.

property Cp: float | None | List[float | None]

Return heat capacity values.

property G: float | None | List[float | None]

Return Gibbs energy values.

property H: float | None | List[float | None]

Return enthalpy values.

property P: float | List[float]

Return pressure values.

property S: float | None | List[float | None]

Return entropy values.

property T: float | List[float]

Return temperature values.

property activity: PhaseSpeciesProperty

Return activities keyed by phase and species.

append(other: EquilibResult)[source]

Append another result object into this result.

append_error()[source]

Append an error result row.

append_output()[source]

Append the current Fortran output state.

available_columns() List[str][source]

Return flattened result columns available for export or display.

property data: None | EquilibPoint | List[EquilibPoint]

Return raw point storage for single or batch equilibrium results.

classmethod from_bundle(bundle: Dict[str, Any]) EquilibResult[source]

Reconstruct a result from a JSON-safe bundle.

property n_i: Dict[str, float] | List[Dict[str, float]]

Return system component amounts on a mole basis.

property partial_enthalpy: PhaseSpeciesProperty

Return partial enthalpies keyed by phase and species.

property partial_entropy: PhaseSpeciesProperty

Return partial entropies keyed by phase and species.

property partial_gibbs: PhaseSpeciesProperty

Return partial molar Gibbs energies keyed by phase and species.

property partial_heat_capacity: PhaseSpeciesProperty

Return partial heat capacities keyed by phase and species.

phase(name: str) PhaseResult | BatchPhaseResult[source]

Return one phase by name for single or batch equilibrium results.

property phases: PhaseCollection

Return phase results, materialized lazily for batch results.

property point: EquilibPoint

Return the only equilibrium point, or raise for empty/batch results.

property points: List[EquilibPoint]

Return equilibrium points as a list regardless of internal state.

property stable_phases: PhaseCollection

Return stable phase results, materialized lazily for batch results.

property standard_gibbs_energy: PhaseSpeciesProperty

Return standard Gibbs energies keyed by phase and species.

to_bundle() Dict[str, Any][source]

Return a JSON-safe bundle that can reconstruct this result.

to_dict() Dict[str, Any][source]

Export all results to a flattened dictionary.

Uses reusable helpers to flatten phase attributes.

to_table() ResultTable[source]

Return a selectable/exportable table view of this result.

property w_i: Dict[str, float] | List[Dict[str, float]]

Return system component amounts on a mass basis.

class equilipy.results.equilib.BatchPhaseResult(name: str, phases: list[PhaseResult | None])[source]

Phase-like view that aggregates one phase across batch rows.

property elements: CompositionFractions

Return element mole and mass fractions across batch rows.

property endmembers: CompositionFractions

Return endmember mole and mass fractions across batch rows.

class equilipy.results.equilib.EquilibPoint(*, T: float, P: float, G: float | None = None, H: float | None = None, S: float | None = None, Cp: float | None = None, n_i: Dict[str, float]=<factory>, w_i: Dict[str, float]=<factory>, stable_phase_summary: StablePhaseSummaryDict = <factory>, phase_map: Dict[str, ~equilipy.results.equilib.PhaseResult]=<factory>)[source]

Pydantic model for a single equilibrium calculation point.

This represents one “row” of data.

Cp: float | None
G: float | None
H: float | None
P: float
S: float | None
T: float
classmethod for_error() EquilibPoint[source]

Create an instance representing a failed calculation.

The failed calculation row is populated with NaNs.

classmethod from_fortran() EquilibPoint[source]

Create an instance from the Fortran and variable modules.

model_config = {'arbitrary_types_allowed': True, 'extra': 'forbid', 'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}

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

n_i: Dict[str, float]
phase(name: str) PhaseResult[source]

Return one phase by name.

phase_map: Dict[str, PhaseResult]
property phases: PhaseCollection

Return all phases for this equilibrium point.

stable_phase_summary: StablePhaseSummaryDict
property stable_phases: PhaseCollection

Return stable phases for this equilibrium point.

w_i: Dict[str, float]
class equilipy.results.equilib.PhaseResult(*, id: int, name: str, amount_n: Annotated[float, ~annotated_types.Ge(ge=0)] = 0.0, amount_w: Annotated[float, ~annotated_types.Ge(ge=0)] = 0.0, amount_n_basis: str = 'phase_moles', stability: Annotated[float, ~annotated_types.Ge(ge=0.0), ~annotated_types.Le(le=1.0)] = 0.0, parent_model_id: int | None = None, parent_model_name: str | None = None, composition_set_id: Annotated[int, ~annotated_types.Ge(ge=0)] = 1, display_label: str | None = None, ordering_degree: float | None = None, endmembers_x: Dict[str, float]=<factory>, endmembers_w: Dict[str, float]=<factory>, elements_x: Dict[str, float]=<factory>, elements_w: Dict[str, float]=<factory>, G: float | None = None, H: float | None = None, S: float | None = None, Cp: float | None = None, partial_gibbs: Dict[str, float]=<factory>, standard_gibbs_energy: Dict[str, float]=<factory>, activity: Dict[str, float]=<factory>, partial_enthalpy: Dict[str, float]=<factory>, partial_entropy: Dict[str, float]=<factory>, partial_heat_capacity: Dict[str, float]=<factory>)[source]

Pydantic model for a single phase, solution or compound.

Holds the thermochemical state of one phase with lowercase public field names and clean composition accessors.

Cp: float | None
G: float | None
H: float | None
S: float | None
activity: Dict[str, float]
amount_n: float
amount_n_basis: str
amount_w: float
composition_set_id: int
display_label: str | None
property elements: CompositionFractions

Return element mole and mass fractions.

elements_w: Dict[str, float]
elements_x: Dict[str, float]
property endmembers: CompositionFractions

Return endmember mole and mass fractions.

endmembers_w: Dict[str, float]
endmembers_x: Dict[str, float]
id: int
model_config = {'arbitrary_types_allowed': True, 'extra': 'forbid', 'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}

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

name: str
ordering_degree: float | None
parent_model_id: int | None
parent_model_name: str | None
partial_enthalpy: Dict[str, float]
partial_entropy: Dict[str, float]
partial_gibbs: Dict[str, float]
partial_heat_capacity: Dict[str, float]
stability: float
standard_gibbs_energy: Dict[str, float]

Scheil Results

class equilipy.results.scheil.ScheilResult(liquid_phase_name: str | None = None, input_unit: List[str] | None = None, context: ResultContext | None = None)[source]

Scheil-Gulliver cooling result object.

property Cp: float | None | List[float | None]

Return Scheil heat capacity values.

property G: float | None | List[float | None]

Return Scheil Gibbs energy values.

property H: float | None | List[float | None]

Return Scheil enthalpy values.

property P: float | List[float] | None

Return Scheil pressures.

property Q: float | None | List[float | None]

Return enthalpy change relative to the first Scheil point.

property S: float | None | List[float | None]

Return Scheil entropy values.

property T: float | List[float] | None

Return Scheil temperatures.

append_output() None[source]

Append the next Scheil step’s results from the current Fortran state.

available_columns() List[str][source]

Return flattened Scheil result columns available for export/display.

property fl: float | List[float] | None

Return liquid fraction on a mole basis.

property fl_w: float | List[float] | None

Return liquid fraction on a mass basis.

classmethod from_bundle(bundle: Dict[str, Any]) ScheilResult[source]

Reconstruct a Scheil result without calling the Fortran initializer.

property fs: float | List[float] | None

Return solid fraction on a mole basis.

property fs_w: float | List[float] | None

Return solid fraction on a mass basis.

property n_i: Dict[str, float]

Return initial system component amounts on a mole basis.

phase_amount_n(name: str) List[float][source]

Return one cumulative phase amount history on a mole basis.

phase_amount_w(name: str) List[float][source]

Return one cumulative phase amount history on a mass basis.

property phase_amounts_n: Dict[str, List[float]]

Return cumulative phase amount histories on a mole basis.

property phase_amounts_w: Dict[str, List[float]]

Return cumulative phase amount histories on a mass basis.

property phase_labels: str | List[str]

Return stable phase labels along the Scheil path.

property point: ScheilPoint

Return the only Scheil point, or raise for empty/multi-step results.

property points: List[ScheilPoint]

Return Scheil points as a list regardless of internal storage.

scheil_constituent_segments(x: str = 'fs_w', y: str = 'T', *, connect: bool = True, x_unit: str | None = None, y_unit: str | None = None) List[ScheilConstituentSegment][source]

Return Scheil constituent segments grouped by contiguous stable labels.

x and y are names of per-step ScheilResult properties such as "T", "Q", "fs", "fs_w", "fl", "fl_w", "G", "H", "S", and "Cp". Use x_unit or y_unit only when that axis is "T"; accepted values are "K", "C", "F", "R", or "input". When connect is true, each new segment starts from the previous point so phase-change lines remain visually connected.

property scheil_constituents: Dict[str, float]

Return Scheil constituent summary values.

to_bundle() Dict[str, Any][source]

Return a JSON-safe bundle that can reconstruct this Scheil result.

to_dict() Dict[str, Any][source]

Export this Scheil result to a flattened dictionary.

to_table() ResultTable[source]

Return a selectable/exportable table view of this Scheil result.

update_scheil_constituents() Dict[str, float][source]

Rebuild and return Scheil constituent summary values.

property w_i: Dict[str, float]

Return initial system component amounts on a mass basis.

class equilipy.results.scheil.ScheilPoint(*, T: float, P: float, G: float | None, H: float | None, S: float | None, Cp: float | None, fl: ~typing.Annotated[float, ~annotated_types.Ge(ge=0)], fs: ~typing.Annotated[float, ~annotated_types.Ge(ge=0)], fl_w: ~typing.Annotated[float, ~annotated_types.Ge(ge=0)], fs_w: ~typing.Annotated[float, ~annotated_types.Ge(ge=0)], label: str, cumulative_phases_n: ~typing.Dict[str, float] = <factory>, cumulative_phases_w: ~typing.Dict[str, float] = <factory>)[source]

Single step in a Scheil-Gulliver simulation.

Cp: float | None
G: float | None
H: float | None
P: float
S: float | None
T: float
cumulative_phases_n: Dict[str, float]
cumulative_phases_w: Dict[str, float]
fl: float
fl_w: float
fs: float
fs_w: float
label: str
model_config = {'arbitrary_types_allowed': True, 'extra': 'forbid', 'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}

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

class equilipy.results.scheil.ScheilConstituentSegment(label: str, x: List[Any], y: List[Any])[source]

Contiguous Scheil path segment with the same stable phase label.

label: str
x: List[Any]
y: List[Any]

Phase Collections

class equilipy.results.phase.PhaseCollection(phases: Mapping[str, Any] | None = None)[source]

Ordered dictionary of phase names to phase-like result objects.

property names: list[str]

Return phase names in deterministic insertion order.

stable() PhaseCollection[source]

Return a collection containing only stable phases.

property stable_names: list[str]

Return names for phases whose stability flag is positive.

class equilipy.results.phase.PhaseSpeciesProperty(phases: Mapping[str, Mapping[str, Any]] | None = None)[source]

Phase-first view of one species-level property.

property names: list[str]

Return phase names in deterministic insertion order.

property species_names: list[str]

Return species names in deterministic insertion order across phases.

to_numpy() ndarray[source]

Return a dense numerical view with missing entries as NaN.

Shape is (n_phases, n_species) for scalar values and (n_points, n_phases, n_species) when stored values are vectors.

class equilipy.results.phase.CompositionFractions(x_i: dict[str, float], w_i: dict[str, float])[source]

Mole- and mass-basis composition fractions for a phase surface.

w_i: dict[str, float]
x_i: dict[str, float]

Result Tables

class equilipy.results.table.ResultTable(data: Mapping[str, Any] | None = None, columns: Sequence[ResultColumn] | None = None)[source]

Column-oriented table with optional result-column metadata.

available_columns() list[str][source]

Return every selectable column key.

property column_keys: list[str]

Return column keys in display/export order.

property columns: list[ResultColumn]

Return column metadata in display/export order.

default_column_keys() list[str][source]

Return column keys marked for default display/export.

default_columns() list[ResultColumn][source]

Return columns marked for default display/export.

classmethod from_dict(data: Mapping[str, Any], columns: Sequence[ResultColumn] | None = None) ResultTable[source]

Build a result table from an existing flattened result dictionary.

select(keys: Iterable[str]) ResultTable[source]

Return a new table with only the requested columns, in that order.

select_groups(groups: str | Iterable[str]) ResultTable[source]

Return a new table with columns whose group is selected.

to_csv(path: str | Path) Path[source]

Write the selected table columns to a CSV file.

to_dict() dict[str, Any][source]

Return column-oriented data in this table’s current column order.

to_pandas() Any[source]

Return a pandas DataFrame for the selected columns.

to_polars() Any[source]

Return a Polars DataFrame for the selected columns.

to_rows() list[dict[str, Any]][source]

Return row-oriented data, broadcasting scalar columns if needed.

class equilipy.results.table.ResultColumn(key: str, label: str | None = None, group: str = 'other', unit: str | None = None, default: bool = True)[source]

Metadata for one result table column.

default: bool = True
group: str = 'other'
key: str
label: str | None = None
unit: str | None = None