Cell Specification Values

ionworkspipeline.direct_entries.cell_spec.read_cell_spec_value(spec: dict, name: str, path: str, input_name: str | None = None) → tuple[float | CellSpecTable, dict]

Read one parameter’s value from a cell specification, converting its unit.

Parameters

specdict

The cell specification with its components, as the Ionworks Studio API returns it. A table is a dict with x and y lists and their x_unit and y_unit.

namestr

The parameter name. The value is converted to the unit in its bracket.

pathstr

The dotted JSON path of the value in the specification, e.g. anode.properties.thickness.

input_namestr, optional

For a table: the name of the input the parameter is a function of. The table’s axis is converted to the unit in its bracket. Without it the axis is converted to SI base units, the units PyBaMM’s function inputs take.

Returns

valuefloat or CellSpecTable

The value in the unit of name.

provenancedict

The path and value it was read from, e.g. {"path": "anode.properties.thickness", "value": 72.225, "unit": "um"}, or {"path": ..., "points": 236} for a table.

Raises

CellSpecReadError

If the path names nothing in the specification, the value is not a quantity or a table, or its unit doesn’t convert to the parameter’s.

class ionworkspipeline.direct_entries.cell_spec.CellSpecTable(x: list[float], y: list[float])

A table read from a cell specification, converted to its parameter’s units.

y is in the unit of the parameter’s name and x in the unit of the input it is a function of, e.g. an OCP in V against a stoichiometry.

class ionworkspipeline.direct_entries.cell_spec.CellSpecReadError(message: str, code: Literal['missing', 'unit_mismatch', 'wrong_shape'])

A mapped cell specification value that can’t be read.

code says why: "missing" (the path names nothing), "unit_mismatch" (the value doesn’t convert to the parameter’s unit) or "wrong_shape" (the path names something that is not a quantity or a table).

Extends: UserConfigurationError