Esempio n. 1
0
def assert_larry(opname, la, t, lab, msgstr):
    msg = printfail(la.label, lab, 'label'+msgstr)  
    assert_(la.label == lab, msg)        
    msg = printfail(t, la.x, 'x'+msgstr)
    t[np.isnan(t)] = nancode
    la.x[np.isnan(la.x)] = nancode        
    assert_((abs(t - la.x) < tol).all(), msg) 
Esempio n. 2
0
 def test_demedian_3(self):
     "larry.demedian_2"
     t = self.tmedian
     label = self.label3
     p = self.lar3.demedian(2)
     msg = printfail(t, p.x, 'x') 
     t[np.isnan(t)] = self.nancode
     p[p.isnan()] = self.nancode             
     self.assert_((abs(t - p.x) < self.tol).all(), msg)
     self.assert_(label == p.label, printfail(label, p.label, 'label'))
     self.assert_(noreference(p, self.lar3), 'Reference found')
Esempio n. 3
0
 def est_mov_sum_6_3(self):
     "larry.mov_sum_6"
     t = self.tmov_sum
     label = self.label3
     p = self.lar3.mov_sum(2, norm=True)
     msg = printfail(t, p.x, 'x')  
     t[np.isnan(t)] = self.nancode
     p[p.isnan()] = self.nancode             
     self.assert_((abs(t - p.x) < self.tol).all(), msg)
     self.assert_(label == p.label, printfail(label, p.label, 'label'))
     self.assert_(noreference(p, self.lar3), 'Reference found')  
Esempio n. 4
0
 def check_function(self, t, label, p, orig, view=False):
     "check a method of larry - comparison helper function"
     msg = printfail(t, p.x, 'x')  
     t[np.isnan(t)] = self.nancode
     p[p.isnan()] = self.nancode             
     self.assert_((abs(t - p.x) < self.tol).all(), msg)
     self.assert_(label == p.label, printfail(label, p.label, 'label'))
     if not view:
         self.assert_(noreference(p, orig), 'Reference found')   
     elif view == 'nocopy' :
         self.assert_(nocopy(p, orig), 'copy instead of reference found') 
     else:   #FIXME check view for different dimensional larries
         pass  
Esempio n. 5
0
 def test_geometric_mean_7(self):
     "farray.geometric_mean #7"
     x = np.array([[1e200, 1e200]])
     desired = 1e200
     actual = geometric_mean(x)
     msg = printfail(desired, actual)
     self.assert_((abs(desired - actual) < 1e187).all(), msg)         
Esempio n. 6
0
 def test_sector_unique_1(self):
     "farray.unique_group #1"
     sectors = ['a', 'b', 'a', 'b', 'a', 'c']
     desired = ['a', 'b', 'c']
     actual = unique_group(sectors)
     msg = printfail(desired, actual)   
     self.assert_(desired == actual, msg)      
Esempio n. 7
0
 def test_geometric_mean_7(self):
     "farray.geometric_mean #7"
     x = np.array([[1e200, 1e200]])
     desired = 1e200
     actual = geometric_mean(x)
     msg = printfail(desired, actual)
     self.assertTrue((abs(desired - actual) < 1e187).all(), msg)
Esempio n. 8
0
 def test_sector_unique_1(self):
     "farray.unique_group #1"
     sectors = ['a', 'b', 'a', 'b', 'a', 'c']
     desired = ['a', 'b', 'c']
     actual = unique_group(sectors)
     msg = printfail(desired, actual)
     self.assertTrue(desired == actual, msg)