Example #1
0
 def test_reflect_wrong_symmetry_plane_3(self):
     params = FFDParameters([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)
Example #2
0
 def test_reflect_wrong_symmetry_plane_3(self):
     params = FFDParameters([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)
Example #3
0
 def test_reflect_axis_2(self):
     params = FFDParameters([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)
Example #4
0
 def test_reflect_axis_2(self):
     params = FFDParameters([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)
Example #5
0
 def test_reflect_n_control_points_3(self):
     params = FFDParameters([2, 3, 5])
     params.reflect(axis=2)
     assert np.array_equal(params.n_control_points, [2, 3, 9])
Example #6
0
 def test_reflect_wrong_axis(self):
     params = FFDParameters([2, 3, 5])
     with self.assertRaises(ValueError):
         params.reflect(axis=4)
Example #7
0
 def test_reflect_box_length_3(self):
     params = FFDParameters([2, 3, 5])
     params.reflect(axis=2)
     assert params.box_length[2] == 2 
Example #8
0
 def test_reflect_n_control_points_3(self):
     params = FFDParameters([2, 3, 5])
     params.reflect(axis=2)
     assert np.array_equal(params.n_control_points, [2, 3, 9])
Example #9
0
 def test_reflect_wrong_axis(self):
     params = FFDParameters([2, 3, 5])
     with self.assertRaises(ValueError):
         params.reflect(axis=4)
Example #10
0
 def test_reflect_box_length_3(self):
     params = FFDParameters([2, 3, 5])
     params.reflect(axis=2)
     assert params.box_length[2] == 2