Logo

A physics toolbox for laser spectroscopy.

Static Badge Static Badge Static Badge

Static Badge Static Badge

© 2025 Patrick Müller. All rights reserved.

qspec.propagate  (  f x x_d = None cov = None unc_places = None sample_size = 1000000 rtol = 0.001 atol = None force_sym = False full_output = False show = False  )[source]

Parameters:
fCallable

The function to compute. 'f' needs to be vectorized.

xarray_like

The input values. If 'x_d' is None, the sample data will be generated with the 'Observable.rvs' function which considers asymmetric uncertainties. If an element is not an 'Observable', its uncertainty is assumed to be 0.

x_darray_like

The uncertainties of the input values.

covndarray | Iterable

The covariance matrix of the x values. If not None, 'x' are assumed to be distributed according to a multivariate normal distribution with covariance 'cov'.

unc_placesint

The number of significant decimal places the result will be rounded to. If None, the result is not rounded.

sample_sizeint

The number of random variates used for the calculation. The default is 1,000,000.

rtolfloat

The relative tolerance, with respect to the median of the resulting sample, with which the left- and right-sided uncertainties can deviate before asymmetric uncertainties are used.

atolfloat

The absolute tolerance with which the left- and right-sided uncertainties can deviate, before asymmetric uncertainties are used. Overrides 'rtol'.

force_symbool

Whether to force symmetric uncertainties. If so, a normal distribution is assumed.

full_outputbool

Whether to return the randomly generated data samples.

showbool

Whether to show a histogram and estimated PDFs of the computed sample data.

Returns:
out(qspec.stats.Observable, list, ndarray)

An 'Observable' whose uncertainties result from the propagation of the uncertainties of the input values 'x' by function 'f'. If the uncertainties are asymmetric, the parameters of a skew normal distribution are estimated using least-square fitting and are stored to the observable. The value and the two uncertainties are the median and the left- (~0.1587) and right-sided (~0.8413) 1-sigma percentiles relative to the median, respectively. If the uncertainties are symmetric the observable is assumed to be normally distributed. The value and the single uncertainty is then calculated using the mean and the standard deviation of the sampled data. If 'full_output' is True, a list of the input samples as well as the output sample are returned along with the observable.

API navigation