def test_reflect_wrong_symmetry_plane_3(self): params = FFD([3, 2, 2]) params.read_parameters('tests/test_datasets/parameters_sphere.prm') params.array_mu_z = np.array( [0.2, 0., 0., 0., 0.5, 0., 0., 0., 1., 0., 0.3, 0.1]).reshape( (3, 2, 2)) with self.assertRaises(RuntimeError): params.reflect(axis=2)
def test_reflect_axis_2(self): params = FFD([3, 2, 2]) params.read_parameters('tests/test_datasets/parameters_sphere.prm') params.array_mu_z = np.array( [0.2, 0., 0., 0., 0.5, 0., 0., 0., 0., 0., 0., 0.]).reshape( (3, 2, 2)) params.reflect(axis=2) array_mu_z_exact = np.array([ 0.2, 0., -0.2, 0., 0., 0., 0.5, 0., -0.5, 0., 0., -0., 0., 0., -0., 0., 0., -0. ]).reshape((3, 2, 3)) np.testing.assert_array_almost_equal(params.array_mu_z, array_mu_z_exact)
def test_reflect_box_length_3(self): params = FFD([2, 3, 5]) params.reflect(axis=2) assert params.box_length[2] == 2
def test_reflect_n_control_points_3(self): params = FFD([2, 3, 5]) params.reflect(axis=2) assert np.array_equal(params.n_control_points, [2, 3, 9])
def test_reflect_wrong_axis(self): params = FFD([2, 3, 5]) with self.assertRaises(ValueError): params.reflect(axis=4)