Logo

A physics toolbox for laser spectroscopy.

Static Badge Static Badge Static Badge

Static Badge Static Badge

© 2026 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.

xIterable[scalar]

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 | None

The uncertainties of the input values.

covscalar_nd | None

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_like | None

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

sample_sizeint_like

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 | None

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:
outqspec.stats.Observable | tuple[qspec.stats.Observable, ndarray, 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