mailr15253 - in /branches/frame_order_testing/test_suite/system_tests: frame_order.py scripts/frame_order/cam/free_rotor.py


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by edward on January 25, 2012 - 15:18:
Author: bugman
Date: Wed Jan 25 15:18:17 2012
New Revision: 15253

URL: http://svn.gna.org/viewcvs/relax?rev=15253&view=rev
Log:
Fixes for the Frame_order.test_cam_free_rotor system test.


Modified:
    branches/frame_order_testing/test_suite/system_tests/frame_order.py
    
branches/frame_order_testing/test_suite/system_tests/scripts/frame_order/cam/free_rotor.py

Modified: branches/frame_order_testing/test_suite/system_tests/frame_order.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/frame_order_testing/test_suite/system_tests/frame_order.py?rev=15253&r1=15252&r2=15253&view=diff
==============================================================================
--- branches/frame_order_testing/test_suite/system_tests/frame_order.py 
(original)
+++ branches/frame_order_testing/test_suite/system_tests/frame_order.py Wed 
Jan 25 15:18:17 2012
@@ -112,15 +112,22 @@
 
 
         # Minimisation info.
-        string = string + "\n%-15s %30.17g\n" % ('ave_pos_alpha:',   
cdp.ave_pos_alpha)
+        string = string + "\n"
+        if hasattr(cdp, 'ave_pos_alpha'):
+            string = string + "%-15s %30.17g\n" % ('ave_pos_alpha:',   
cdp.ave_pos_alpha)
         string = string +   "%-15s %30.17g\n" % ('ave_pos_beta:',    
cdp.ave_pos_beta)
         string = string +   "%-15s %30.17g\n" % ('ave_pos_gamma:',   
cdp.ave_pos_gamma)
         string = string +   "%-15s %30.17g\n" % ('chi2:',    cdp.chi2)
-        string = string +   "%-15s %30i\n" % ('iter:',    cdp.iter)
-        string = string +   "%-15s %30i\n" % ('f_count:', cdp.f_count)
-        string = string +   "%-15s %30i\n" % ('g_count:', cdp.g_count)
-        string = string +   "%-15s %30i\n" % ('h_count:', cdp.h_count)
-        string = string +   "%-15s %30s\n" % ('warning:', cdp.warning)
+        if hasattr(cdp, 'iter'):
+            string = string +   "%-15s %30i\n" % ('iter:',    cdp.iter)
+        if hasattr(cdp, 'f_count'):
+            string = string +   "%-15s %30i\n" % ('f_count:', cdp.f_count)
+        if hasattr(cdp, 'g_count'):
+            string = string +   "%-15s %30i\n" % ('g_count:', cdp.g_count)
+        if hasattr(cdp, 'h_count'):
+            string = string +   "%-15s %30i\n" % ('h_count:', cdp.h_count)
+        if hasattr(cdp, 'warning'):
+            string = string +   "%-15s %30s\n" % ('warning:', cdp.warning)
 
         # Return the string.
         return string
@@ -164,36 +171,22 @@
     def test_cam_free_rotor(self):
         """Test the free rotor frame order model of CaM."""
 
+        # Setup.
+        ds.flag_rdc = True
+        ds.flag_pcs = True
+        ds.flag_opt = False
+
         # Execute the script.
         self.interpreter.run(script_file=status.install_path + 
sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'frame_order'+sep+'cam'+sep+'free_rotor.py')
 
-        # Check the average structure CoM matches that of the original 
position (the average structure is not defined along the rotation axis).
-        for i in range(3):
-            self.assertAlmostEqual(ds['ave pos'].CoM[i], ds['orig 
pos'].CoM[i], 0)
-
-        # The rotation axis.
+        # Switch back to the original pipe.
         self.interpreter.pipe.switch('frame order')
-        spherical_vect = zeros(3, float64)
-        spherical_vect[0] = 1.0
-        spherical_vect[1] = cdp.axis_theta
-        spherical_vect[2] = cdp.axis_phi
-        cart_vect = zeros(3, float64)
-        spherical_to_cartesian(spherical_vect, cart_vect)
-
-        # The original rotation axis.
-        pivot = array([ 37.254, 0.5, 16.7465])
-        com = array([ 26.83678091, -12.37906417,  28.34154128])
-        axis = pivot - com
-        axis = axis / norm(axis)
-
-        # The dot product.
-        angle = acos(dot(cart_vect, axis))
-
-        # Check the angle.
-        if angle > 3 and angle < 4:
-            self.assertAlmostEqual(angle, pi, 1)
-        else:
-            self.assertAlmostEqual(angle, 0.0, 1)
+
+        # Get the debugging message.
+        self.mesg = self.mesg_opt_debug()
+
+        # Check the chi2 value.
+        self.assertAlmostEqual(cdp.chi2, 13.8, 1, msg=self.mesg)
 
 
     def fixme_test_cam_free_rotor2(self):

Modified: 
branches/frame_order_testing/test_suite/system_tests/scripts/frame_order/cam/free_rotor.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/frame_order_testing/test_suite/system_tests/scripts/frame_order/cam/free_rotor.py?rev=15253&r1=15252&r2=15253&view=diff
==============================================================================
--- 
branches/frame_order_testing/test_suite/system_tests/scripts/frame_order/cam/free_rotor.py
 (original)
+++ 
branches/frame_order_testing/test_suite/system_tests/scripts/frame_order/cam/free_rotor.py
 Wed Jan 25 15:18:17 2012
@@ -5,6 +5,7 @@
 from os import sep
 
 # relax module imports.
+from data import Relax_data_store; ds = Relax_data_store()
 from generic_fns.structure.mass import centre_of_mass
 from maths_fns.rotation_matrix import euler_to_R_zyz
 from status import Status; status = Status()
@@ -62,10 +63,12 @@
         ln = ['dy', 'tb', 'tm', 'er']
         for i in range(len(ln)):
             # Load the RDCs.
-            rdc.read(align_id=ln[i], file='rdc_%s.txt'%ln[i], dir=DATA_PATH, 
res_num_col=2, spin_name_col=5, data_col=6, error_col=7)
+            if ds.flag_rdc:
+                rdc.read(align_id=ln[i], file='rdc_%s.txt'%ln[i], 
dir=DATA_PATH, res_num_col=2, spin_name_col=5, data_col=6, error_col=7)
 
             # The PCS.
-            pcs.read(align_id=ln[i], file='pcs_%s.txt'%ln[i], dir=DATA_PATH, 
res_num_col=2, spin_name_col=5, data_col=6, error_col=7)
+            if ds.flag_pcs:
+                pcs.read(align_id=ln[i], file='pcs_%s.txt'%ln[i], 
dir=DATA_PATH, res_num_col=2, spin_name_col=5, data_col=6, error_col=7)
 
             # The temperature and field strength.
             temperature(id=ln[i], temp=303)
@@ -82,7 +85,7 @@
         full = ['Dy N-dom', 'Tb N-dom', 'Tm N-dom', 'Er N-dom']
         red =  ['Dy C-dom', 'Tb C-dom', 'Tm C-dom', 'Er C-dom']
         for i in range(len(full)):
-            # Initalise the reduced tensor.
+            # Initialise the reduced tensor.
             align_tensor.init(tensor=red[i], params=(0,0,0,0,0))
 
             # Set the domain info.
@@ -114,16 +117,17 @@
         print("\nchi2: %s" % cdp.chi2)
 
         # Optimise.
-        #grid_search(inc=11)
-        #minimise('simplex', constraints=False)
+        if ds.flag_opt:
+            grid_search(inc=11)
+            minimise('simplex', constraints=False)
 
-        ## Test Monte Carlo simulations.
-        #monte_carlo.setup(number=3)
-        #monte_carlo.create_data()
-        #monte_carlo.initial_values()
-        #minimise('simplex', constraints=False)
-        #eliminate()
-        #monte_carlo.error_analysis()
+            # Test Monte Carlo simulations.
+            monte_carlo.setup(number=3)
+            monte_carlo.create_data()
+            monte_carlo.initial_values()
+            minimise('simplex', constraints=False)
+            eliminate()
+            monte_carlo.error_analysis()
 
         # Write the results.
         results.write('devnull', dir=None, force=True)




Related Messages


Powered by MHonArc, Updated Thu Jan 26 09:00:03 2012