コード例 #1
0
 def test_correlation_9(self):
     "farray.correlation_9"
     x = self.a1
     y = self.a2
     x2 = np.empty((2, x.shape[0], x.shape[1]))
     x2[0] = x
     x2[1] = x
     y2 = np.empty((2, y.shape[0], y.shape[1]))
     y2[0] = y
     y2[1] = y
     with np.errstate(invalid='ignore'):
         corr = correlation(x, y, axis=-1)
     desired = np.array([nan, 1, -1, -0.5])
     aae(corr, desired, err_msg="aggregate of 1d tests")
     x = self.b1
     y = self.b2
     x2 = np.empty((2, x.shape[0], x.shape[1]))
     x2[0] = x
     x2[1] = x
     y2 = np.empty((2, y.shape[0], y.shape[1]))
     y2[0] = y
     y2[1] = y
     with np.errstate(invalid='ignore'):
         corr = correlation(x, y, axis=-1)
     desired = np.array([nan, 1, -1, -0.5])
     aae(corr, desired, err_msg="aggregate of 1d tests")
コード例 #2
0
ファイル: farray_test.py プロジェクト: fhal/la
 def test_correlation_9(self):
     "farray.correlation_9"
     x = self.a1
     y = self.a2
     x2 = np.empty((2, x.shape[0], x.shape[1]))
     x2[0] = x
     x2[1] = x
     y2 = np.empty((2, y.shape[0], y.shape[1]))
     y2[0] = y
     y2[1] = y        
     with np.errstate(invalid='ignore'):
         corr = correlation(x, y, axis=-1)
     desired = np.array([nan, 1, -1, -0.5]) 
     aae(corr, desired, err_msg="aggregate of 1d tests")
     x = self.b1
     y = self.b2
     x2 = np.empty((2, x.shape[0], x.shape[1]))
     x2[0] = x
     x2[1] = x
     y2 = np.empty((2, y.shape[0], y.shape[1]))
     y2[0] = y
     y2[1] = y        
     with np.errstate(invalid='ignore'):
         corr = correlation(x, y, axis=-1)
     desired = np.array([nan, 1, -1, -0.5]) 
     aae(corr, desired, err_msg="aggregate of 1d tests")
コード例 #3
0
ファイル: farray_test.py プロジェクト: fhal/la
 def test_correlation_3(self):
     "farray.correlation_3"
     x = self.a1[0,:]
     y = self.a2[0,:]
     corr = correlation(x, y) 
     aae(corr, np.nan, err_msg="Correlation undefined")
     x = self.b1[0,:]
     y = self.b2[0,:]
     corr = correlation(x, y) 
     aae(corr, np.nan, err_msg="Correlation undefined")        
コード例 #4
0
ファイル: farray_test.py プロジェクト: fhal/la
 def test_correlation_4(self):
     "farray.correlation_4"
     x = self.a1[1,:]
     y = self.a2[1,:]
     corr = correlation(x, y) 
     aae(corr, 1, err_msg="Perfect +1 correation")
     x = self.b1[1,:]
     y = self.b2[1,:]
     corr = correlation(x, y) 
     aae(corr, 1, err_msg="Perfect +1 correation")
コード例 #5
0
ファイル: farray_test.py プロジェクト: fhal/la
 def test_correlation_5(self):
     "farray.correlation_5"
     x = self.a1[2,:]
     y = self.a2[2,:]
     corr = correlation(x, y) 
     aae(corr, -1, err_msg="Perfect -1 correation")
     x = self.b1[2,:]
     y = self.b2[2,:]
     corr = correlation(x, y) 
     aae(corr, -1, err_msg="Perfect -1 correation")
コード例 #6
0
ファイル: farray_test.py プロジェクト: fhal/la
 def test_correlation_6(self):
     "farray.correlation_6"
     x = self.a1[3,:]
     y = self.a2[3,:]
     corr = correlation(x, y) 
     aae(corr, -0.5, err_msg="-0.5 correation")
     x = self.b1[3,:]
     y = self.b2[3,:]
     corr = correlation(x, y) 
     aae(corr, -0.5, err_msg="-0.5 correation")
コード例 #7
0
 def test_correlation_5(self):
     "farray.correlation_5"
     x = self.a1[2, :]
     y = self.a2[2, :]
     with np.errstate(invalid='ignore'):
         corr = correlation(x, y)
     aae(corr, -1, err_msg="Perfect -1 correation")
     x = self.b1[2, :]
     y = self.b2[2, :]
     with np.errstate(invalid='ignore'):
         corr = correlation(x, y)
     aae(corr, -1, err_msg="Perfect -1 correation")
コード例 #8
0
 def test_correlation_3(self):
     "farray.correlation_3"
     x = self.a1[0, :]
     y = self.a2[0, :]
     with np.errstate(invalid='ignore'):
         corr = correlation(x, y)
     aae(corr, np.nan, err_msg="Correlation undefined")
     x = self.b1[0, :]
     y = self.b2[0, :]
     with np.errstate(invalid='ignore'):
         corr = correlation(x, y)
     aae(corr, np.nan, err_msg="Correlation undefined")
コード例 #9
0
ファイル: farray_test.py プロジェクト: kwgoodman/la
 def test_correlation_6(self):
     "farray.correlation_6"
     x = self.a1[3,:]
     y = self.a2[3,:]
     with np.errstate(invalid='ignore'):
         corr = correlation(x, y) 
     aae(corr, -0.5, err_msg="-0.5 correation")
     x = self.b1[3,:]
     y = self.b2[3,:]
     with np.errstate(invalid='ignore'):
         corr = correlation(x, y) 
     aae(corr, -0.5, err_msg="-0.5 correation")
コード例 #10
0
ファイル: farray_test.py プロジェクト: kwgoodman/la
 def test_correlation_5(self):
     "farray.correlation_5"
     x = self.a1[2,:]
     y = self.a2[2,:]
     with np.errstate(invalid='ignore'):
         corr = correlation(x, y) 
     aae(corr, -1, err_msg="Perfect -1 correation")
     x = self.b1[2,:]
     y = self.b2[2,:]
     with np.errstate(invalid='ignore'):
         corr = correlation(x, y) 
     aae(corr, -1, err_msg="Perfect -1 correation")
コード例 #11
0
ファイル: farray_test.py プロジェクト: kwgoodman/la
 def test_correlation_3(self):
     "farray.correlation_3"
     x = self.a1[0,:]
     y = self.a2[0,:]
     with np.errstate(invalid='ignore'):
         corr = correlation(x, y) 
     aae(corr, np.nan, err_msg="Correlation undefined")
     x = self.b1[0,:]
     y = self.b2[0,:]
     with np.errstate(invalid='ignore'):
         corr = correlation(x, y) 
     aae(corr, np.nan, err_msg="Correlation undefined")        
コード例 #12
0
 def test_correlation_6(self):
     "farray.correlation_6"
     x = self.a1[3, :]
     y = self.a2[3, :]
     with np.errstate(invalid='ignore'):
         corr = correlation(x, y)
     aae(corr, -0.5, err_msg="-0.5 correation")
     x = self.b1[3, :]
     y = self.b2[3, :]
     with np.errstate(invalid='ignore'):
         corr = correlation(x, y)
     aae(corr, -0.5, err_msg="-0.5 correation")
コード例 #13
0
 def test_correlation_8(self):
     "farray.correlation_8"
     x = self.a1.T
     y = self.a2.T
     with np.errstate(invalid='ignore'):
         corr = correlation(x, y, axis=0)
     desired = np.array([nan, 1, -1, -0.5])
     aae(corr, desired, err_msg="aggregate of 1d tests")
     x = self.b1.T
     y = self.b2.T
     with np.errstate(invalid='ignore'):
         corr = correlation(x, y, axis=0)
     desired = np.array([nan, 1, -1, -0.5])
     aae(corr, desired, err_msg="aggregate of 1d tests")
コード例 #14
0
ファイル: farray_test.py プロジェクト: fhal/la
 def test_correlation_8(self):
     "farray.correlation_8"
     x = self.a1.T
     y = self.a2.T
     with np.errstate(invalid='ignore'):
         corr = correlation(x, y, axis=0)
     desired = np.array([nan, 1, -1, -0.5]) 
     aae(corr, desired, err_msg="aggregate of 1d tests")
     x = self.b1.T
     y = self.b2.T
     with np.errstate(invalid='ignore'):
         corr = correlation(x, y, axis=0)
     desired = np.array([nan, 1, -1, -0.5]) 
     aae(corr, desired, err_msg="aggregate of 1d tests")
コード例 #15
0
ファイル: farray_test.py プロジェクト: alpmdog/la
 def test_correlation_1(self):
     "farray.correlation_1"
     x = np.array([])
     y = np.array([])
     with np.errstate(invalid='ignore'):
         corr = correlation(x, y) 
     aae(corr, np.nan, err_msg="Empty correlation should be NaN")
コード例 #16
0
 def test_correlation_1(self):
     "farray.correlation_1"
     x = np.array([])
     y = np.array([])
     warnings.simplefilter("ignore")
     corr = correlation(x, y)
     aae(corr, np.nan, err_msg="Empty correlation should be NaN")
コード例 #17
0
 def test_correlation_2(self):
     "farray.correlation_2"        
     x = np.array([nan, nan])
     y = np.array([nan, nan])
     warnings.simplefilter("ignore")
     corr = correlation(x, y)
     aae(corr, np.nan, err_msg="All NaN correlation should be NaN")
コード例 #18
0
 def test_correlation_1(self):
     "farray.correlation_1"
     x = np.array([])
     y = np.array([])
     with np.errstate(invalid='ignore'):
         corr = correlation(x, y)
     aae(corr, np.nan, err_msg="Empty correlation should be NaN")
コード例 #19
0
 def test_correlation_2(self):
     "farray.correlation_2"
     x = np.array([nan, nan])
     y = np.array([nan, nan])
     with np.errstate(invalid='ignore'):
         corr = correlation(x, y)
     aae(corr, np.nan, err_msg="All NaN correlation should be NaN")
コード例 #20
0
ファイル: farray_test.py プロジェクト: alpmdog/la
 def test_correlation_2(self):
     "farray.correlation_2"        
     x = np.array([nan, nan])
     y = np.array([nan, nan])
     with np.errstate(invalid='ignore'):
         corr = correlation(x, y) 
     aae(corr, np.nan, err_msg="All NaN correlation should be NaN")
コード例 #21
0
ファイル: farray_test.py プロジェクト: fhal/la
 def test_correlation_2(self):
     "farray.correlation_2"        
     x = np.array([nan, nan])
     y = np.array([nan, nan])
     corr = correlation(x, y) 
     aae(corr, np.nan, err_msg="All NaN correlation should be NaN")
コード例 #22
0
ファイル: farray_test.py プロジェクト: fhal/la
 def test_correlation_1(self):
     "farray.correlation_1"
     x = np.array([])
     y = np.array([])
     corr = correlation(x, y) 
     aae(corr, np.nan, err_msg="Empty correlation should be NaN")