multivariate_gaussian

sofia_redux.toolkit.resampling.multivariate_gaussian(covariance, coordinates, center=None, normalize=False)[source]

Return values of a multivariate Gaussian in K-dimensional coordinates.

The density of a multivariate Gaussian is given as:

\[f_{\mathbf X}(x_1, \ldots, x_k) = \frac {\exp\left(-\frac{1}{2} (x - \mu)^T \Sigma^{-1}(x - \mu) \right)} {\sqrt{(2 \pi)^K |\Sigma|}}\]

where the coordinates \(X\) are real \(K\) dimensional vectors, \(\Sigma\) is the covariance matrix with determinant \(|\Sigma|\), and the center of the distribution is given by \(\mu\).

Note that by default, the factor \({\sqrt{(2 \pi)^K |\Sigma|}}\) is not applied unless normalize is True.

Parameters:
covariancenumpy.ndarray (n_dimensions, n_dimensions)

The covariance matrix (\(\Sigma\)). Should be symmetric and positive definite.

coordinatesnumpy.ndarray (n_dimensions, n_coordinates)

The coordinates at which to evaluate the multivariate Gaussian.

centernumpy.ndarray (n_dimensions,), optional

The center of the distribution. If not supplied, the center is assumed to be zero in all dimensions.

normalizebool, optional

If True, normalize by dividing by \(\sqrt{(2 \pi)^k |\Sigma|}\).

Returns:
densitynumpy.ndarray (n_coordinates,)

The density evaluated at each coordinate.