Piecewise Linear Timeseries

class ionworks.data.piecewise_linear_timeseries.PiecewiseLinearTimeseries(t_data: ndarray, y_data: ndarray, name: str | None = None, options: dict[str, Any] | None = None)[source]

Bases: object

A class to preprocess and linearize time series data using piecewise linear approximation.

Attributes:

t_dataarray-like

The time data points.

y_dataarray-like

The corresponding data points.

atolfloat, optional

Absolute tolerance for the solver. If None, uses the default solver atol of 1e-6.

rtolfloat, optional

Relative tolerance for the solver. If None, uses the default solver rtol of 1e-4.

namestr, optional

The name of the timeseries. Default is “Piecewise linear timeseries”.

optionsdict, optional

Additional options for preprocessing. If None, default options are used.

losslessbool

Selects the variant built by piecewise_linear_timeseries: True for the lossless (view) variant, False (default) for the compressed one.

interactive_preprocessingbool

Whether to use interactive preprocessing to select atol and rtol. Default is False.

window_maxint

Maximum window size for removing neighboring points. Default is 10.

property options: dict[str, Any]
interpolant(interpolator: str = 'linear', name: str | None = None, **kwargs) → pybamm.Interpolant[source]

Generate an interpolant for the given sparse time series data.

Parameters:
  • interpolator (str, optional) – The type of interpolation to use. Default is “linear”.

  • name (str, optional) – The name of the interpolant. Default is the name of the timeseries.

  • **kwargs – Additional keyword arguments to pass to pybamm.Interpolant.

Returns:

An interpolant object for the sparse time series data.

Return type:

pybamm.Interpolant