estim8.error_models#
This module defines the blueprint for modeling measurement noise.
- class estim8.error_models.BaseErrorModel(error_distribution: rv_continuous = <scipy.stats._continuous_distns.norm_gen object>, error_distribution_kwargs: dict = {})#
Bases:
ABCAbstract base class for error modeling.
Methods
generate_error_data(values)Abstract class method for calculating errors of experimental data given the datapoints.
get_sampling(values, errors, n_samples)Resamples values of data given the class instance error_distribution.
- abstractmethod generate_error_data(values: array) array#
Abstract class method for calculating errors of experimental data given the datapoints.
- Parameters:
- valuesnp.array
Values of the data on which to apply error model
- Returns:
- errorsnp.array
Error calculated according to specified model
- get_sampling(values: array, errors: array, n_samples: int) List[array]#
Resamples values of data given the class instance error_distribution.
- Parameters:
- valuesnp.array
The values to resample.
- n_samplesint
The number of samples to generate.
- Returns:
- resamplingList[np.array]
The generated Monte Carlo samples of values.
- class estim8.error_models.LinearErrorModel(slope: float = 0, offset: float = 0, error_distribution: rv_continuous = <scipy.stats._continuous_distns.norm_gen object>, error_distribution_kwargs: dict = {})#
Bases:
BaseErrorModelAn ErrorModel with linear relationship between measurement value and noise given by;
\[\sigma = slope \cdot y + offset\]- Attributes:
error_model_paramsError model parameters given by slope and offset.
Methods
generate_error_data(values)Generates error data based on the linear error model.
get_sampling(values, errors, n_samples)Resamples values of data given the class instance error_distribution.
- property error_model_params: dict#
Error model parameters given by slope and offset.
- generate_error_data(values: array) array#
Generates error data based on the linear error model.
- Parameters:
- valuesnp.array
Values of the data on which to apply error model.
- Returns:
- errorsnp.array
Error calculated according to the linear model.