Exemplo n.º 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")
Exemplo n.º 2
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")
Exemplo n.º 3
0
 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")        
Exemplo n.º 4
0
 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")
Exemplo n.º 5
0
 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")
Exemplo n.º 6
0
 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")
Exemplo n.º 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")
Exemplo n.º 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")
Exemplo n.º 9
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")
Exemplo n.º 10
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")
Exemplo n.º 11
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")        
Exemplo n.º 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")
Exemplo n.º 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")
Exemplo n.º 14
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")
Exemplo n.º 15
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")
Exemplo n.º 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")
Exemplo n.º 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")
Exemplo n.º 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")
Exemplo n.º 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")
Exemplo n.º 20
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")
Exemplo n.º 21
0
 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")
Exemplo n.º 22
0
 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")