code: def cov2corr(cov):
      """Calculate the correlation matrix based on a
          covariance matrix
  
      Parameters
      ----------
  
      cov: 2D array
  
      Returns
      -------
  
      corr: 2D array
          correlation converted from the covarince matrix
  
  
      """
      assert cov.ndim == 2, "covariance matrix should be 2D array"
      inv_sd = 1 / np.sqrt(np.diag(cov))
      corr = cov * inv_sd[None, :] * inv_sd[:, None]
      return corr
  
imports: import numpy
  import re
  import warnings
  import os.path
  import psutil
  from .fmrisim import generate_stimfunction, _double_gamma_hrf, convolve_hrf
  from scipy.fftpack import fft, ifft
  import logging
label_desc: Use image node_id 6 for calling a global function with example usage: cov2corr(cov) and returns: corr