コード例 #1
0
 def test_correlations_axis(self, ones_zero):
     c = _correlation(ones_zero, axis=0, normalize=True)
     result = np.ones((10, 20))
     result[1::2, :] = -1
     np.testing.assert_array_equal(c, result)
     c = _correlation(ones_zero, axis=0, normalize=False)
     result = np.zeros((10, 20))
     result[0::2, :] = 5
     np.testing.assert_array_almost_equal(c, result)
コード例 #2
0
 def test_correlations_normalization(self, ones_hundred):
     c = _correlation(ones_hundred, axis=0, normalize=True)
     result = np.zeros((10, 20))
     result[1::2, :] = -0.96078816
     result[0::2, :] = 0.96078816
     np.testing.assert_array_almost_equal(c, result)
     c = _correlation(ones_hundred, axis=1, normalize=True)
     result = np.zeros((10, 20))
     np.testing.assert_array_almost_equal(c, result)
コード例 #3
0
 def test_correlations_mask(self, ones_hundred):
     m = np.zeros((10, 20))
     m[2:4, :] = 1
     c = _correlation(ones_hundred, axis=0, normalize=True, mask=m)
     print(c)
     result = np.zeros((10, 20))
     result[1::2, :] = -0.96078816
     result[0::2, :] = 0.96078816
     np.testing.assert_array_almost_equal(c, result)
コード例 #4
0
 def test_correlations_wrapping(
         self,
         ones_hundred):  # Need to do extra checks to assure this is correct
     m = np.zeros((10, 20))
     m[2:4, :] = 1
     c = _correlation(ones_hundred, axis=0, normalize=True, wrap=False)
     print(c)
     result = np.zeros((10, 20))
     result[0::2, :] = 2.26087665
     result[1::2, :] = -0.93478899
     np.testing.assert_array_almost_equal(c, result)
コード例 #5
0
 def test_correlation_ones(self, ones_array):
     c = _correlation(ones_array)
     np.testing.assert_array_equal(c, np.zeros((10, 20)))