mailr15266 - in /branches/frame_order_testing/test_suite/system_tests: frame_order.py scripts/frame_order/cam/free_rotor2.py


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

Header


Content

Posted by edward on January 26, 2012 - 13:59:
Author: bugman
Date: Thu Jan 26 13:59:28 2012
New Revision: 15266

URL: http://svn.gna.org/viewcvs/relax?rev=15266&view=rev
Log:
Reactivated the Frame_order.test_cam_free_rotor2 system test using the new 
analysis design.


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_rotor2.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=15266&r1=15265&r2=15266&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 Thu 
Jan 26 13:59:28 2012
@@ -189,46 +189,25 @@
         self.assertAlmostEqual(cdp.chi2, 13.8, 1, msg=self.mesg)
 
 
-    def fixme_test_cam_free_rotor2(self):
+    def test_cam_free_rotor2(self):
         """Test the second 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_rotor2.py')
 
-        # The base data.
-        pivot = array([ 37.254, 0.5, 16.7465])
-        com = array([ 26.83678091, -12.37906417,  28.34154128])
-        pivot_com_axis = com - pivot
-        rot_axis = array([ 0.62649633,  0.77455282, -0.08700742])
-
-        # The average position CoM.
-        ave_pivot_com_axis = ds['ave pos'].CoM - pivot
-
-        # The projection of the CoMs onto the rotation axis.
-        orig_proj = dot(pivot_com_axis, rot_axis)
-        ave_proj = dot(ave_pivot_com_axis, rot_axis)
-
-        # Check that the projections are equal.
-        self.assertAlmostEqual(orig_proj, ave_proj, 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)
-        print("\nReal rotation axis:   %s" % repr(rot_axis))
-        print("Fitted rotation axis: %s" % repr(cart_vect))
-
-        # The dot product.
-        angle = acos(dot(cart_vect, rot_axis))
-        if angle > pi/2:
-            angle = acos(dot(cart_vect, -rot_axis))
-
-        # Check the angle.
-        self.assertAlmostEqual(angle, 0.0, 2)
+
+        # Get the debugging message.
+        self.mesg = self.mesg_opt_debug()
+
+        # Check the chi2 value.
+        self.assertAlmostEqual(cdp.chi2, 0.0, 1, msg=self.mesg)
 
 
     def fixme_test_cam_iso_cone_free_rotor(self):

Modified: 
branches/frame_order_testing/test_suite/system_tests/scripts/frame_order/cam/free_rotor2.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/frame_order_testing/test_suite/system_tests/scripts/frame_order/cam/free_rotor2.py?rev=15266&r1=15265&r2=15266&view=diff
==============================================================================
--- 
branches/frame_order_testing/test_suite/system_tests/scripts/frame_order/cam/free_rotor2.py
 (original)
+++ 
branches/frame_order_testing/test_suite/system_tests/scripts/frame_order/cam/free_rotor2.py
 Thu Jan 26 13:59:28 2012
@@ -5,13 +5,15 @@
 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()
 
 
 # Some variables.
-DATA_PATH = status.install_path + 
sep+'test_suite'+sep+'shared_data'+sep+'frame_order'+sep
+BASE_PATH = status.install_path + 
sep+'test_suite'+sep+'shared_data'+sep+'frame_order'+sep+'cam'+sep
+DATA_PATH = BASE_PATH + 'free_rotor2'
 
 
 class Analysis:
@@ -38,23 +40,59 @@
     def optimisation(self):
         """Optimise the frame order model."""
 
-        # The file paths.
-        PATH_N_DOM = DATA_PATH
-        PATH_C_DOM = PATH_N_DOM+sep+'free_rotor2'+sep
-
         # Create the data pipe.
         pipe.create(pipe_name='frame order', pipe_type='frame order')
 
-        # Load the tensors.
-        script(PATH_N_DOM + 'tensors.py')
-        script(PATH_C_DOM + 'tensors.py')
+        # Read the structures.
+        structure.read_pdb('1J7O_1st_NH.pdb', dir=BASE_PATH, 
set_mol_name='N-dom')
+        structure.read_pdb('1J7P_1st_NH_rot.pdb', dir=BASE_PATH, 
set_mol_name='C-dom')
+
+        # Load the spins.
+        structure.load_spins('@N')
+        structure.load_spins('@H')
+
+        # Load the NH vectors.
+        structure.vectors(spin_id='@N', attached='H', ave=False)
+
+        # Set the values needed to calculate the dipolar constant.
+        value.set(1.041 * 1e-10, 'r', spin_id="@N")
+        value.set('15N', 'heteronuc_type', spin_id="@N")
+        value.set('1H', 'proton_type', spin_id="@N")
+
+        # Loop over the alignments.
+        ln = ['dy', 'tb', 'tm', 'er']
+        for i in range(len(ln)):
+            # Load the RDCs.
+            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.
+            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)
+            frq.set(id=ln[i], frq=900e6)
+
+        # Load the N-domain tensors (the full tensors).
+        script(BASE_PATH + 'tensors.py')
+
+        # Define the domains.
+        domain(id='N', spin_id=":1-78")
+        domain(id='C', spin_id=":80-144")
 
         # The tensor domains and reductions.
         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)):
+            # Initialise the reduced tensor.
+            align_tensor.init(tensor=red[i], params=(0,0,0,0,0))
+
+            # Set the domain info.
             align_tensor.set_domain(tensor=full[i], domain='N')
             align_tensor.set_domain(tensor=red[i], domain='C')
+
+            # Specify which tensor is reduced.
             align_tensor.reduction(full_tensor=full[i], red_tensor=red[i])
 
         # Select the model.
@@ -63,22 +101,33 @@
         # Set the reference domain.
         frame_order.ref_domain('N')
 
-        # Set the parameters to that after a 21 increment grid search (for a 
massive speed up).
-        value.set(val=2.2143, param='ave_pos_beta')
-        value.set(val=0.897, param='ave_pos_gamma')
-        value.set(val=1.570, param='axis_theta')
-        value.set(val=1.1968, param='axis_phi')
+        # The pivot point.
+        pivot = array([ 37.254, 0.5, 16.7465])
+        frame_order.pivot(pivot, fix=True)
+
+        # Set the paramagnetic centre.
+        paramag.centre(pos=[35.934, 12.194, -4.206])
+
+        # Check the minimum.
+        value.set(val=2.5534876110153948, param='ave_pos_beta')
+        value.set(val=0.47194843111649976, param='ave_pos_gamma')
+        value.set(val=1.6573281536701425, param='axis_theta')
+        value.set(val=0.89246262623423234, param='axis_phi')
+        calc()
+        print("\nchi2: %s" % cdp.chi2)
 
         # Optimise.
-        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)
@@ -91,7 +140,7 @@
         pipe.create(pipe_name='orig pos', pipe_type='frame order')
 
         # Load the structure.
-        structure.read_pdb(DATA_PATH+'1J7P_1st_NH.pdb')
+        structure.read_pdb(BASE_PATH+'1J7P_1st_NH.pdb')
 
         # Store the centre of mass.
         cdp.CoM = centre_of_mass()
@@ -104,7 +153,7 @@
         pipe.create(pipe_name='ave pos', pipe_type='frame order')
 
         # Load the structure.
-        structure.read_pdb(DATA_PATH+'1J7P_1st_NH_rot.pdb')
+        structure.read_pdb(BASE_PATH+'1J7P_1st_NH_rot.pdb')
 
         # Rotate all atoms.
         structure.rotate(R=R, origin=pivot)




Related Messages


Powered by MHonArc, Updated Fri Jan 27 10:00:02 2012