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:
DirectEntryBase 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.- 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].
- 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:
BaseSchemaDirectly 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 viacell_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. Apybamm.ParameterValuesis accepted too. Leave empty when usingpipeline_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 thecompletedstate.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_d50orratings.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, so72.225 umbecomes7.2225e-05for"Negative electrode thickness [m]"and40 percentbecomes0.4for"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
pathit was read from and thevalueandunitwritten 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)]¶
- 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].
- class ionworks.pipeline.direct_entries.DirectEntryFunctionSchema[source]¶
Bases:
BaseSchemaBase wrapper for named
iw.pipeline.direct_entrieshelper functions.Subclasses set
__function_name__(the snake_case function name) and declareFieldattributes matching that function’s signature.to_configserialises 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**kwargsare 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].
- class ionworks.pipeline.direct_entries.InitialStateOfCharge(value)[source]¶
Bases:
DirectEntrySet 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()
- 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].
- class ionworks.pipeline.direct_entries.InitialTemperature(value)[source]¶
Bases:
DirectEntrySet 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()
- 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].
- class ionworks.pipeline.direct_entries.InitialVoltage(value)[source]¶
Bases:
DirectEntrySet 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()
- 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].
- 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:
BaseInterpolationPiecewise 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()
- 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].
- 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:
BaseInterpolationPiecewise 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()
- 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].
- class ionworks.pipeline.direct_entries.ProvenanceRecord(*, path: str, value: float, unit: str = '')[source]¶
Bases:
BaseModelWhere 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].
- 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