mailr4212 - /branches/consistency_tests_1.3/test_suite/system_tests/consistency_tests.py


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

Header


Content

Posted by sebastien . morin . 1 on December 18, 2007 - 21:44:
Author: semor
Date: Tue Dec 18 21:44:26 2007
New Revision: 4212

URL: http://svn.gna.org/viewcvs/relax?rev=4212&view=rev
Log:
Synced the consistency_tests test from the jw_mapping test.

This file was first created as a copy of the jw_mapping test but was never 
updated. Now, the two 
files are identical. It will thus be easier to modify this new version which 
incorporates many 
aspects of the 1.3 line redesign.


Modified:
    
branches/consistency_tests_1.3/test_suite/system_tests/consistency_tests.py

Modified: 
branches/consistency_tests_1.3/test_suite/system_tests/consistency_tests.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/consistency_tests_1.3/test_suite/system_tests/consistency_tests.py?rev=4212&r1=4211&r2=4212&view=diff
==============================================================================
--- 
branches/consistency_tests_1.3/test_suite/system_tests/consistency_tests.py 
(original)
+++ 
branches/consistency_tests_1.3/test_suite/system_tests/consistency_tests.py 
Tue Dec 18 21:44:26 2007
@@ -1,6 +1,7 @@
 
###############################################################################
 #                                                                            
 #
 # Copyright (C) 2006 Chris MacRaild                                          
 #
+# Copyright (C) 2007 Edward d'Auvergne                                       
 #
 #                                                                            
 #
 # This file is part of the program relax.                                    
 #
 #                                                                            
 #
@@ -25,7 +26,8 @@
 
 # relax module imports.
 from data import Data as relax_data_store
-
+from generic_fns.selection import residue_loop
+from physical_constants import N15_CSA, NH_BOND_LENGTH
 
 # The relax data storage object.
 
@@ -40,7 +42,7 @@
 
         # Results reading test.
         if test_name == 'set':
-            
+
             # The name of the test.
             self.name = "The user function value.set()"
 
@@ -49,7 +51,7 @@
 
         # Spectral density calculation test.
         if test_name == 'calc':
-            
+
             # The name of the test.
             self.name = "Spectral density calculation"
 
@@ -57,51 +59,51 @@
             self.test = self.calc
 
 
-    def calc(self, run):
+    def calc(self, pipe):
         """The spectral density calculation test."""
 
         # Arguments.
-        self.run = run
+        self.pipe = pipe
 
         # Setup.
         self.calc_setup()
-        
+
         # Try the reduced spectral density mapping.
-        self.relax.interpreter._Minimisation.calc(self.run)
-        
+        self.relax.interpreter._Minimisation.calc()
+
         # Success.
         return self.calc_integrity()
-        
+
 
     def calc_integrity(self):
-        
+
         # Correct jw values:
-        j0 = [4.0958793960056238e-09, 3.7976266046729745e-09]
-        jwx = [1.85720953886864e-10, 1.6450121628270092e-10]
+        j0 = [4.0703318681008998e-09, 3.7739393907014834e-09]
+        jwx = [1.8456254300773903e-10, 1.6347516082378241e-10]
         jwh = [1.5598167512718012e-12, 2.9480536599037041e-12]
 
         # Loop over residues.
-        for index,residue in enumerate(relax_data_store.res[self.run]):
+        for res in residue_loop:
             # Residues -2 and -1 have data.
-            if index == 0 or index == 1:
-                if not relax_data_store.res[self.run][index].select:
-                    print 'Residue', 
relax_data_store.res[self.run][index].num, 'unexpectedly not selected'
+            if res.num == -2 or res.num == -1:
+                if not res.spin[0].select:
+                    print 'Residue', res.num, 'unexpectedly not selected'
                     return
 
-                if abs(relax_data_store.res[self.run][index].j0 - j0[index]) 
j0[index]/1e6:
-                    print 'Error in residue', 
relax_data_store.res[self.run][index].num, 'j0 calculated value'
+                if abs(res.spin[0].j0 - j0[index]) > j0[index]/1e6:
+                    print 'Error in residue', res.num, 'j0 calculated value'
                     return
-                if abs(relax_data_store.res[self.run][index].jwh - 
jwh[index]) > jwh[index]/1e6:
-                    print 'Error in residue', 
relax_data_store.res[self.run][index].num, 'jwh calculated value'
+                if abs(res.spin[0].jwh - jwh[index]) > jwh[index]/1e6:
+                    print 'Error in residue', res.num, 'jwh calculated value'
                     return
-                if abs(relax_data_store.res[self.run][index].jwx - 
jwx[index]) > jwx[index]/1e6:
-                    print 'Error in residue', 
relax_data_store.res[self.run][index].num, 'jwx calculated value'
+                if abs(res.spin[0].jwx - jwx[index]) > jwx[index]/1e6:
+                    print 'Error in residue', res.num, 'jwx calculated value'
                     return
 
             # Other residues have insufficient data.
             else:
-                if relax_data_store.res[self.run][index].select:
-                    print 'Residue', 
relax_data_store.res[self.run][index].num, 'unexpectedly selected'
+                if res.spin[0].select:
+                    print 'Residue', res.num, 'unexpectedly selected'
                     return
 
         # Success.
@@ -120,52 +122,49 @@
         dataTypes = [('NOE', '600', 600.0e6),
                      ('R1', '600', 600.0e6),
                      ('R2', '600', 600.0e6)]
-        
-        # Create the run.
-        self.relax.generic.runs.create(self.run, 'jw')
+
+        # Create the data pipe.
+        self.relax.interpreter._Pipe.create(self.pipe, 'jw')
 
         # Read the sequence.
-        self.relax.interpreter._Sequence.read(self.run, file='test_seq', 
dir=sys.path[-1] + '/test_suite/system_tests/data')
+        self.relax.interpreter._Sequence.read(file='test_seq', 
dir=sys.path[-1] + '/test_suite/system_tests/data')
 
         # Read the data.
         for dataSet in xrange(len(dataPaths)):
-            self.relax.interpreter._Relax_data.read(self.run, 
dataTypes[dataSet][0], dataTypes[dataSet][1], dataTypes[dataSet][2], 
dataPaths[dataSet])
+            self.relax.interpreter._Relax_data.read(dataTypes[dataSet][0], 
dataTypes[dataSet][1], dataTypes[dataSet][2], dataPaths[dataSet])
 
         # Nuclei type.
         self.relax.interpreter._Nuclei.nuclei('N')
 
         # Set r and csa.
-        self.relax.interpreter._Value.set(self.run, 1.02 * 1e-10, 
'bond_length')
-        self.relax.interpreter._Value.set(self.run, -170 * 1e-6, 'csa')
+        self.relax.interpreter._Value.set(NH_BOND_LENGTH, 'bond_length')
+        self.relax.interpreter._Value.set(N15_CSA, 'csa')
 
         # Select the frequency.
-        self.relax.interpreter._Jw_mapping.set_frq(self.run, frq=600.0 * 1e6)
+        self.relax.interpreter._Jw_mapping.set_frq(frq=600.0 * 1e6)
 
 
-    def set_value(self, run):
+    def set_value(self, pipe):
         """The value.set test."""
 
-        # Arguments.
-        self.run = run
-
-        # Create the run.
-        self.relax.generic.runs.create(self.run, 'jw')
+        # Create the data pipe.
+        self.relax.interpreter._Pipe.create(pipe, 'jw')
 
         # Read the sequence.
-        self.relax.interpreter._Sequence.read(self.run, file='test_seq', 
dir=sys.path[-1] + '/test_suite/system_tests/data')
+        self.relax.interpreter._Sequence.read(file='test_seq', 
dir=sys.path[-1] + '/test_suite/system_tests/data')
 
         # Try to set the values.
-        bond_length = 1.02 * 1e-10
-        csa = -170 * 1e-6
-        self.relax.interpreter._Value.set(self.run, bond_length, 
'bond_length')
-        self.relax.interpreter._Value.set(self.run, csa, 'csa')
+        bond_length = NH_BOND_LENGTH
+        csa = N15_CSA
+        self.relax.interpreter._Value.set(bond_length, 'bond_length')
+        self.relax.interpreter._Value.set(csa, 'csa')
 
         # Test values.
-        for i in xrange( len(relax_data_store.res[self.run]) ):
-            if relax_data_store.res[self.run][i].r != bond_length:
+        for i in xrange(len(relax_data_store[pipe].mol[0].res)):
+            if relax_data_store[pipe].mol[0].res[i].spin[0].r != bond_length:
                 print 'Value of bond_length has not been set correctly'
                 return
-            if relax_data_store.res[self.run][i].csa != csa:
+            if relax_data_store[pipe].mol[0].res[i].spin[0].csa != csa:
                 print 'Value of csa has not been set correctly'
                 return
 




Related Messages


Powered by MHonArc, Updated Tue Dec 18 22:20:19 2007