Note

This page is a reference documentation. It only explains the function signature, and not how to use it. Please refer to the user guide for the big picture.

nilearn.connectome.cov_to_corr

nilearn.connectome.cov_to_corr(covariance)[source]

Return correlation matrix for a given covariance matrix.

Parameters:
covariance2D numpy.ndarray

The input covariance matrix.

Returns:
correlation2D numpy.ndarray

The output correlation matrix.

Examples

>>> import numpy as np
>>> from nilearn.connectome import cov_to_corr
>>> cov = np.array([[4.0, 2.0], [2.0, 9.0]])
>>> cov_to_corr(cov)
array([[1.        , 0.33333333],
       [0.33333333, 1.        ]])