Ejemplo n.º 1
0
 def where_indices_condition(self):
     a = np.eye(3)
     a[1, 2] = -2.0
     a[2, 1] = 2.0
     cube = cb.where_indices(a, np.abs(a) > 1.0)
     self.assertEqual(cube.shape, (2, 3))
     self.assertCubesAreEqual(cube[0], np.array([1.0, 2.0, -2.0]))
     self.assertCubesAreEqual(cube[1], np.array([2.0, 1.0, 2.0]))
Ejemplo n.º 2
0
 def where_indices_condition(self):
     a = np.eye(3)
     a[1, 2] = -2.0
     a[2, 1] = 2.0
     cube = cb.where_indices(a, np.abs(a) > 1.0)
     self.assertEqual(cube.shape, (2, 3))
     self.assertCubesAreEqual(cube[0], np.array([1.0, 2.0, -2.0]))
     self.assertCubesAreEqual(cube[1], np.array([2.0, 1.0, 2.0]))
Ejemplo n.º 3
0
 def where_indices(self):
     a = np.eye(3)
     a[1, 2] = -2.0
     a[2, 1] = 2.0
     cube = cb.where_indices(a)
     self.assertEqual(cube.shape, (5, 3))
     self.assertCubesAreEqual(cube[0], np.array([0.0, 0.0, 1.0]))
     self.assertCubesAreEqual(cube[1], np.array([1.0, 1.0, 1.0]))
     self.assertCubesAreEqual(cube[2], np.array([1.0, 2.0, -2.0]))
     self.assertCubesAreEqual(cube[3], np.array([2.0, 1.0, 2.0]))
     self.assertCubesAreEqual(cube[4], np.array([2.0, 2.0, 1.0]))
Ejemplo n.º 4
0
 def where_indices(self):
     a = np.eye(3)
     a[1, 2] = -2.0
     a[2, 1] = 2.0
     cube = cb.where_indices(a)
     self.assertEqual(cube.shape, (5, 3))
     self.assertCubesAreEqual(cube[0], np.array([0.0, 0.0, 1.0]))
     self.assertCubesAreEqual(cube[1], np.array([1.0, 1.0, 1.0]))
     self.assertCubesAreEqual(cube[2], np.array([1.0, 2.0, -2.0]))
     self.assertCubesAreEqual(cube[3], np.array([2.0, 1.0, 2.0]))
     self.assertCubesAreEqual(cube[4], np.array([2.0, 2.0, 1.0]))