def test_translate(self): n = 50 x = np.linspace(1.0, 5.0, n) y = np.linspace(-5.0, 2.0, n) z = (x + y)**2 / 10.0 x_shift = np.pi y_shift = np.exp(1) z_shift = np.sqrt(2.9) x_new, y_new, z_new = G.translate(x, y, z, x_shift, y_shift, z_shift) assert np.allclose(x_new - x_shift, x) assert np.allclose(y_new - y_shift, y) assert np.allclose(z_new - z_shift, z)
def test_translate(self): n = np.random.randint(1, 100) x = np.random.random_sample(n) y = np.random.random_sample(n) z = np.random.random_sample(n) x_shift = np.random.uniform(0.0, n) y_shift = np.random.uniform(0.0, n) z_shift = np.random.uniform(0.0, n) x_new, y_new, z_new = translate(x, y, z, x_shift, y_shift, z_shift) assert np.allclose(x_new - x_shift, x) assert np.allclose(y_new - y_shift, y) assert np.allclose(z_new - z_shift, z)