Author: bugman Date: Wed Sep 10 13:21:28 2014 New Revision: 25729 URL: http://svn.gna.org/viewcvs/relax?rev=25729&view=rev Log: Created 6 system tests for the frame_order.permute_axes user function. This covers the 3 starting conditions (x<y<z, x<z<y, z<x<y) and the two permutations ('A' and 'B') for each of these which do not include the starting permutation. They replace the original Frame_order.test_axis_permutation system test with the tests Frame_order.test_axis_perm_x_le_y_le_z_permA, Frame_order.test_axis_perm_x_le_y_le_z_permB, Frame_order.test_axis_perm_x_le_z_le_y_permA, Frame_order.test_axis_perm_x_le_z_le_y_permB, Frame_order.test_axis_perm_z_le_x_le_y_permA, and Frame_order.test_axis_perm_z_le_x_le_y_permB. Modified: branches/frame_order_cleanup/test_suite/system_tests/frame_order.py Modified: branches/frame_order_cleanup/test_suite/system_tests/frame_order.py URL: http://svn.gna.org/viewcvs/relax/branches/frame_order_cleanup/test_suite/system_tests/frame_order.py?rev=25729&r1=25728&r2=25729&view=diff ============================================================================== --- branches/frame_order_cleanup/test_suite/system_tests/frame_order.py (original) +++ branches/frame_order_cleanup/test_suite/system_tests/frame_order.py Wed Sep 10 13:21:28 2014 @@ -247,8 +247,224 @@ self.interpreter.run(script_file=self.cam_path+'auto_analysis_to_rigid.py') - def test_axis_permutation(self): - """Test the operation of the frame_order.permute_axes user function.""" + def test_axis_perm_x_le_y_le_z_permA(self): + """Test the operation of the frame_order.permute_axes user function for permutation 'A' when x <= y <= z.""" + + # Reset. + self.interpreter.reset() + + # Load the state file. + data_path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'frame_order'+sep+'axis_permutations' + self.interpreter.state.load(data_path+sep+'cam_pseudo_ellipse') + + # Change the original parameters. + cdp.cone_theta_x = orig_cone_theta_x = 1.0 + cdp.cone_theta_y = orig_cone_theta_y = 2.0 + cdp.cone_sigma_max = orig_cone_sigma_max = 3.0 + + # Store the original parameters. + orig_eigen_alpha = cdp.eigen_alpha + orig_eigen_beta = cdp.eigen_beta + orig_eigen_gamma = cdp.eigen_gamma + + # Permute the axes. + self.interpreter.frame_order.permute_axes('A') + + # Checks of the cone opening angle permutations. + self.assertEqual(cdp.cone_theta_x, 1.0) + self.assertEqual(cdp.cone_theta_y, 3.0) + self.assertEqual(cdp.cone_sigma_max, 2.0) + + # The optimised Eigenframe. + frame = array([[ 0.519591643135168, -0.302150522797118, -0.799205596800676], + [ 0.62357991685585 , -0.505348769456744, 0.596465177946379], + [-0.584099830232939, -0.808286881485765, -0.074159999594586]], float64) + + # Manually permute the frame, and then obtain the Euler angles. + frame_new = transpose(array([frame[:, 0], -frame[:, 2], frame[:, 1]], float64)) + alpha, beta, gamma = R_to_euler_zyz(frame_new) + + # Check the Eigenframe Euler angles. + self.assertAlmostEqual(cdp.eigen_alpha, alpha) + self.assertAlmostEqual(cdp.eigen_beta, beta) + self.assertAlmostEqual(cdp.eigen_gamma, gamma) + + # Permute the axes a second time - this should restore the original result. + self.interpreter.frame_order.permute_axes('A') + + # Check the values. + self.assertAlmostEqual(cdp.cone_theta_x, orig_cone_theta_x) + self.assertAlmostEqual(cdp.cone_theta_y, orig_cone_theta_y) + self.assertAlmostEqual(cdp.cone_sigma_max, orig_cone_sigma_max) + self.assertAlmostEqual(cdp.eigen_alpha, orig_eigen_alpha) + self.assertAlmostEqual(cdp.eigen_beta, orig_eigen_beta) + self.assertAlmostEqual(cdp.eigen_gamma, orig_eigen_gamma) + + + def test_axis_perm_x_le_y_le_z_permB(self): + """Test the operation of the frame_order.permute_axes user function for permutation 'B' when x <= y <= z.""" + + # Reset. + self.interpreter.reset() + + # Load the state file. + data_path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'frame_order'+sep+'axis_permutations' + self.interpreter.state.load(data_path+sep+'cam_pseudo_ellipse') + + # Change the original parameters. + cdp.cone_theta_x = orig_cone_theta_x = 1.0 + cdp.cone_theta_y = orig_cone_theta_y = 2.0 + cdp.cone_sigma_max = orig_cone_sigma_max = 3.0 + + # Store the original parameters. + orig_eigen_alpha = cdp.eigen_alpha + orig_eigen_beta = cdp.eigen_beta + orig_eigen_gamma = cdp.eigen_gamma + + # Permute the axes. + self.interpreter.frame_order.permute_axes('B') + + # Checks of the cone opening angle permutations. + self.assertEqual(cdp.cone_theta_x, 2.0) + self.assertEqual(cdp.cone_theta_y, 3.0) + self.assertEqual(cdp.cone_sigma_max, 1.0) + + # The optimised Eigenframe. + frame = array([[ 0.519591643135168, -0.302150522797118, -0.799205596800676], + [ 0.62357991685585 , -0.505348769456744, 0.596465177946379], + [-0.584099830232939, -0.808286881485765, -0.074159999594586]], float64) + + # Manually permute the frame, and then obtain the Euler angles. + frame_new = transpose(array([frame[:, 2], frame[:, 0], frame[:, 1]], float64)) + alpha, beta, gamma = R_to_euler_zyz(frame_new) + + # Check the Eigenframe Euler angles. + self.assertAlmostEqual(cdp.eigen_alpha, alpha) + self.assertAlmostEqual(cdp.eigen_beta, beta) + self.assertAlmostEqual(cdp.eigen_gamma, gamma) + + # Permute the axes a second time - this should restore the original result. + self.interpreter.frame_order.permute_axes('B') + + # Check the values. + self.assertAlmostEqual(cdp.cone_theta_x, orig_cone_theta_x) + self.assertAlmostEqual(cdp.cone_theta_y, orig_cone_theta_y) + self.assertAlmostEqual(cdp.cone_sigma_max, orig_cone_sigma_max) + self.assertAlmostEqual(cdp.eigen_alpha, orig_eigen_alpha) + self.assertAlmostEqual(cdp.eigen_beta, orig_eigen_beta) + self.assertAlmostEqual(cdp.eigen_gamma, orig_eigen_gamma) + + + def test_axis_perm_x_le_z_le_y_permB(self): + """Test the operation of the frame_order.permute_axes user function for permutation 'B' when x <= z <= y.""" + + # Reset. + self.interpreter.reset() + + # Load the state file. + data_path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'frame_order'+sep+'axis_permutations' + self.interpreter.state.load(data_path+sep+'cam_pseudo_ellipse') + + # Change the original parameters. + cdp.cone_theta_x = orig_cone_theta_x = 1.0 + cdp.cone_theta_y = orig_cone_theta_y = 3.0 + cdp.cone_sigma_max = orig_cone_sigma_max = 2.0 + + # Store the original parameters. + orig_eigen_alpha = cdp.eigen_alpha + orig_eigen_beta = cdp.eigen_beta + orig_eigen_gamma = cdp.eigen_gamma + + # Permute the axes. + self.interpreter.frame_order.permute_axes('B') + + # Checks of the cone opening angle permutations. + self.assertEqual(cdp.cone_theta_x, 2.0) + self.assertEqual(cdp.cone_theta_y, 3.0) + self.assertEqual(cdp.cone_sigma_max, 1.0) + + # The optimised Eigenframe. + frame = array([[ 0.519591643135168, -0.302150522797118, -0.799205596800676], + [ 0.62357991685585 , -0.505348769456744, 0.596465177946379], + [-0.584099830232939, -0.808286881485765, -0.074159999594586]], float64) + + # Manually permute the frame, and then obtain the Euler angles. + frame_new = transpose(array([frame[:, 2], frame[:, 1], frame[:, 0]], float64)) + alpha, beta, gamma = R_to_euler_zyz(frame_new) + + # Check the Eigenframe Euler angles. + self.assertAlmostEqual(cdp.eigen_alpha, alpha) + self.assertAlmostEqual(cdp.eigen_beta, beta) + self.assertAlmostEqual(cdp.eigen_gamma, gamma) + + # Permute the axes a second time - this should restore the original result. + self.interpreter.frame_order.permute_axes('B') + + # Check the values. + self.assertAlmostEqual(cdp.cone_theta_x, orig_cone_theta_x) + self.assertAlmostEqual(cdp.cone_theta_y, orig_cone_theta_y) + self.assertAlmostEqual(cdp.cone_sigma_max, orig_cone_sigma_max) + self.assertAlmostEqual(cdp.eigen_alpha, orig_eigen_alpha) + self.assertAlmostEqual(cdp.eigen_beta, orig_eigen_beta) + self.assertAlmostEqual(cdp.eigen_gamma, orig_eigen_gamma) + + + def test_axis_perm_x_le_z_le_y_permA(self): + """Test the operation of the frame_order.permute_axes user function for permutation 'A' when x <= z <= y.""" + + # Reset. + self.interpreter.reset() + + # Load the state file. + data_path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'frame_order'+sep+'axis_permutations' + self.interpreter.state.load(data_path+sep+'cam_pseudo_ellipse') + + # Change the original parameters. + cdp.cone_theta_x = orig_cone_theta_x = 1.0 + cdp.cone_theta_y = orig_cone_theta_y = 3.0 + cdp.cone_sigma_max = orig_cone_sigma_max = 2.0 + + # Store the original parameters. + orig_eigen_alpha = cdp.eigen_alpha + orig_eigen_beta = cdp.eigen_beta + orig_eigen_gamma = cdp.eigen_gamma + + # Permute the axes. + self.interpreter.frame_order.permute_axes('A') + + # Checks of the cone opening angle permutations. + self.assertEqual(cdp.cone_theta_x, 1.0) + self.assertEqual(cdp.cone_theta_y, 2.0) + self.assertEqual(cdp.cone_sigma_max, 3.0) + + # The optimised Eigenframe. + frame = array([[ 0.519591643135168, -0.302150522797118, -0.799205596800676], + [ 0.62357991685585 , -0.505348769456744, 0.596465177946379], + [-0.584099830232939, -0.808286881485765, -0.074159999594586]], float64) + + # Manually permute the frame, and then obtain the Euler angles. + frame_new = transpose(array([frame[:, 0], -frame[:, 2], frame[:, 1]], float64)) + alpha, beta, gamma = R_to_euler_zyz(frame_new) + + # Check the Eigenframe Euler angles. + self.assertAlmostEqual(cdp.eigen_alpha, alpha) + self.assertAlmostEqual(cdp.eigen_beta, beta) + self.assertAlmostEqual(cdp.eigen_gamma, gamma) + + # Permute the axes a second time - this should restore the original result. + self.interpreter.frame_order.permute_axes('A') + + # Check the values. + self.assertAlmostEqual(cdp.cone_theta_x, orig_cone_theta_x) + self.assertAlmostEqual(cdp.cone_theta_y, orig_cone_theta_y) + self.assertAlmostEqual(cdp.cone_sigma_max, orig_cone_sigma_max) + self.assertAlmostEqual(cdp.eigen_alpha, orig_eigen_alpha) + self.assertAlmostEqual(cdp.eigen_beta, orig_eigen_beta) + self.assertAlmostEqual(cdp.eigen_gamma, orig_eigen_gamma) + + + def test_axis_perm_z_le_x_le_y_permA(self): + """Test the operation of the frame_order.permute_axes user function for permutation 'A' when z <= x <= y.""" # Reset. self.interpreter.reset() @@ -266,7 +482,7 @@ orig_eigen_gamma = cdp.eigen_gamma # Permute the axes. - self.interpreter.frame_order.permute_axes() + self.interpreter.frame_order.permute_axes('A') # Checks of the cone opening angle permutations. self.assertEqual(cdp.cone_theta_x, 0.53277077276728502) @@ -288,7 +504,59 @@ self.assertAlmostEqual(cdp.eigen_gamma, gamma) # Permute the axes a second time - this should restore the original result. - self.interpreter.frame_order.permute_axes() + self.interpreter.frame_order.permute_axes('A') + + # Check the values. + self.assertAlmostEqual(cdp.cone_theta_x, orig_cone_theta_x) + self.assertAlmostEqual(cdp.cone_theta_y, orig_cone_theta_y) + self.assertAlmostEqual(cdp.cone_sigma_max, orig_cone_sigma_max) + self.assertAlmostEqual(cdp.eigen_alpha, orig_eigen_alpha) + self.assertAlmostEqual(cdp.eigen_beta, orig_eigen_beta) + self.assertAlmostEqual(cdp.eigen_gamma, orig_eigen_gamma) + + + def test_axis_perm_z_le_x_le_y_permB(self): + """Test the operation of the frame_order.permute_axes user function for permutation 'B' when z <= x <= y.""" + + # Reset. + self.interpreter.reset() + + # Load the state file. + data_path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'frame_order'+sep+'axis_permutations' + self.interpreter.state.load(data_path+sep+'cam_pseudo_ellipse') + + # Store the original parameters. + orig_cone_theta_x = cdp.cone_theta_x + orig_cone_theta_y = cdp.cone_theta_y + orig_cone_sigma_max = cdp.cone_sigma_max + orig_eigen_alpha = cdp.eigen_alpha + orig_eigen_beta = cdp.eigen_beta + orig_eigen_gamma = cdp.eigen_gamma + + # Permute the axes. + self.interpreter.frame_order.permute_axes('B') + + # Checks of the cone opening angle permutations. + self.assertEqual(cdp.cone_theta_x, 0.53277077276728502) + self.assertEqual(cdp.cone_theta_y, 1.2119285953475074) + self.assertEqual(cdp.cone_sigma_max, 0.8097621930390525) + + # The optimised Eigenframe. + frame = array([[ 0.519591643135168, -0.302150522797118, -0.799205596800676], + [ 0.62357991685585 , -0.505348769456744, 0.596465177946379], + [-0.584099830232939, -0.808286881485765, -0.074159999594586]], float64) + + # Manually permute the frame, and then obtain the Euler angles. + frame_new = transpose(array([-frame[:, 2], frame[:, 1], frame[:, 0]], float64)) + alpha, beta, gamma = R_to_euler_zyz(frame_new) + + # Check the Eigenframe Euler angles. + self.assertAlmostEqual(cdp.eigen_alpha, alpha) + self.assertAlmostEqual(cdp.eigen_beta, beta) + self.assertAlmostEqual(cdp.eigen_gamma, gamma) + + # Permute the axes a second time - this should restore the original result. + self.interpreter.frame_order.permute_axes('B') # Check the values. self.assertAlmostEqual(cdp.cone_theta_x, orig_cone_theta_x)