Direct Entries¶
The base class for all direct entries is DirectEntry.
- class ionworkspipeline.direct_entries.DirectEntry(parameters: ParameterValues, source, provenance=None)¶
Directly provide parameters without calculation or fitting.
DirectEntry elements supply pre-defined parameter values to the pipeline, typically from literature, manufacturer specifications, or manual entry.
Parameters¶
- parametersiwp.ParameterValues
Dictionary of parameter names and values to provide. Values may be floats, arrays, or pybamm symbols. To supply callables (e.g. concentration- or temperature-dependent interpolants), wrap them in a
pybamm.ParameterValues— its serialisation converts the callables to symbolic expressions.- sourcestr
Reference or description of where these parameters came from (e.g., paper citation, datasheet reference).
- provenancedict[str, dict], optional
Where each parameter came from, keyed by parameter name: the
pathit was read from and thevalueandunitwritten there, e.g.{"path": "anode.properties.thickness", "value": 72.225, "unit": "um"}for one read from a cell specification.
Examples¶
Provide geometric parameters:
>>> from ionworkspipeline.direct_entries import DirectEntry >>> params = iwp.ParameterValues({ ... "Electrode height [m]": 0.1, ... "Electrode width [m]": 0.08, ... "Negative electrode thickness [m]": 100e-6, ... }) >>> entry = DirectEntry(params, source="Cell datasheet v2.1") >>> result = entry.run(iwp.ParameterValues({})) >>> result["Electrode height [m]"] 0.1
Extends:
PipelineElementSee also:
DirectEntry— field-level documentation.- classmethod from_cell_spec(cell_spec_id, mapping)¶
Create a DirectEntry that reads parameters from an Ionworks Studio cell spec.
Each value is converted to the unit in its parameter’s name, and the entry’s
provenancerecords the path and value each came from. The specification is read on the firstrun(), in the client’s current organization, so edits made to it before then are picked up.Parameters¶
- cell_spec_idstr
The ID of the cell specification on Ionworks Studio.
- mappingdict[str, str]
Parameter name to the JSON path of its value in the specification, e.g.
anode.properties.thickness,anode.material.definition.densityorratings.capacity: the header of its column in the measurements table.
Returns¶
- DirectEntry
A DirectEntry that will fetch the values on first
run().
Examples¶
>>> entry = DirectEntry.from_cell_spec( ... "spec-id", ... { ... "Negative electrode thickness [m]": "anode.properties.thickness", ... "Nominal cell capacity [A.h]": "ratings.capacity", ... }, ... ) >>> entry.outputs ['Negative electrode thickness [m]', 'Nominal cell capacity [A.h]']
- classmethod from_db(pipeline_id, keep=None)¶
Create a DirectEntry that will load results from an Ionworks Studio pipeline.
The actual API call is deferred to
run(), which validates that the pipeline is completed before fetching results.Parameters¶
- pipeline_idstr
The ID of the pipeline job on Ionworks Studio.
- keeplist of str, optional
The only parameters to take from that pipeline’s results, e.g. the fitted values. Without it, every parameter the pipeline produced is taken.
Returns¶
- DirectEntry
A DirectEntry that will fetch results on first
run().
- classmethod from_schema(schema)¶
Construct a
DirectEntryfrom a validated schema instance.Parameters¶
- schemaionworks.pipeline.direct_entries.DirectEntry
Validated schema instance describing parameter values, source, or a reference to a completed Ionworks Studio pipeline or a cell specification.
Returns¶
- DirectEntry
Equivalent pipeline
DirectEntry. Whenschema.pipeline_idorschema.cell_spec_idis set, the returned entry defers fetching of the parameter values untilrun()is called.
- run(parameter_values: ParameterValues) ParameterValues¶
Return the stored parameters. If this entry was created with a pipeline_id or a cell_spec_id, fetches them from Ionworks Studio on first run.
Parameters¶
- parameter_valuesiwp.ParameterValues
Input parameters (ignored by DirectEntry but required for interface consistency).
Returns¶
- iwp.ParameterValues
Copy of stored parameters.
Examples¶
>>> from ionworkspipeline.direct_entries import DirectEntry >>> params = iwp.ParameterValues({"Electrode height [m]": 0.1}) >>> entry = DirectEntry(params, source="Manual entry") >>> result = entry.run(iwp.ParameterValues({})) >>> "Electrode height [m]" in result True
A useful function for creating direct entries from values stored in JSON format is:
- ionworkspipeline.direct_entries.from_json(file_path)¶
Reads parameters from a JSON file and returns a DirectEntry object.
Parameters¶
- file_pathstr
The path to the JSON file.
Returns¶
- DirectEntry
The DirectEntry object with parameters read from the JSON file.
The following direct entries are available:
- Open-circuit potential functions
- Exchange-current density functions
- Particle Diffusivity Functions
- Thermal Direct Entries
- Electrolyte Direct Entries
- Piecewise Interpolation Direct Entries
- Miscellaneous Direct Entries
- Cell Specification Values