punpy.lpu.lpu_propagation.LPUPropagation.propagate_random

punpy.lpu.lpu_propagation.LPUPropagation.propagate_random#

LPUPropagation.propagate_random(func, x, u_x, corr_x=None, param_fixed=None, corr_between=None, return_corr=False, return_Jacobian=False, repeat_dims=-99, corr_dims=-99, fixed_corr_var=False, output_vars=1, Jx=None, Jx_diag=None)[source]#

Propagate random uncertainties through measurement function with n input quantities. Input quantities can be floats, vectors (1d-array) or images (2d-array). Random uncertainties arise when there is no correlation between repeated measurements. It is possible (though rare) that there is a correlation in one of the dimensions that is not one of the repeat_dims.

Parameters:
  • func (function) – measurement function

  • x (list[array]) – list of input quantities (usually numpy arrays)

  • u_x (list[array]) – list of random uncertainties on input quantities (usually numpy arrays)

  • corr_x (list[array], optional) – list of correlation matrices (n,n) along non-repeating axis, defaults to None. Can optionally be set to “rand” (diagonal correlation matrix), “syst” (correlation matrix of ones) or a custom correlation matrix.

  • param_fixed (list of bools, optional) – when repeat_dims>=0, set to true or false to indicate for each input quantity whether it has repeated measurements that should be split (param_fixed=False) or whether the input is fixed (param fixed=True), defaults to None (no inputs fixed).

  • corr_between (array, optional) – correlation matrix (n,n) between input quantities, defaults to None

  • return_corr (bool, optional) – set to True to return correlation matrix of measurand, defaults to False

  • return_Jacobian (bool, optional) – set to True to return Jacobian matrix, defaults to False

  • repeat_dims (integer or list of 2 integers, optional) – set to positive integer(s) to select the axis which has repeated measurements. The calculations will be performed seperately for each of the repeated measurments and then combined, in order to save memory and speed up the process. Defaults to -99, for which there is no reduction in dimensionality..

  • corr_dims (integer, optional) – set to positive integer to select the axis used in the correlation matrix. The correlation matrix will then be averaged over other dimensions. Defaults to -99, for which the input array will be flattened and the full correlation matrix calculated.

  • fixed_corr_var (bool or integer, optional) – set to integer to copy the correlation matrix of the dimension the integer refers to. Set to True to automatically detect if only one uncertainty is present and the correlation matrix of that dimension should be copied. Defaults to False.

  • output_vars (integer, optional) – number of output parameters in the measurement function. Defaults to 1.

  • Jx – Jacobian matrix, evaluated at x. This allows to give a precomputed jacobian matrix, which could potentially be calculated using analytical prescription. Defaults to None, in which case Jx is calculated numerically as part of the propagation.

  • Jx_diag – Bool to indicate whether the Jacobian matrix can be described with semi-diagonal elements. With this we mean that the measurand has the same shape as each of the input quantities and the square jacobain between the measurand and each of the input quantities individually, only has diagonal elements. Defaults to None, in which case the object value is used.

Rtype Jx:

array, optional

Rtype Jx_diag:

bool, optional

Returns:

uncertainties on measurand

Return type:

array