errorrand¶
- class pyvale.errorrand.ErrRandGenPercent(generator: IGenRandom, err_dep: EErrDep = EErrDep.INDEPENDENT)[source]¶
Bases:
IErrCalculator
Random error calculator based on sampling a user specified random number generator implementing the IGeneratorRandom interface. This class assumes the random generator is for a percentage error based on the input error basis and therefore it supports error dependence.
The percentage error is calculated based on the ground truth if the error dependence is INDEPENDENT or based on the accumulated sensor measurement if the dependence is DEPENDENT.
Implements the IErrCalculator interface.
- Parameters:
generator (IGeneratorRandom) -- Interface for a user specified random number generator.
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.
- class pyvale.errorrand.ErrRandGenerator(generator: IGenRandom, err_dep: EErrDep = EErrDep.INDEPENDENT)[source]¶
Bases:
IErrCalculator
Sensor random error calculator based on sampling a user specified random number generator implementing the IGeneratorRandom interface.
Implements the IErrCalculator interface.
- Parameters:
generator (IGeneratorRandom) -- Interface for a user specified random number generator.
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.
For this class errors are calculated independently regardless.
- 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.
For this class errors are calculated independently regardless.
- Parameters:
dependence (EErrDependence) -- Enumeration defining INDEPENDENT or DEPENDENT behaviour.
- class pyvale.errorrand.ErrRandNorm(std: float, err_dep: EErrDep = EErrDep.INDEPENDENT, seed: int | None = None)[source]¶
Bases:
IErrCalculator
Random error calculator based on sampling of a normal (Gaussian) distribution specified using the standard deviation with an assumed zero mean. A non-zero mean is a systematic error and should be specified using ErrSysOffset.
Implements the IErrCalculator interface.
- Parameters:
std (float) -- Standard deviation of the normal distribution to sample from.
err_dep (EErrDependence, optional) -- Error calculation dependence, by default EErrDependence.INDEPENDENT.
seed (int | None, optional) -- Optional seed for the random generator to allow for replicable behaviour, by default None.
- 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.
- err_dep¶
- 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.
For this class errors are calculated independently regardless.
- 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.
- rng¶
- 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.
For this class errors are calculated independently regardless.
- Parameters:
dependence (EErrDependence) -- Enumeration defining INDEPENDENT or DEPENDENT behaviour.
- std¶
- class pyvale.errorrand.ErrRandNormPercent(std_percent: float, err_dep: EErrDep = EErrDep.INDEPENDENT, seed: int | None = None)[source]¶
Bases:
IErrCalculator
Sensor random error calculator based on sampling of a normal (Gaussian) distribution specified using the standard deviation with an assumed zero mean. This error is calculated as a percentage of the input error basis. Note that a non-zero mean is a systematic error and should be specified using ErrSysOffset.
The percentage error is calculated based on the ground truth if the error dependence is INDEPENDENT or based on the accumulated sensor measurement if the dependence is DEPENDENT.
Implements the IErrCalculator interface.
- Parameters:
std_percent (float) -- Standard deviation of the normal distribution to sample as a percentage.
err_dep (EErrDependence, optional) -- Error calculation dependence, by default EErrDependence.INDEPENDENT.
seed (int | None, optional) -- Optional seed for the random generator to allow for replicable behaviour, by default None.
- 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.
- class pyvale.errorrand.ErrRandUnif(low: float, high: float, err_dep: EErrDep = EErrDep.INDEPENDENT, seed: int | None = None)[source]¶
Bases:
IErrCalculator
Random error calculator based on uniform sampling of an interval specified by its upper and lower bound.
Implements the IErrCalculator interface.
- Parameters:
low (float) -- Lower bound of the uniform random generator.
high (float) -- Upper bound of the uniform random generator.
err_dep (EErrDependence, optional) -- Error calculation dependence, by default EErrDependence.INDEPENDENT.
seed (int | None, optional) -- Optional seed for the random generator to allow for replicable behaviour, by default None.
- Raises:
ValueError -- Raised if the user specified a lower bound that is higher than the upper bound.
- 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.
- err_dep¶
- 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.
For this class errors are calculated independently regardless.
- 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.
- high¶
- low¶
- rng¶
- 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.
For this class errors are calculated independently regardless.
- Parameters:
dependence (EErrDependence) -- Enumeration defining INDEPENDENT or DEPENDENT behaviour.
- class pyvale.errorrand.ErrRandUnifPercent(low_percent: float, high_percent: float, err_dep: EErrDep = EErrDep.INDEPENDENT, seed: int | None = None)[source]¶
Bases:
IErrCalculator
Random error calculator based on a percentage error based on sampling from a uniform probability distribution specified by its upper and lower bound (in percent).
The percentage error is calculated based on the ground truth if the error dependence is INDEPENDENT or based on the accumulated sensor measurement if the dependence is DEPENDENT.
Implements the IErrCalculator interface.
- Parameters:
low_percent (float) -- Lower percentage bound of the uniform random generator.
high_percent (float) -- Upper percentage bound of the uniform random generator.
err_dep (EErrDependence, optional) -- Error calculation dependence, by default EErrDependence.INDEPENDENT.
seed (int | None, optional) -- Optional seed for the random generator to allow for replicable behaviour, by default None.
- Raises:
ValueError -- Raised if the user specified a lower bound that is higher than the upper bound.
- 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.
- err_dep¶
- 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.
- high¶
- low¶
- rng¶
- 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.