Package test_suite :: Package system_tests :: Module rdc
[hide private]
[frames] | no frames]

Source Code for Module test_suite.system_tests.rdc

  1  ############################################################################### 
  2  #                                                                             # 
  3  # Copyright (C) 2011-2013 Edward d'Auvergne                                   # 
  4  #                                                                             # 
  5  # This file is part of the program relax (http://www.nmr-relax.com).          # 
  6  #                                                                             # 
  7  # This program is free software: you can redistribute it and/or modify        # 
  8  # it under the terms of the GNU General Public License as published by        # 
  9  # the Free Software Foundation, either version 3 of the License, or           # 
 10  # (at your option) any later version.                                         # 
 11  #                                                                             # 
 12  # This program is distributed in the hope that it will be useful,             # 
 13  # but WITHOUT ANY WARRANTY; without even the implied warranty of              # 
 14  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               # 
 15  # GNU General Public License for more details.                                # 
 16  #                                                                             # 
 17  # You should have received a copy of the GNU General Public License           # 
 18  # along with this program.  If not, see <http://www.gnu.org/licenses/>.       # 
 19  #                                                                             # 
 20  ############################################################################### 
 21   
 22  # Module docstring. 
 23  """RDC-based system tests.""" 
 24   
 25   
 26  # Python module imports. 
 27  from os import sep 
 28   
 29  # relax module imports. 
 30  from pipe_control.interatomic import interatomic_loop 
 31  from pipe_control.mol_res_spin import count_spins 
 32  from status import Status; status = Status() 
 33  from test_suite.system_tests.base_classes import SystemTestCase 
 34   
 35   
36 -class Rdc(SystemTestCase):
37 """Class for testing RDC operations.""" 38
39 - def test_rdc_copy(self):
40 """Test the operation of the rdc.copy user function.""" 41 42 # Create a data pipe. 43 self.interpreter.pipe.create('orig', 'N-state') 44 45 # Data directory. 46 dir = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'align_data'+sep 47 48 # Load the spins. 49 self.interpreter.sequence.read(file='tb.txt', dir=dir, spin_id_col=1) 50 self.interpreter.sequence.attach_protons() 51 self.interpreter.sequence.display() 52 53 # Load the RDCs. 54 self.interpreter.rdc.read(align_id='tb', file='tb.txt', dir=dir, spin_id1_col=1, spin_id2_col=2, data_col=3, error_col=4) 55 self.interpreter.sequence.display() 56 57 # The RDCs. 58 rdcs = [ -26.2501958629, 9.93081766942, 7.26317614156, -1.24840526981, 5.31803314334, 14.0362909456, 1.33652530397, -1.6021670281] 59 60 # Create a new data pipe by copying the old, then switch to it. 61 self.interpreter.pipe.copy(pipe_from='orig', pipe_to='new') 62 self.interpreter.pipe.switch(pipe_name='new') 63 64 # Delete the RDC data. 65 self.interpreter.rdc.delete() 66 67 # Copy the RDCs. 68 self.interpreter.rdc.copy(pipe_from='orig', align_id='tb') 69 70 # Checks. 71 self.assertEqual(count_spins(), 16) 72 self.assertEqual(len(cdp.interatomic), 8) 73 i = 0 74 for interatom in interatomic_loop(): 75 self.assertAlmostEqual(rdcs[i], interatom.rdc['tb']) 76 i += 1
77 78
79 - def test_rdc_load(self):
80 """Test for the loading of some RDC data with the spin ID format.""" 81 82 # Create a data pipe. 83 self.interpreter.pipe.create('test', 'N-state') 84 85 # Data directory. 86 dir = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'align_data'+sep 87 88 # Load the spins. 89 self.interpreter.sequence.read(file='tb.txt', dir=dir, spin_id_col=1) 90 self.interpreter.sequence.attach_protons() 91 self.interpreter.sequence.display() 92 93 # Load the RDCs. 94 self.interpreter.rdc.read(align_id='tb', file='tb.txt', dir=dir, spin_id1_col=1, spin_id2_col=2, data_col=3, error_col=4) 95 self.interpreter.sequence.display() 96 97 # The RDCs. 98 rdcs = [ -26.2501958629, 9.93081766942, 7.26317614156, -1.24840526981, 5.31803314334, 14.0362909456, 1.33652530397, -1.6021670281] 99 100 # Checks. 101 self.assertEqual(count_spins(), 16) 102 self.assertEqual(len(cdp.interatomic), 8) 103 i = 0 104 for interatom in interatomic_loop(): 105 self.assertAlmostEqual(rdcs[i], interatom.rdc['tb']) 106 i += 1
107