mailr22024 - in /trunk/test_suite: shared_data/ shared_data/frame_order/ shared_data/frame_order/cam/ system_tests/ system_tests...


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

Header


Content

Posted by edward on January 17, 2014 - 11:51:
Author: bugman
Date: Fri Jan 17 11:51:16 2014
New Revision: 22024

URL: http://svn.gna.org/viewcvs/relax?rev=22024&view=rev
Log:
Created the Frame_order.test_generate_rotor2_distribution system test.

This is to test the Frame Order distribution generating base script, used for 
creating the synthetic
Frame Order test data, and to demonstrate a failure in handling 
back-calculated RDC data.

To implement this, the test_suite/shared_data/frame_order/cam/ path has been 
converted into a Python
package (with the addition of the __init__.py files).  The base data 
generation script
test_suite/shared_data/frame_order/cam/generate_base.py has also been 
modified to use the absolute
path for the data files and its run() method now accepts the save_path 
argument to allow the files
to be saved into a temporary directory.


Added:
    trunk/test_suite/shared_data/frame_order/__init__.py
      - copied, changed from r22019, trunk/test_suite/shared_data/__init__.py
    trunk/test_suite/shared_data/frame_order/cam/__init__.py
      - copied, changed from r22019, trunk/test_suite/shared_data/__init__.py
    
trunk/test_suite/system_tests/scripts/frame_order/cam/generate_rotor2_distribution.py
      - copied, changed from r22019, 
trunk/test_suite/shared_data/frame_order/cam/rotor2/generate_distribution.py
Modified:
    trunk/test_suite/shared_data/__init__.py
    trunk/test_suite/shared_data/frame_order/cam/generate_base.py
    trunk/test_suite/system_tests/frame_order.py

Modified: trunk/test_suite/shared_data/__init__.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/test_suite/shared_data/__init__.py?rev=22024&r1=22023&r2=22024&view=diff
==============================================================================
--- trunk/test_suite/shared_data/__init__.py (original)
+++ trunk/test_suite/shared_data/__init__.py Fri Jan 17 11:51:16 2014
@@ -1,6 +1,6 @@
 
###############################################################################
 #                                                                            
 #
-# Copyright (C) 2006-2010 Edward d'Auvergne                                  
 #
+# Copyright (C) 2006-2014 Edward d'Auvergne                                  
 #
 #                                                                            
 #
 # This file is part of the program relax (http://www.nmr-relax.com).         
 #
 #                                                                            
 #
@@ -23,4 +23,6 @@
 """The relax test-suite shared data."""
 
 
-__all__ = []
+__all__ = [
+    'frame_order'
+]

Copied: trunk/test_suite/shared_data/frame_order/__init__.py (from r22019, 
trunk/test_suite/shared_data/__init__.py)
URL: 
http://svn.gna.org/viewcvs/relax/trunk/test_suite/shared_data/frame_order/__init__.py?p2=trunk/test_suite/shared_data/frame_order/__init__.py&p1=trunk/test_suite/shared_data/__init__.py&r1=22019&r2=22024&rev=22024&view=diff
==============================================================================
--- trunk/test_suite/shared_data/__init__.py (original)
+++ trunk/test_suite/shared_data/frame_order/__init__.py Fri Jan 17 11:51:16 
2014
@@ -1,6 +1,6 @@
 
###############################################################################
 #                                                                            
 #
-# Copyright (C) 2006-2010 Edward d'Auvergne                                  
 #
+# Copyright (C) 2006-2014 Edward d'Auvergne                                  
 #
 #                                                                            
 #
 # This file is part of the program relax (http://www.nmr-relax.com).         
 #
 #                                                                            
 #
@@ -20,7 +20,9 @@
 
###############################################################################
 
 # Package docstring.
-"""The relax test-suite shared data."""
+"""The relax test-suite shared data for the Frame Order theories."""
 
 
-__all__ = []
+__all__ = [
+    'cam'
+]

Copied: trunk/test_suite/shared_data/frame_order/cam/__init__.py (from 
r22019, trunk/test_suite/shared_data/__init__.py)
URL: 
http://svn.gna.org/viewcvs/relax/trunk/test_suite/shared_data/frame_order/cam/__init__.py?p2=trunk/test_suite/shared_data/frame_order/cam/__init__.py&p1=trunk/test_suite/shared_data/__init__.py&r1=22019&r2=22024&rev=22024&view=diff
==============================================================================
--- trunk/test_suite/shared_data/__init__.py (original)
+++ trunk/test_suite/shared_data/frame_order/cam/__init__.py Fri Jan 17 
11:51:16 2014
@@ -1,6 +1,6 @@
 
###############################################################################
 #                                                                            
 #
-# Copyright (C) 2006-2010 Edward d'Auvergne                                  
 #
+# Copyright (C) 2006-2014 Edward d'Auvergne                                  
 #
 #                                                                            
 #
 # This file is part of the program relax (http://www.nmr-relax.com).         
 #
 #                                                                            
 #
@@ -20,7 +20,9 @@
 
###############################################################################
 
 # Package docstring.
-"""The relax test-suite shared data."""
+"""The relax test-suite shared data for the CaM data for the Frame Order 
theories."""
 
 
-__all__ = []
+__all__ = [
+    'generate_base'
+]

Modified: trunk/test_suite/shared_data/frame_order/cam/generate_base.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/test_suite/shared_data/frame_order/cam/generate_base.py?rev=22024&r1=22023&r2=22024&view=diff
==============================================================================
--- trunk/test_suite/shared_data/frame_order/cam/generate_base.py (original)
+++ trunk/test_suite/shared_data/frame_order/cam/generate_base.py Fri Jan 17 
11:51:16 2014
@@ -26,18 +26,20 @@
 from math import pi
 from numpy import array, cross, dot, float16, float64, transpose, zeros
 from numpy.linalg import norm
+from os import getcwd, sep
 import sys
 
 # relax module imports.
+from lib.frame_order.format import print_frame_order_2nd_degree
+from lib.geometry.coord_transform import cartesian_to_spherical
+from lib.geometry.rotations import axis_angle_to_R, R_to_euler_zyz
+from lib.io import open_write_file
+from lib.linear_algebra.kronecker_product import kron_prod
 from pipe_control.angles import wrap_angles
-from lib.frame_order.format import print_frame_order_2nd_degree
+from pipe_control.interatomic import interatomic_loop
 from pipe_control.mol_res_spin import spin_loop
-from pipe_control.interatomic import interatomic_loop
-from lib.geometry.coord_transform import cartesian_to_spherical
-from lib.linear_algebra.kronecker_product import kron_prod
-from lib.geometry.rotations import axis_angle_to_R, R_to_euler_zyz
 from prompt.interpreter import Interpreter
-from lib.io import open_write_file
+from status import Status; status = Status()
 
 
 class Main:
@@ -45,8 +47,18 @@
     pivot = array([ 37.254, 0.5, 16.7465])
     com = array([ 26.83678091, -12.37906417,  28.34154128])
 
-    def run(self):
-        """Generate the distribution and alignment data."""
+    def run(self, save_path=None):
+        """Generate the distribution and alignment data.
+        
+        @keyword save_path: The path to place the files into.  If set to 
None, then the current path will be used.
+        @type save_path:    None or str
+        """
+
+        # The paths to the files.
+        self.path = status.install_path + 
sep+'test_suite'+sep+'shared_data'+sep+'frame_order'+sep+'cam'+sep
+        self.save_path = save_path
+        if self.save_path == None:
+            self.save_path = getcwd()
 
         # Load the interpreter.
         self.interpreter = Interpreter(show_script=False, quit=False, 
raise_relax_error=True)
@@ -72,7 +84,7 @@
         """Calculate the RDCs and PCSs expected for the structural 
distribution."""
 
         # Load the tensors.
-        self.interpreter.script('../tensors.py')
+        self.interpreter.script(self.path+'tensors.py')
 
         # Set up the model.
         self.interpreter.n_state_model.select_model(model='fixed')
@@ -108,8 +120,8 @@
                 spin.pcs_err[tag] = 0.1
 
             # Write the data.
-            self.interpreter.rdc.write(align_id=tag, 
file='rdc_%s.txt'%tensors[i], bc=True, force=True)
-            self.interpreter.pcs.write(align_id=tag, 
file='pcs_%s.txt'%tensors[i], bc=True, force=True)
+            self.interpreter.rdc.write(align_id=tag, 
file='rdc_%s.txt'%tensors[i], dir=self.save_path, bc=True, force=True)
+            self.interpreter.pcs.write(align_id=tag, 
file='pcs_%s.txt'%tensors[i], dir=self.save_path, bc=True, force=True)
 
         # Store the state.
         self.interpreter.state.save('back_calc', force=True)
@@ -138,7 +150,7 @@
         self.interpreter.pipe.create('distribution', 'N-state')
 
         # Load the original PDB.
-        self.interpreter.structure.read_pdb('1J7P_1st_NH.pdb', dir='..', 
set_mol_name='C-dom')
+        self.interpreter.structure.read_pdb('1J7P_1st_NH.pdb', 
dir=self.path, set_mol_name='C-dom')
 
         # Set up the 15N and 1H spins.
         self.interpreter.structure.load_spins(spin_id='@N', ave_pos=False)
@@ -159,7 +171,7 @@
         self.daeg = zeros((9, 9), float64)
 
         # Open the output files.
-        rot_file = open_write_file('rotations', compress_type=1, force=True)
+        rot_file = open_write_file('rotations', dir=self.save_path, 
compress_type=1, force=True)
 
         # Printout.
         sys.stdout.write("\n\nRotating %s states:\n\n" % self.N)
@@ -196,7 +208,7 @@
         self.daeg = self.daeg / self.N
 
         # Write out the frame order matrix.
-        file = open('frame_order_matrix', 'w')
+        file = open(self.save_path+sep+'frame_order_matrix', 'w')
         print_frame_order_2nd_degree(self.daeg, file=file)
 
 
@@ -204,7 +216,7 @@
         """Print out of the full system."""
 
         # Open the file.
-        file = open('axis_system', 'w')
+        file = open(self.save_path+sep+'axis_system', 'w')
 
         # Header.
         file.write("\n")
@@ -274,7 +286,7 @@
         self.interpreter.structure.connect_atom(index1=0, index2=3)
 
         # Write out the PDB.
-        self.interpreter.structure.write_pdb('axis.pdb', compress_type=0, 
force=True)
+        self.interpreter.structure.write_pdb('axis.pdb', dir=self.save_path, 
compress_type=0, force=True)
 
 
     def axes_to_pdb_main_axis(self):
@@ -294,7 +306,7 @@
         self.interpreter.structure.connect_atom(index1=0, index2=1)
 
         # Write out the PDB.
-        self.interpreter.structure.write_pdb('axis.pdb', compress_type=0, 
force=True)
+        self.interpreter.structure.write_pdb('axis.pdb', dir=self.save_path, 
compress_type=0, force=True)
 
 
     def build_axes_alt(self):

Modified: trunk/test_suite/system_tests/frame_order.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/test_suite/system_tests/frame_order.py?rev=22024&r1=22023&r2=22024&view=diff
==============================================================================
--- trunk/test_suite/system_tests/frame_order.py (original)
+++ trunk/test_suite/system_tests/frame_order.py Fri Jan 17 11:51:16 2014
@@ -24,6 +24,7 @@
 import platform
 import numpy
 from os import sep
+from tempfile import mkdtemp
 
 # relax module imports.
 from data_store import Relax_data_store; ds = Relax_data_store()
@@ -113,6 +114,9 @@
         # The path to the CaM scripts.
         self.cam_path = status.install_path + 
sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'frame_order'+sep+'cam'+sep
 
+        # Create a temporary directory for dumping files.
+        ds.tmpdir = mkdtemp()
+
 
     def tearDown(self):
         """Clean up after the tests."""
@@ -632,6 +636,13 @@
         self.flags(pcs=False)
         self.interpreter.run(script_file=self.cam_path+'rotor2.py')
         self.check_chi2(0.080669539157379247)
+
+
+    def test_generate_rotor2_distribution(self):
+        """Generate the rotor2 distribution of CaM."""
+
+        # Execute the script.
+        
self.interpreter.run(script_file=self.cam_path+'generate_rotor2_distribution.py')
 
 
     def fixme_test_model_free_rotor(self):

Copied: 
trunk/test_suite/system_tests/scripts/frame_order/cam/generate_rotor2_distribution.py
 (from r22019, 
trunk/test_suite/shared_data/frame_order/cam/rotor2/generate_distribution.py)
URL: 
http://svn.gna.org/viewcvs/relax/trunk/test_suite/system_tests/scripts/frame_order/cam/generate_rotor2_distribution.py?p2=trunk/test_suite/system_tests/scripts/frame_order/cam/generate_rotor2_distribution.py&p1=trunk/test_suite/shared_data/frame_order/cam/rotor2/generate_distribution.py&r1=22019&r2=22024&rev=22024&view=diff
==============================================================================
--- 
trunk/test_suite/shared_data/frame_order/cam/rotor2/generate_distribution.py 
(original)
+++ 
trunk/test_suite/system_tests/scripts/frame_order/cam/generate_rotor2_distribution.py
 Fri Jan 17 11:51:16 2014
@@ -8,17 +8,18 @@
 from math import pi
 
 # relax module imports.
+from data_store import Relax_data_store; ds = Relax_data_store()
 from lib.geometry.rotations import axis_angle_to_R
 
 # Base module import.
-from generate_base import Main
+from test_suite.shared_data.frame_order.cam.generate_base import Main
 
 
 class Generate(Main):
     # The number of structures.
-    ANGLE = 60
-    INC = ANGLE / 1000000.0
-    N = int(ANGLE / INC) + 1
+    TILT_ANGLE = 60
+    N = 10
+    INC = TILT_ANGLE / float(N - 1)
 
     def __init__(self):
         """Model specific setup."""
@@ -40,4 +41,4 @@
 
 # Execute the code.
 generate = Generate()
-generate.run()
+generate.run(save_path=ds.tmpdir)




Related Messages


Powered by MHonArc, Updated Fri Jan 17 12:00:01 2014