예제 #1
0
 def test_where_5(self):
     a = np.random.randn(100)
     less_than = 0
     more_than = 1
     real = np.where(np.logical_and(a < less_than, a > more_than))[0]
     testing = np.nonzero(
         bm.where(a, less_than=less_than, more_than=more_than))[0]
     np.testing.assert_equal(real, testing)
예제 #2
0
 def test_where_2(self):
     a = np.random.randn(100)
     more_than = np.random.rand()
     real = np.where(a > more_than)[0]
     testing = np.nonzero(bm.where(a, more_than=more_than))[0]
     np.testing.assert_equal(real, testing)
예제 #3
0
 def test_where_7(self):
     a = np.arange(9, dtype=np.float).reshape(3, 3)
     threshold = 4
     real = a < threshold
     testing = bm.where(a, less_than=threshold)
     np.testing.assert_equal(real, testing)
예제 #4
0
 def test_where_1(self):
     a = np.random.randn(100)
     less_than = np.random.rand()
     real = np.where(a < less_than)[0]
     testing = np.nonzero(bm.where(a, less_than=less_than))[0]
     np.testing.assert_equal(real, testing)
예제 #5
0
 def test_where_6(self):
     a = np.arange(100).reshape(10, 10)
     testing = bm.where(a, less_than=0)
     np.testing.assert_equal(a.shape,
                             testing.shape,
                             err_msg='Shapes do not match.')