Example #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")
Example #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")
Example #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")        
Example #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")
Example #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")
Example #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")
Example #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")
Example #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")
Example #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")
Example #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")
Example #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")        
Example #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")
Example #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")
Example #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")
Example #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")
Example #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")
Example #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")
Example #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")
Example #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")
Example #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")
Example #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")
Example #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")