Direct entries

Direct-entry schemas for parameters whose value is supplied explicitly instead of fit.

Schemas for direct entries.

class ionworks.pipeline.direct_entries.BaseInterpolation(parameters: Mapping[str, Any] | None = None, source: str | None = None, pipeline_id: str | None = None, keep: list[str] | None = None, cell_spec_id: str | None = None, mapping: Mapping[str, str] | None = None, *, provenance: dict[str, ProvenanceRecord] | None = None, base_parameter_name: str, formulation: Literal['knots', 'slopes'] = 'knots')[source]

Bases: DirectEntry

Base class for piecewise interpolation direct entries.

Carries the fields shared between 1D and 2D piecewise interpolants (base_parameter_name, formulation); 1D and 2D subclasses add their own breakpoint and smoothing fields.

base_parameter_name: str
formulation: Literal['knots', 'slopes']
model_config = {'arbitrary_types_allowed': True, 'extra': 'forbid', 'populate_by_name': True, 'validate_assignment': True}

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

model_post_init(context: Any, /) → None

This function is meant to behave like a BaseModel method to initialize private attributes.

It takes context as an argument since that’s what pydantic-core passes when calling it.

Args:

self: The BaseModel instance. context: The context.

class ionworks.pipeline.direct_entries.DirectEntry(parameters: Mapping[str, Any] | None = None, source: str | None = None, pipeline_id: str | None = None, keep: list[str] | None = None, cell_spec_id: str | None = None, mapping: Mapping[str, str] | None = None, *, provenance: dict[str, ProvenanceRecord] | None = None)[source]

Bases: BaseSchema

Directly provide parameter values to the pipeline.

Supplies pre-defined parameter values to the pipeline — typically from literature, manufacturer specifications, or manual entry. May alternatively reference a completed Ionworks Studio pipeline via pipeline_id, in which case the parameter values are fetched from that pipeline’s results at run time, or a cell specification via cell_spec_id, in which case they are read from its design values (thicknesses, porosities, ratings and so on).

Parameters:
  • parameters (Mapping, optional) – Mapping of pybamm parameter names to their values (e.g. {"Electrode height [m]": 0.1}). Values may be floats, arrays, pybamm-serialisable symbols, or callables (e.g. concentration- or temperature-dependent functions) — each is converted to the wire form the server reconstructs. A pybamm.ParameterValues is accepted too. Leave empty when using pipeline_id.

  • source (str, optional) – Free-text reference describing where these parameters came from (e.g. paper citation, datasheet reference). Propagated through to provenance records.

  • pipeline_id (str, optional) – ID of a completed pipeline on Ionworks Studio. When set, the parameter values are fetched from that pipeline’s results instead of from parameters. The referenced pipeline must be in the completed state.

  • keep (list of str, optional) – With pipeline_id, the only parameters to take from that pipeline’s results, e.g. the fitted values. Without it, every parameter the pipeline produced is taken.

  • cell_spec_id (str, optional) – ID of a cell specification on Ionworks Studio to read the parameter values from, using mapping. They are read once, when the pipeline is submitted, so later edits to the specification don’t change it.

  • mapping (dict of str to str, optional) – With cell_spec_id, the JSON path in the specification of each parameter’s value, e.g. anode.properties.thickness, anode.material.definition.particle_size_d50 or ratings.capacity: the header of its column in the measurements table. Path segments are letters, digits and underscores. Each value is converted to the unit in its parameter’s name, so 72.225 um becomes 7.2225e-05 for "Negative electrode thickness [m]" and 40 percent becomes 0.4 for "Negative electrode porosity". Every path must name a value the specification has.

  • provenance (dict of str to ProvenanceRecord, optional) – Where each parameter came from, keyed by parameter name: the path it was read from and the value and unit written there. A cell specification entry records it, e.g. {"path": "anode.properties.thickness", "value": 72.225, "unit": "um"}.

Examples

>>> known = iw.pipeline.direct_entries.DirectEntry(
...     parameters={
...         "Ambient temperature [K]": 298.15,
...         "Nominal cell capacity [A.h]": 3.0,
...     },
...     source="datasheet",
... )
>>> config = iw.pipeline.Pipeline({"known": known}).to_config()

Geometry read from a cell specification:

>>> design = iw.pipeline.direct_entries.DirectEntry(
...     cell_spec_id="<cell spec id>",
...     mapping={
...         "Negative electrode thickness [m]": "anode.properties.thickness",
...         "Negative electrode porosity": "anode.properties.porosity",
...         "Nominal cell capacity [A.h]": "ratings.capacity",
...     },
... )
parameters: Annotated[dict[str, Any] | ParameterValues, BeforeValidator(func=serialize_parameters, json_schema_input_type=PydanticUndefined)]
source: str | None
pipeline_id: str | None
keep: list[str] | None
cell_spec_id: str | None
mapping: dict[str, str] | None
provenance: dict[str, ProvenanceRecord] | None
to_config() → dict[source]

Build the dict you submit through ionworks.api.

Carries either the parameter values you supplied (under "values") or a reference to a completed Studio pipeline (under "pipeline_id") plus an optional provenance "source". Tagged as "element_type": "entry" so the API knows where to slot it in the pipeline.

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

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

model_post_init(context: Any, /) → None

This function is meant to behave like a BaseModel method to initialize private attributes.

It takes context as an argument since that’s what pydantic-core passes when calling it.

Args:

self: The BaseModel instance. context: The context.

class ionworks.pipeline.direct_entries.DirectEntryFunctionSchema[source]

Bases: BaseSchema

Base wrapper for named iw.pipeline.direct_entries helper functions.

Subclasses set __function_name__ (the snake_case function name) and declare Field attributes matching that function’s signature. to_config serialises to {"name": <function_name>, **kwargs} so the pipeline parser can reconstruct the corresponding DirectEntry at run time.

Examples

>>> # every concrete subclass follows the same construction pattern;
>>> # exposed under its snake_case name in ``iw.pipeline.direct_entries``
>>> entry = iw.pipeline.direct_entries.bruggeman(electrode=1.5, electrolyte=1.5)
>>> config = iw.pipeline.Pipeline({"bruggeman": entry}).to_config()
>>> # then submit `config` via ionworks.api
to_config() → dict[source]

Build the dict you submit through ionworks.api.

The output is {"name": "<function_name>", **kwargs} where <function_name> is the snake_case name of the helper this wraps ("average_ocp", "bruggeman", …) and **kwargs are the arguments you set on this schema. Default and empty values are omitted to keep the payload minimal.

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

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

model_post_init(context: Any, /) → None

This function is meant to behave like a BaseModel method to initialize private attributes.

It takes context as an argument since that’s what pydantic-core passes when calling it.

Args:

self: The BaseModel instance. context: The context.

class ionworks.pipeline.direct_entries.InitialStateOfCharge(value)[source]

Bases: DirectEntry

Set the initial state of charge.

Parameters:

value (float) – Initial state of charge as a percentage (0 to 100).

Examples

>>> entry = iw.pipeline.direct_entries.InitialStateOfCharge(50.0)
>>> config = iw.pipeline.Pipeline({"soc": entry}).to_config()
value: int | float
to_config() → dict[source]

Build the dict you submit through ionworks.api.

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

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

model_post_init(context: Any, /) → None

This function is meant to behave like a BaseModel method to initialize private attributes.

It takes context as an argument since that’s what pydantic-core passes when calling it.

Args:

self: The BaseModel instance. context: The context.

class ionworks.pipeline.direct_entries.InitialTemperature(value)[source]

Bases: DirectEntry

Set the initial and ambient temperatures.

Parameters:

value (float) – Initial and ambient temperatures in Kelvin.

Examples

>>> entry = iw.pipeline.direct_entries.InitialTemperature(298.15)
>>> config = iw.pipeline.Pipeline({"temp": entry}).to_config()
value: int | float
to_config() → dict[source]

Build the dict you submit through ionworks.api.

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

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

model_post_init(context: Any, /) → None

This function is meant to behave like a BaseModel method to initialize private attributes.

It takes context as an argument since that’s what pydantic-core passes when calling it.

Args:

self: The BaseModel instance. context: The context.

class ionworks.pipeline.direct_entries.InitialVoltage(value)[source]

Bases: DirectEntry

Set the initial voltage.

Parameters:

value (float) – Initial voltage in volts.

Examples

>>> entry = iw.pipeline.direct_entries.InitialVoltage(3.7)
>>> config = iw.pipeline.Pipeline({"voltage": entry}).to_config()
value: int | float
to_config() → dict[source]

Build the dict you submit through ionworks.api.

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

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

model_post_init(context: Any, /) → None

This function is meant to behave like a BaseModel method to initialize private attributes.

It takes context as an argument since that’s what pydantic-core passes when calling it.

Args:

self: The BaseModel instance. context: The context.

class ionworks.pipeline.direct_entries.PiecewiseInterpolation1D(base_parameter_name: str, breakpoint_values: list[float], breakpoint_parameter_name: str, smoothing: float = 0.0001, formulation: str = 'knots', source: str | None = None, parameters: dict[str, Any] | None = None, *, pipeline_id: str | None = None, keep: list[str] | None = None, cell_spec_id: str | None = None, mapping: dict[str, str] | None = None, provenance: dict[str, ProvenanceRecord] | None = None)[source]

Bases: BaseInterpolation

Piecewise linear interpolation (1D) direct entry.

Creates a smooth piecewise linear function for a parameter that varies with respect to a single breakpoint parameter (e.g. SOC, temperature, voltage). Smooth heaviside transitions keep the interpolation continuous and differentiable for use in pybamm models.

Examples

>>> entry = iw.pipeline.direct_entries.PiecewiseInterpolation1D(
...     base_parameter_name="Particle diffusion time [s]",
...     breakpoint_values=[0.0, 0.5, 1.0],
...     breakpoint_parameter_name="SOC",
... )
>>> config = iw.pipeline.Pipeline({"diffusion": entry}).to_config()
breakpoint_values: list[float]
breakpoint_parameter_name: str
smoothing: float
to_config() → dict[source]

Build the dict you submit through ionworks.api.

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

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

model_post_init(context: Any, /) → None

This function is meant to behave like a BaseModel method to initialize private attributes.

It takes context as an argument since that’s what pydantic-core passes when calling it.

Args:

self: The BaseModel instance. context: The context.

class ionworks.pipeline.direct_entries.PiecewiseInterpolation2D(base_parameter_name: str, breakpoint1_values: list[float], breakpoint1_parameter_name: str, breakpoint2_values: list[float], breakpoint2_parameter_name: str, smoothing1: float = 0.0001, smoothing2: float = 0.0001, formulation: str = 'knots', source: str | None = None, parameters: dict[str, Any] | None = None, *, pipeline_id: str | None = None, keep: list[str] | None = None, cell_spec_id: str | None = None, mapping: dict[str, str] | None = None, provenance: dict[str, ProvenanceRecord] | None = None)[source]

Bases: BaseInterpolation

Piecewise bilinear interpolation (2D) direct entry.

Creates a smooth piecewise bilinear function for a parameter that varies with respect to two breakpoint parameters (e.g. SOC and temperature). Smooth heaviside transitions keep the interpolation continuous and differentiable for use in pybamm models.

Examples

>>> entry = iw.pipeline.direct_entries.PiecewiseInterpolation2D(
...     base_parameter_name="Diffusivity [m2.s-1]",
...     breakpoint1_values=[0.0, 0.5, 1.0],
...     breakpoint1_parameter_name="SOC",
...     breakpoint2_values=[273.15, 298.15, 323.15],
...     breakpoint2_parameter_name="Temperature [K]",
... )
>>> config = iw.pipeline.Pipeline({"diffusivity": entry}).to_config()
breakpoint1_values: list[float]
breakpoint1_parameter_name: str
breakpoint2_values: list[float]
breakpoint2_parameter_name: str
smoothing1: float
smoothing2: float
to_config() → dict[source]

Build the dict you submit through ionworks.api.

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

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

model_post_init(context: Any, /) → None

This function is meant to behave like a BaseModel method to initialize private attributes.

It takes context as an argument since that’s what pydantic-core passes when calling it.

Args:

self: The BaseModel instance. context: The context.

class ionworks.pipeline.direct_entries.ProvenanceRecord(*, path: str, value: float, unit: str = '')[source]

Bases: BaseModel

Where one parameter of a direct entry was read from.

model_config = {'extra': 'forbid'}

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

path: str

Where the value was read, e.g. anode.properties.thickness.

value: float

The value as written there, before unit conversion.

unit: str

The unit it was written in, e.g. um; empty when it has none.

ionworks.pipeline.direct_entries.arrhenius_butler_volmer_exchange_current_density

alias of ArrheniusButlerVolmerExchangeCurrentDensity

ionworks.pipeline.direct_entries.arrhenius_electrolyte_conductivity

alias of ArrheniusElectrolyteConductivity

ionworks.pipeline.direct_entries.arrhenius_electrolyte_diffusivity

alias of ArrheniusElectrolyteDiffusivity

ionworks.pipeline.direct_entries.arrhenius_particle_diffusivity

alias of ArrheniusParticleDiffusivity

ionworks.pipeline.direct_entries.average_ocp

alias of AverageOCP

ionworks.pipeline.direct_entries.bruggeman

alias of Bruggeman

ionworks.pipeline.direct_entries.constant_electrolyte

alias of ConstantElectrolyte

ionworks.pipeline.direct_entries.from_json

alias of FromJson

ionworks.pipeline.direct_entries.landesfeind_electrolyte

alias of LandesfeindElectrolyte

ionworks.pipeline.direct_entries.li_plating_defaults

alias of LiPlatingDefaults

ionworks.pipeline.direct_entries.lithium_metal_anode

alias of LithiumMetalAnode

ionworks.pipeline.direct_entries.mechanical_degradation_defaults

alias of MechanicalDegradationDefaults

ionworks.pipeline.direct_entries.nyman_electrolyte

alias of NymanElectrolyte

ionworks.pipeline.direct_entries.one_cm2_cell

alias of OneCm2Cell

ionworks.pipeline.direct_entries.sei_defaults

alias of SeiDefaults

ionworks.pipeline.direct_entries.spm_defaults

alias of SpmDefaults

ionworks.pipeline.direct_entries.standard_defaults

alias of StandardDefaults

ionworks.pipeline.direct_entries.temperatures

alias of Temperatures

ionworks.pipeline.direct_entries.zero_activation_energy

alias of ZeroActivationEnergy

ionworks.pipeline.direct_entries.zero_entropic_change

alias of ZeroEntropicChange