cov_to_corr

gammapy.stats.cov_to_corr(covariance)[source]

Compute correlation matrix from covariance matrix.

The correlation matrix \(c\) is related to the covariance matrix \(\sigma\) by:

\[c_{ij} = \frac{\sigma_{ij}}{\sqrt{\sigma_{ii} \sigma_{jj}}}\]
Parameters:

covariance : numpy.array

Covariance matrix.

Returns:

correlation : numpy.array

Correlation matrix.