punpy.lpu.lpu_propagation.LPUPropagation.propagate_flattened_cov

punpy.lpu.lpu_propagation.LPUPropagation.propagate_flattened_cov#

LPUPropagation.propagate_flattened_cov(func, x, flat_cov_x, return_corr=False, return_Jacobian=False, corr_dims=-99, output_vars=1, Jx=None, Jx_diag=None)[source]#

Propagate uncertainties with given covariance matrix through measurement function with n input quantities. Input quantities can be floats, vectors (1d-array) or images (2d-array). The covariance matrix can represent the full covariance matrix between all measurements in all dimensions. Alternatively if there are repeated measurements specified in repeat_dims, the covariance matrix is given for the covariance along the dimension that is not one of the repeat_dims.

Parameters:
  • func (function) – measurement function

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

  • flat_cov_x (list[array]) – flattened covariance matrix on flattened (concatenated) input quantities (usually numpy arrays). In case there is n input quantity arrays of shape (m,o), the covariance matrix needs to be given as an array of shape (n*m*o,n*m*o).

  • 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).

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

  • 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 False

Rtype Jx:

array, optional

Rtype Jx_diag:

bool, optional

Returns:

uncertainties on measurand

Return type:

array