dataset#

Classes#

Dataset

Represents a collection of experimental observations.

PyprobeResult

Protocol defining required PyProBE Result interface.

Functions#

import_pybamm_solution(→ Dataset)

Import a pybamm.Solution into a pybop.Dataset.

import_pyprobe_result(→ Dataset)

Import a pyprobe.Result into a pybop.Dataset.

Module Contents#

class dataset.Dataset(data_dictionary: dict, domain: str | None = None, control_functions: list[str] | None = None)#

Represents a collection of experimental observations.

This class provides a structured way to store and work with experimental data, which may include applying operations such as interpolation.

Parameters:
  • data_dictionary (dict) – The experimental data to store within the dataset.

  • domain (str, optional) – The domain of the dataset. Defaults to “Time [s]”.

  • control_functions (list[str], optional) – A list of function names for the control variables. Defaults to [“Current function [A]”].

__getitem__(key)#

Return the data corresponding to a particular key.

__repr__()#

Return a string representation of the Dataset instance.

__setitem__(key, value)#

Set the data corresponding to a particular key.

_check_data_consistency(domain_data: numpy.ndarray, signals: list[str]) None#
static _check_frequency_constraints(freq_data: numpy.ndarray) None#
static _check_time_constraints(time_data: numpy.ndarray) None#
check(domain: str = None, signal: str | list[str] = None) bool#

Check the consistency of a PyBOP Dataset against the expected format.

Parameters:
  • domain (str, optional) – If not None, updates the domain of the dataset.

  • signal (str or List[str], optional) – The signal(s) to check. Defaults to [“Voltage [V]”].

Returns:

True if the dataset has the expected attributes.

Return type:

bool

Raises:

ValueError – If the time series and the data series are not consistent.

get_interpolant(control: str = 'Current [A]') pybamm.Interpolant#

Returns a linear interpolant for the control as a function of the domain.

get_subset(index: list | numpy.ndarray)#

Reduce the dataset to a subset defined by the list of indices.

control_functions = ['Current function [A]']#
data#
domain = 'Time [s]'#
class dataset.PyprobeResult#

Bases: Protocol

Protocol defining required PyProBE Result interface.

get(*column_names: str) numpy.typing.NDArray[numpy.float64] | tuple[numpy.typing.NDArray[numpy.float64], Ellipsis]#

Get result data as numpy ndarray

property columns: list[str]#

List of column data

dataset.import_pybamm_solution(solution: pybamm.Solution, variables: list[str] | None = None, t_interp: numpy.ndarray | None = None, domain: str | None = None, control_functions: list[str] | None = None) Dataset#

Import a pybamm.Solution into a pybop.Dataset.

Parameters:
  • solution (pybamm.Solution) – A pybamm.Solution object.

  • variables (list[str], optional) – A list of variables to include in the dataset.

  • t_interp (np.ndarray, optional) – Time points at which to interpolate the solution, only when the solver supports it.

  • domain (str, optional) – The domain of the dataset. Defaults to “Time [s]”.

  • control_functions (list[str], optional) – A list of function names for the control variables. Defaults to [“Current function [A]”].

dataset.import_pyprobe_result(result: PyprobeResult, variables: list[str] | None = None, column_names: list[str] | None = None, domain: str | None = None, control_functions: list[str] | None = None) Dataset#

Import a pyprobe.Result into a pybop.Dataset.

Parameters:
  • result (PyprobeResult | pyprobe.Result) – A pyprobe.Result-like object.

  • variables (list[str], optional) – A list of variables to include in the dataset.

  • column_names (list[str], optional) – A list of the column names in the Result corresponding to the variable names. If only one list of names is provided, they are assumed to be identical.

  • domain (str, optional) – The domain of the dataset. Defaults to “Time [s]”.

  • control_functions (list[str], optional) – A list of function names for the control variables. Defaults to [“Current function [A]”].