errorsyscalib

class pyvale.errorsyscalib.ErrSysCalibration(assumed_calib: Callable[[ndarray], ndarray], truth_calib: Callable[[ndarray], ndarray], cal_range: tuple[float, float], n_cal_divs: int = 10000, err_dep: EErrDep = EErrDep.INDEPENDENT)[source]

Bases: IErrCalculator

Systematic error calculator for calibration errors. The user specifies an assumed calibration and a ground truth calibration function. The ground truth calibration function is inverted and linearly interpolated numerically based on the number of divisions specified by the user.

Implements the IErrCalculator interface.

Parameters:
  • assumed_calib (Callable[[np.ndarray],np.ndarray]) -- Assumed calibration function taking the input unitless 'signal' and converting it to the same units as the physical field being sampled by the sensor array.

  • truth_calib (Callable[[np.ndarray],np.ndarray]) -- Assumed calibration function taking the input unitless 'signal' and converting it to the same units as the physical field being sampled by the sensor array.

  • cal_range (tuple[float,float]) -- Range over which the calibration functions are valid. This is normally based on a voltage range such as (0,10) volts.

  • n_cal_divs (int, optional) -- Number of divisions to discretise the the truth calibration function for numerical inversion, by default 10000.

  • err_dep (EErrDependence, optional) -- Error calculation dependence, by default EErrDependence.INDEPENDENT.

calc_errs(err_basis: ndarray, sens_data: SensorData) tuple[ndarray, SensorData][source]

Calculates the error array based on the size of the input.

Parameters:
  • err_basis (np.ndarray) -- Array of values with the same dimensions as the sensor measurement matrix.

  • sens_data (SensorData) -- The accumulated sensor state data for all errors prior to this one.

Returns:

tuple[np.ndarray, SensorData] -- Tuple containing the calculated error array and pass through of the sensor data object as it is not modified by this class. The returned error array has the same shape as the input error basis.

get_error_dep() EErrDep[source]

Gets the error dependence state for this error calculator. An independent error is calculated based on the input truth values as the error basis. A dependent error is calculated based on the accumulated sensor reading from all preceeding errors in the chain.

Returns:

EErrDependence -- Enumeration defining INDEPENDENT or DEPENDENT behaviour.

get_error_type() EErrType[source]

Gets the error type.

Returns:

EErrType -- Enumeration definining RANDOM or SYSTEMATIC error types.

set_error_dep(dependence: EErrDep) None[source]

Sets the error dependence state for this error calculator. An independent error is calculated based on the input truth values as the error basis. A dependent error is calculated based on the accumulated sensor reading from all preceeding errors in the chain.

Parameters:

dependence (EErrDependence) -- Enumeration defining INDEPENDENT or DEPENDENT behaviour.