def cov2corr(cov, return_std=False):
 cov = np.asanyarray(cov)
 std_ = np.sqrt(np.diag(cov))
 corr = (cov / np.outer(std_, std_))
 if return_std:
  return (corr, std_)
 else:
  return corr

def cov2corr ( cov , return_std = False ) : cov = np . asanyarray ( cov ) std_ = np . sqrt ( np . diag ( cov ) ) corr = ( cov / np . outer ( std_ , std_ ) ) if return_std : return ( corr , std_ ) else : return corr
convert covariance matrix to correlation matrix parameters cov : array_like .