Пример #1
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)         
Пример #2
0
 def test_geometric_mean_6(self):
     "farray.geometric_mean #6"
     desired = np.array([ 1.4142135623730951, 4.0, 6.9282032302755088, 2.0,
                                                      2.8284271247461903])
     with np.errstate(invalid='ignore'):
         actual = geometric_mean(self.x, 0)
     assert_almost_equal(actual, desired)
Пример #3
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)
Пример #4
0
 def test_geometric_mean_5(self):
     "farray.geometric_mean #5"
     desired = np.array([ 3.1301691601465746, 2.6390158215457888])
     actual = geometric_mean(self.x, 1)
     assert_almost_equal(actual, desired)
Пример #5
0
 def test_geometric_mean_4(self):
     "farray.geometric_mean #4"
     desired = np.array([nan, nan])
     with np.errstate(invalid='ignore', divide='ignore'):
         actual = geometric_mean(self.xnan)
     assert_almost_equal(actual, desired)
Пример #6
0
 def test_geometric_mean_3(self):
     "farray.geometric_mean #3"
     desired = np.array([ 1.81712059, 1.81712059])
     actual = geometric_mean(self.x2, 0)
     assert_almost_equal(actual, desired) 
Пример #7
0
 def test_geometric_mean_2(self):
     "farray.geometric_mean #2"
     desired = np.array([ 2.0, 1.73205081, 1.73205081])
     actual = geometric_mean(self.x2)
     assert_almost_equal(actual, desired)   
Пример #8
0
 def test_geometric_mean_5(self):
     "farray.geometric_mean #5"
     desired = np.array([3.1301691601465746, 2.6390158215457888])
     actual = geometric_mean(self.x, 1)
     assert_almost_equal(actual, desired)
Пример #9
0
 def test_geometric_mean_4(self):
     "farray.geometric_mean #4"
     desired = np.array([nan, nan])
     with np.errstate(invalid='ignore', divide='ignore'):
         actual = geometric_mean(self.xnan)
     assert_almost_equal(actual, desired)
Пример #10
0
 def test_geometric_mean_3(self):
     "farray.geometric_mean #3"
     desired = np.array([1.81712059, 1.81712059])
     actual = geometric_mean(self.x2, 0)
     assert_almost_equal(actual, desired)
Пример #11
0
 def test_geometric_mean_2(self):
     "farray.geometric_mean #2"
     desired = np.array([2.0, 1.73205081, 1.73205081])
     actual = geometric_mean(self.x2)
     assert_almost_equal(actual, desired)
Пример #12
0
 def test_geometric_mean_5(self):
     "farray.geometric_mean #5"
     desired = np.array([ 3.1301691601465746, 2.6390158215457888])
     with np.errstate(invalid='ignore'):
         actual = geometric_mean(self.x, 1)
     assert_almost_equal(actual, desired)