variance_from_offsets

sofia_redux.toolkit.resampling.variance_from_offsets(offsets, covariance, sigma_inv=None)[source]

Determine the variance given offsets from the expected value.

The output variance is:

\[V = M^T \Sigma^{-1} M\]

where offsets (\(M\)) are the deviations \(X - E[X]\) and \(\Sigma\) is the covariance.

Parameters:
offsetsnumpy.ndarray (n_dimensions,)

The observational offsets from the expected value.

covariancenumpy.ndarray (n_dimensions, n_dimensions)

The covariance matrix of observations.

sigma_invnumpy.ndarray (n_dimensions, n_dimensions), optional

The matrix inverse of the covariance matrix, optionally passed in for speed.

Returns:
variancefloat

The variance as described above.