errordriftcalc

class pyvale.errordriftcalc.DriftConstant(offset: float)[source]

Bases: IDriftCalculator

Class for applying a constant drift error over time.

Implements the IDriftCalculator interface.

Parameters:

offset (float) -- Constant drift offset.

calc_drift(drift_var: ndarray) ndarray[source]

Calculates the drift errors based on the input drift variable array.

Parameters:

drift_var (np.ndarray) -- Array of values (normally time steps) that are used to calculate the drift errors.

Returns:

np.ndarray -- Array of drift errors having the same shape as the input drift_var array.

class pyvale.errordriftcalc.DriftLinear(slope: float, offset: float = 0.0)[source]

Bases: IDriftCalculator

Class for applying a linear drift error over time.

Implements the IDriftCalculator interface.

Parameters:
  • slope (float) -- Slope of the drift error function.

  • offset (float, optional) -- Offset (intercept) of the drift error function, by default 0.0.

calc_drift(drift_var: ndarray) ndarray[source]

Calculates the drift errors based on the input drift variable array.

Parameters:

drift_var (np.ndarray) -- Array of values (normally time steps) that are used to calculate the drift errors.

Returns:

np.ndarray -- Array of drift errors having the same shape as the input drift_var array.

class pyvale.errordriftcalc.DriftPolynomial(coeffs: ndarray)[source]

Bases: IDriftCalculator

Class for applying a polynomial drift error over time. The coefficients of the polynomial are specified with a numpy array from constant term to highest power.

Implements the IDriftCalculator interface.

Parameters:

coeffs (np.ndarray) -- Array of polynomial coefficients from constant to highest power.

calc_drift(drift_var: ndarray) ndarray[source]

Calculates the drift errors based on the input drift variable array.

Parameters:

drift_var (np.ndarray) -- Array of values (normally time steps) that are used to calculate the drift errors.

Returns:

np.ndarray -- Array of drift errors having the same shape as the input drift_var array.

class pyvale.errordriftcalc.IDriftCalculator[source]

Bases: ABC

Interface (abstract base class) for applying a function to cause a sensor array measurement to drift (normally over time). The initialiser for the concrete implementation of this class specifies the function parameters and a unified method is provided to calculate the drift based on the input.

abstractmethod calc_drift(drift_var: ndarray) ndarray[source]

Abstract method. Used to calculate the drift function based on the input drift variable (useually the time steps).

Parameters:

drift_var (np.ndarray) -- Array of values (normally time steps) that are used to calculate the drift errors.

Returns:

np.ndarray -- Array of drift errors having the same shape as the input drift_var array.