pybop.pybamm.synthetic_utils#

Utilities for synthetic data generation.

Attributes#

Functions#

_build_eis_sweep_dataframe(→ polars.LazyFrame)

Create a PyProBE-compatible dataframe for one EIS sweep.

_build_frequency_grid(→ numpy.ndarray)

Build the frequency grid for an EIS experiment.

_canonical_cell_format(→ str)

Normalize cell type string to archive format.

_flatten_sequence(→ list[str])

Flatten a list of experiment tuples into a list of per-event descriptions.

_get_experiment_sequences(→ tuple[list[tuple[int, ...)

Expand a spec experiment into PyBaMM experiment step tuples.

_get_experiment_type(→ str)

Return the synthetic experiment type.

_load_spec(→ dict[str, Any])

Load a JSON spec file.

_remap_cycle_info(→ polars.LazyFrame)

Map PyBaMM step and cycle numbers back to match the cycle information.

_safe_name(→ str)

Create a safe filename from a string.

_solution_to_dataframe(→ polars.LazyFrame)

Convert a PyBaMM solution into the PyProBE-required dataframe layout.

_solve_eis_experiment(→ tuple[polars.LazyFrame, ...)

Solve an EIS experiment and return a PyProBE-compatible dataframe.

_solve_time_domain_experiment(→ pybamm.Solution)

Solve a standard time-domain experiment.

_validate_experiment(→ None)

_validate_frequency_spec(→ None)

_validate_spec(→ tuple[dict[str, Any], dict[str, Any]])

_validate_steps(→ None)

archive_data(cell, archive_root)

Archive the data fron the cell object.

convert_to_half_cell_parameters(→ pybamm.ParameterValues)

Function to adapt a full cell parameter set to a half cell.

simulate_procedure(→ None)

Module Contents#

pybop.pybamm.synthetic_utils._build_eis_sweep_dataframe(step_number: int, event_number: int, frequencies: numpy.ndarray, impedance: numpy.ndarray, initial_voltage: float | None) polars.LazyFrame[source]#

Create a PyProBE-compatible dataframe for one EIS sweep.

pybop.pybamm.synthetic_utils._build_frequency_grid(frequency_spec: list[float] | dict[str, Any]) numpy.ndarray[source]#

Build the frequency grid for an EIS experiment.

pybop.pybamm.synthetic_utils._canonical_cell_format(cell_type: str) str[source]#

Normalize cell type string to archive format.

pybop.pybamm.synthetic_utils._flatten_sequence(sequences: list[tuple[str, Ellipsis]]) list[str][source]#

Flatten a list of experiment tuples into a list of per-event descriptions.

pybop.pybamm.synthetic_utils._get_experiment_sequences(experiment_info: dict[str, Any]) tuple[list[tuple[int, Ellipsis]], list[tuple[str, Ellipsis]]][source]#

Expand a spec experiment into PyBaMM experiment step tuples.

pybop.pybamm.synthetic_utils._get_experiment_type(experiment_info: dict[str, Any]) str[source]#

Return the synthetic experiment type.

pybop.pybamm.synthetic_utils._load_spec(path: pathlib.Path) dict[str, Any][source]#

Load a JSON spec file.

pybop.pybamm.synthetic_utils._remap_cycle_info(dataframe: polars.LazyFrame, step_sequence: list[tuple[int, Ellipsis]], event_offset: int) polars.LazyFrame[source]#

Map PyBaMM step and cycle numbers back to match the cycle information.

pybop.pybamm.synthetic_utils._safe_name(value: str) str[source]#

Create a safe filename from a string.

pybop.pybamm.synthetic_utils._solution_to_dataframe(solution: pybamm.Solution, step_sequence: list[tuple[int, Ellipsis]], start_time: float, event_offset: int) polars.LazyFrame[source]#

Convert a PyBaMM solution into the PyProBE-required dataframe layout.

pybop.pybamm.synthetic_utils._solve_eis_experiment(experiment_info: dict[str, Any], model: pybamm.BaseModel, parameter_values: pybamm.ParameterValues, previous_solution: pybamm.Solution | None, step_offset: int, solve_kwargs: dict[str, float] | None) tuple[polars.LazyFrame, dict[str, Any], pybamm.Solution | None, int, int][source]#

Solve an EIS experiment and return a PyProBE-compatible dataframe.

pybop.pybamm.synthetic_utils._solve_time_domain_experiment(experiment: pybamm.Experiment, model: pybamm.BaseModel, parameter_values: pybamm.ParameterValues, previous_solution: pybamm.Solution | None, solve_kwargs: dict[str, float] | None) pybamm.Solution[source]#

Solve a standard time-domain experiment.

pybop.pybamm.synthetic_utils._validate_experiment(experiment_name: str, experiment_info: Any) None[source]#
pybop.pybamm.synthetic_utils._validate_frequency_spec(experiment_name: str, frequency_spec: Any) None[source]#
pybop.pybamm.synthetic_utils._validate_spec(spec_path: pathlib.Path) tuple[dict[str, Any], dict[str, Any]][source]#
pybop.pybamm.synthetic_utils._validate_steps(experiment_name: str, experiment_info: dict[str, Any]) None[source]#
pybop.pybamm.synthetic_utils.archive_data(cell, archive_root: pathlib.Path)[source]#

Archive the data fron the cell object.

pybop.pybamm.synthetic_utils.convert_to_half_cell_parameters(parameter_values: pybamm.ParameterValues, electrode_type: str) pybamm.ParameterValues[source]#

Function to adapt a full cell parameter set to a half cell.

Positive electrode parameters are set from the working electrode, negative electrode parameters are set for a lithium counter, from Xu2019.

pybop.pybamm.synthetic_utils.simulate_procedure(info: dict, model: pybamm.BaseModel, parameter_values: pybamm.ParameterValues, spec_path: pathlib.Path, solve_kwargs: dict[str, float] | None = None) None[source]#
pybop.pybamm.synthetic_utils.DEFAULT_COLUMN_DEFINITIONS: dict[str, str]#
pybop.pybamm.synthetic_utils.EIS_COLUMN_DEFINITIONS: dict[str, str]#
pybop.pybamm.synthetic_utils.PARAMETERS_TO_SWAP: list[str] = ['Positive electrode conductivity [S.m-1]', 'Maximum concentration in positive electrode...#