pybop.models.lithium_ion.utils#

Classes#

Interpolant

A class that returns a pybamm.Interpolant to pybamm models and otherwise

InverseOCV

A class to find the stoichiometry corresponding to a given open-circuit

Module Contents#

class pybop.models.lithium_ion.utils.Interpolant(x: numpy.ndarray, y: numpy.ndarray, name: str | None = None, bounds_error: bool = False, fill_value: str | float = 'extrapolate', axis: int = 0)[source]#

A class that returns a pybamm.Interpolant to pybamm models and otherwise a numeric interpolant.

Parameters:
  • x (array_like) – Input coordinates.

  • y (array_like) – Output values corresponding to x.

  • name (str, optional) – Name for the interpolant when used in PyBaMM.

  • bounds_error (bool, optional) – If True, raise error when interpolating outside bounds.

  • fill_value (str or float, optional) – Value to use for out-of-bounds interpolation.

  • axis (int, optional) – Axis along which to interpolate.

__call__(x: float | numpy.ndarray)[source]#

Evaluate the interpolant at given points.

Parameters:

x (float or array_like) – Points at which to evaluate the interpolant.

Returns:

Interpolated values or PyBaMM interpolant object.

Return type:

float, array_like, or pybamm.Interpolant

_create_interpolant(bounds_error: bool, fill_value: str | float, axis: int)[source]#

Create the scipy interpolation function.

_interp_func#
name = None#
x#
y#
class pybop.models.lithium_ion.utils.InverseOCV(ocv_function: collections.abc.Callable, optimiser: BaseOptimiser | None = None, optimiser_options: OptimiserOptions | None = None)[source]#

A class to find the stoichiometry corresponding to a given open-circuit voltage.

Parameters:
  • ocv_function (Callable) – The open-circuit voltage as a function of stoichiometry.

  • optimiser (pybop.BaseOptimiser, optional) – The optimisation algorithm to use (default: pybop.SciPyMinimize).

  • optimiser_options (pybop.OptimiserOptions, optional) – Options for the optimiser.

__call__(ocv_value: float) float[source]#

Estimate and return the stoichiometry.

Parameters:

ocv_value (float) – The open-circuit voltage value [V] for which to estimate the stoichiometry.

Returns:

The stoichiometry corresponding to the open-circuit voltage value.

Return type:

float

cost#
ocv_root#
optimiser#
optimiser_options#