Example #1
0
def test_mirror_2D_one_axis():
    """ Test mirror() on a 2D array for one axis """
    arr = np.zeros((16, 16), dtype=float)
    arr[15, 3] = 1
    assert np.allclose(arr[:, ::-1], mirror(arr, axes=1))
    assert np.allclose(arr[::-1, :], mirror(arr, axes=0))
Example #2
0
def test_mirror_2D_all_axes():
    """ Test mirror() on a 2D array for all axes """
    arr = np.zeros((16, 16), dtype=float)
    arr[15, 3] = 1
    assert np.allclose(arr[::-1, ::-1], mirror(arr))
Example #3
0
def test_mirror_1D():
    """ Test mirror() on a 1D array """
    arr = np.zeros((16, ), dtype=float)
    arr[15] = 1
    assert np.allclose(arr[::-1], mirror(arr))
Example #4
0
 def test_2D_one_axis(self):
     """ Test mirror() on a 2D array for one axis """
     arr = np.zeros((16, 16), dtype=np.float)
     arr[15, 3] = 1
     self.assertTrue(np.allclose(arr[:, ::-1], mirror(arr, axes=1)))
     self.assertTrue(np.allclose(arr[::-1, :], mirror(arr, axes=0)))
Example #5
0
 def test_2D_all_axes(self):
     """ Test mirror() on a 2D array for all axes """
     arr = np.zeros((16, 16), dtype=np.float)
     arr[15, 3] = 1
     self.assertTrue(np.allclose(arr[::-1, ::-1], mirror(arr)))
Example #6
0
 def test_1D(self):
     """ Test mirror() on a 1D array """
     arr = np.zeros((16, ), dtype=np.float)
     arr[15] = 1
     self.assertTrue(np.allclose(arr[::-1], mirror(arr)))