mailr20655 - in /trunk/test_suite/system_tests: __init__.py chemical_shift.py


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

Header


Content

Posted by edward on August 21, 2013 - 10:28:
Author: bugman
Date: Wed Aug 21 10:28:17 2013
New Revision: 20655

URL: http://svn.gna.org/viewcvs/relax?rev=20655&view=rev
Log:
Created the Chemical_shift.test_read_sparky system test for the reading of 
chemical shifts.

This is for the reading of shifts from a Sparky peak list.  It tests the 
currently non-existent
chemical_shift.read user function.


Added:
    trunk/test_suite/system_tests/chemical_shift.py
Modified:
    trunk/test_suite/system_tests/__init__.py

Modified: trunk/test_suite/system_tests/__init__.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/test_suite/system_tests/__init__.py?rev=20655&r1=20654&r2=20655&view=diff
==============================================================================
--- trunk/test_suite/system_tests/__init__.py (original)
+++ trunk/test_suite/system_tests/__init__.py Wed Aug 21 10:28:17 2013
@@ -35,6 +35,7 @@
 from test_suite.system_tests.angles import Angles
 from test_suite.system_tests.bmrb import Bmrb
 from test_suite.system_tests.bruker import Bruker
+from test_suite.system_tests.chemical_shift import Chemical_shift
 from test_suite.system_tests.consistency_tests import Ct
 from test_suite.system_tests.dasha import Dasha
 from test_suite.system_tests.diffusion_tensor import Diffusion_tensor
@@ -71,6 +72,7 @@
            'angles',
            'bmrb',
            'bruker',
+           'chemical_shift'
            'consistency_tests',
            'dasha'
            'diffusion_tensor',
@@ -159,6 +161,7 @@
             suite_array.append(TestLoader().loadTestsFromTestCase(Bmrb))
             suite_array.append(TestLoader().loadTestsFromTestCase(Bruker))
             suite_array.append(TestLoader().loadTestsFromTestCase(Angles))
+            
suite_array.append(TestLoader().loadTestsFromTestCase(Chemical_shift))
             suite_array.append(TestLoader().loadTestsFromTestCase(Ct))
             suite_array.append(TestLoader().loadTestsFromTestCase(Dasha))
             
suite_array.append(TestLoader().loadTestsFromTestCase(Diffusion_tensor))

Added: trunk/test_suite/system_tests/chemical_shift.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/test_suite/system_tests/chemical_shift.py?rev=20655&view=auto
==============================================================================
--- trunk/test_suite/system_tests/chemical_shift.py (added)
+++ trunk/test_suite/system_tests/chemical_shift.py Wed Aug 21 10:28:17 2013
@@ -1,0 +1,72 @@
+###############################################################################
+#                                                                            
 #
+# Copyright (C) 2013 Edward d'Auvergne                                       
 #
+#                                                                            
 #
+# This file is part of the program relax (http://www.nmr-relax.com).         
 #
+#                                                                            
 #
+# This program is free software: you can redistribute it and/or modify       
 #
+# it under the terms of the GNU General Public License as published by       
 #
+# the Free Software Foundation, either version 3 of the License, or          
 #
+# (at your option) any later version.                                        
 #
+#                                                                            
 #
+# This program is distributed in the hope that it will be useful,            
 #
+# but WITHOUT ANY WARRANTY; without even the implied warranty of             
 #
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the              
 #
+# GNU General Public License for more details.                               
 #
+#                                                                            
 #
+# You should have received a copy of the GNU General Public License          
 #
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.      
 #
+#                                                                            
 #
+###############################################################################
+
+# Module docstring.
+"""The module for the system tests for chemical shift support in relax."""
+
+
+# Python module imports.
+from os import sep
+
+# relax module imports.
+from pipe_control.mol_res_spin import spin_loop
+from status import Status; status = Status()
+from test_suite.system_tests.base_classes import SystemTestCase
+
+
+class Chemical_shift(SystemTestCase):
+    """System test class for checking the handling of chemical shifts."""
+
+
+    def setUp(self):
+        """Set up for all the system tests."""
+
+        # Create the data pipe.
+        self.interpreter.pipe.create('cs', 'mf')
+
+
+    def test_read_sparky(self):
+        """Test the reading of chemical shifts from a Sparky peak list."""
+
+        # Create the sequence data, and name the spins.
+        for res_num in [3, 4, 5, 6, 40]:
+            self.interpreter.spin.create(res_num=res_num, spin_name='N')
+            self.interpreter.spin.create(res_num=res_num, spin_name='H')
+        self.interpreter.spin.create(res_num=40, spin_name='NE1')
+        self.interpreter.spin.create(res_num=40, spin_name='HE1')
+
+        # Load the peak list.
+        path = status.install_path + 
sep+'test_suite'+sep+'shared_data'+sep+'peak_lists'
+        self.interpreter.chemical_shift.read(file='ref_ave.list', dir=path)
+
+        # Test the data.
+        cs = [122.454, 8.397, 111.978, 8.720, 115.069, 8.177, 120.910, 
8.813, 123.335, 8.005, 130.204, 10.294]
+        i = 0
+        for spin in spin_loop():
+            # No data.
+            if i > 12:
+                self.assert_(not hasattr(spin, 'chemical_shift'))
+
+            # Check the shift.
+            self.assertEqual(spin.chemical_shift, cs[i])
+
+            # Increment the index.
+            i += 1




Related Messages


Powered by MHonArc, Updated Wed Aug 21 11:20:02 2013