yaw.core.SampledValue#

class yaw.core.SampledValue(value: _Tscalar, samples: NDArray[_Tscalar], method: str)[source]#

Bases: Generic[_Tscalar]

Container to hold a scalar value with an empirically estimated uncertainty from resampling.

Supports comparison of the values and samples with == and !=.

Examples

Create a value container with 100 assumed jackknife samples that scatter around zero with a standard deviation of 0.1:

>>> from numpy.random import normal
>>> samples = normal(loc=0.0, scale=0.01, size=101)
>>> value = yaw.core.SampledValue(0.0, samples, method="jackknife")
>>> value
SampledValue(value=0, error=0.963, n_samples=100, method='jackknife')
Parameters:
  • value – Numerical, scalar value.

  • samples (NDArray) – Samples of value obtained from resampling methods.

  • method (str) – Resampling method used to obtain the data samples, see ResamplingConfig for available options.

Methods

__init__(value, samples, method)

Attributes

n_samples

Number of samples used for error estimate.

value

Numerical, scalar value.

samples

Samples of value obtained from resampling methods.

method

Resampling method used to obtain the data samples, see ResamplingConfig for available options.

error

The uncertainty (standard error) of the value.

error: _Tscalar#

The uncertainty (standard error) of the value.

method: str#

Resampling method used to obtain the data samples, see ResamplingConfig for available options.

property n_samples: int#

Number of samples used for error estimate.

samples: NDArray[_Tscalar]#

Samples of value obtained from resampling methods.

value: _Tscalar#

Numerical, scalar value.