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

Source Code for Module test_suite.system_tests.jw_mapping

  1  ############################################################################### 
  2  #                                                                             # 
  3  # Copyright (C) 2006 Chris MacRaild                                           # 
  4  # Copyright (C) 2007-2012 Edward d'Auvergne                                   # 
  5  #                                                                             # 
  6  # This file is part of the program relax.                                     # 
  7  #                                                                             # 
  8  # relax is free software; you can redistribute it and/or modify               # 
  9  # it under the terms of the GNU General Public License as published by        # 
 10  # the Free Software Foundation; either version 2 of the License, or           # 
 11  # (at your option) any later version.                                         # 
 12  #                                                                             # 
 13  # relax is distributed in the hope that it will be useful,                    # 
 14  # but WITHOUT ANY WARRANTY; without even the implied warranty of              # 
 15  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               # 
 16  # GNU General Public License for more details.                                # 
 17  #                                                                             # 
 18  # You should have received a copy of the GNU General Public License           # 
 19  # along with relax; if not, write to the Free Software                        # 
 20  # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA   # 
 21  #                                                                             # 
 22  ############################################################################### 
 23   
 24  # Python module imports. 
 25  from os import sep 
 26  import sys 
 27   
 28  # relax module imports. 
 29  from base_classes import SystemTestCase 
 30  from data import Relax_data_store; ds = Relax_data_store() 
 31  from generic_fns.mol_res_spin import residue_loop 
 32  from physical_constants import N15_CSA, NH_BOND_LENGTH 
 33  from status import Status; status = Status() 
 34   
 35   
36 -class Jw(SystemTestCase):
37 """Class for testing various aspects specific to reduced spectral density mapping.""" 38
39 - def setUp(self):
40 """Set up for all the functional tests.""" 41 42 # Create the data pipe. 43 self.interpreter.pipe.create('jw', 'jw')
44 45
46 - def test_calc(self):
47 """The spectral density calculation test.""" 48 49 # Data directory. 50 dir = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'jw_mapping'+sep 51 52 # The data. 53 ri_ids = ['NOE_600', 'R1_600', 'R2_600'] 54 ri_type = ['NOE', 'R1', 'R2'] 55 frq = [600e6]*3 56 data_paths = [dir + 'noe.dat', dir + 'R1.dat', dir + 'R2.dat'] 57 58 # Correct jw values: 59 j0 = [4.0703318681008998e-09, 3.7739393907014834e-09] 60 jwx = [1.8456254300773903e-10, 1.6347516082378241e-10] 61 jwh = [1.5598167512718012e-12, 2.9480536599037041e-12] 62 63 # Read the sequence. 64 self.interpreter.sequence.read(file='test_seq', dir=status.install_path + sep+'test_suite'+sep+'shared_data', res_num_col=1, res_name_col=2) 65 66 # Read the data. 67 for i in xrange(len(ri_ids)): 68 self.interpreter.relax_data.read(ri_id=ri_ids[i], ri_type=ri_type[i], frq=frq[i], file=data_paths[i], res_num_col=1, res_name_col=2, data_col=3, error_col=4) 69 70 # Set r, csa, heteronucleus type, and proton type. 71 self.interpreter.value.set(NH_BOND_LENGTH, 'r') 72 self.interpreter.value.set(N15_CSA, 'csa') 73 self.interpreter.value.set('15N', 'heteronuc_type') 74 self.interpreter.value.set('1H', 'proton_type') 75 76 # Select the frequency. 77 self.interpreter.jw_mapping.set_frq(frq=600.0 * 1e6) 78 79 # Try the reduced spectral density mapping. 80 self.interpreter.calc() 81 82 # Loop over residues. 83 index = 0 84 for res in residue_loop(): 85 # Residues -2 and -1 have data. 86 if res.num == -2 or res.num == -1: 87 self.assert_(res.spin[0].select) 88 self.assertAlmostEqual(res.spin[0].j0, j0[index]) 89 self.assertAlmostEqual(res.spin[0].jwh, jwh[index]) 90 self.assertAlmostEqual(res.spin[0].jwx, jwx[index]) 91 index = index + 1 92 93 # Other residues have insufficient data. 94 else: 95 self.assert_(not res.spin[0].select)
96 97
98 - def test_set_value(self):
99 """The user function value.set().""" 100 101 # Read the sequence. 102 self.interpreter.sequence.read(file='test_seq', dir=status.install_path + sep+'test_suite'+sep+'shared_data', res_num_col=1, res_name_col=2) 103 104 # Try to set the values. 105 bond_length = NH_BOND_LENGTH 106 csa = N15_CSA 107 self.interpreter.value.set(bond_length, 'r') 108 self.interpreter.value.set(csa, 'csa') 109 110 # Loop over residues. 111 for res in residue_loop(): 112 self.assertEqual(res.spin[0].r, NH_BOND_LENGTH) 113 self.assertEqual(res.spin[0].csa, N15_CSA)
114 115
116 - def test_mapping(self):
117 """Test a complete jw mapping run using a script.""" 118 119 # Execute the script. 120 self.interpreter.run(script_file=status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'jw_mapping.py')
121