Download this file
1 2 3 4 5 6 7 8 9 10 11 12 13
import unittest import numpy as np from inmoose.utils import cov2cor class Test(unittest.TestCase): def test_cov2cor(self): M = np.arange(25).reshape((5, 5)) cov = np.cov(M) cor = np.corrcoef(M) self.assertTrue(np.allclose(cov2cor(cov), cor))