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

Source Code for Module test_suite.system_tests.noe

  1  ############################################################################### 
  2  #                                                                             # 
  3  # Copyright (C) 2006-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  # Python module imports. 
 23  from os import sep 
 24  from tempfile import mktemp 
 25   
 26  # relax module imports. 
 27  from data_store import Relax_data_store; ds = Relax_data_store() 
 28  from pipe_control.mol_res_spin import spin_loop 
 29  from status import Status; status = Status() 
 30  from test_suite.system_tests.base_classes import SystemTestCase 
 31   
 32   
33 -class Noe(SystemTestCase):
34 """Class for testing various aspects specific to the NOE analysis.""" 35
36 - def setUp(self):
37 """Set up for all the functional tests.""" 38 39 # Create the data pipe. 40 self.interpreter.pipe.create('noe', 'noe') 41 42 # Create a temporary file. 43 ds.tmpfile = mktemp()
44 45
46 - def test_noe_analysis(self):
47 """Test the NOE analysis.""" 48 49 # Execute the script. 50 self.script_exec(status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'noe.py') 51 52 # The real data. 53 sat = [5050.0, 51643.0, 53663.0, -65111.0, -181131.0, -105322.0] 54 ref = [148614.0, 166842.0, 128690.0, 99566.0, 270047.0, 130959.0] 55 noe = [0.033980647852826784, 0.30953237194471417, 0.4169943274535706, -0.6539481349054899, -0.6707387973204665, -0.8042364404126482] 56 noe_err = [0.02020329903276632, 0.2320024671657343, 0.026067523940084526, 0.038300618865378507, 0.014260663438353431, 0.03183614777183591] 57 58 # Check the data. 59 i = 0 60 for spin in spin_loop(): 61 # Skip deselected spins. 62 if not spin.select: 63 continue 64 65 # Check the intensity data. 66 self.assertEqual(sat[i], spin.intensities['sat_ave']) 67 self.assertEqual(ref[i], spin.intensities['ref_ave']) 68 69 # Check the NOE data. 70 self.assertEqual(noe[i], spin.noe) 71 self.assertAlmostEqual(noe_err[i], spin.noe_err) 72 73 # Increment the spin index. 74 i += 1 75 76 # The real Grace file data. 77 data = [ 78 '@version 50121\n', 79 '@page size 842, 595\n', 80 '@with g0\n', 81 '@ view 0.15, 0.15, 1.28, 0.85\n', 82 '@ xaxis label "Residue number"\n', 83 '@ xaxis label char size 1.00\n', 84 '@ xaxis tick major size 0.50\n', 85 '@ xaxis tick major linewidth 0.5\n', 86 '@ xaxis tick minor linewidth 0.5\n', 87 '@ xaxis tick minor size 0.25\n', 88 '@ xaxis ticklabel char size 0.70\n', 89 '@ yaxis label "\\qNOE\\Q"\n', 90 '@ yaxis label char size 1.00\n', 91 '@ yaxis tick major size 0.50\n', 92 '@ yaxis tick major linewidth 0.5\n', 93 '@ yaxis tick minor linewidth 0.5\n', 94 '@ yaxis tick minor size 0.25\n', 95 '@ yaxis ticklabel char size 0.70\n', 96 '@ legend off\n', 97 '@ frame linewidth 0.5\n', 98 '@ s0 symbol 1\n', 99 '@ s0 symbol size 0.45\n', 100 '@ s0 symbol linewidth 0.5\n', 101 '@ s0 errorbar size 0.5\n', 102 '@ s0 errorbar linewidth 0.5\n', 103 '@ s0 errorbar riser linewidth 0.5\n', 104 '@ s0 legend "N spins"\n', 105 '@ s1 symbol 2\n', 106 '@ s1 symbol size 0.45\n', 107 '@ s1 symbol linewidth 0.5\n', 108 '@ s1 errorbar size 0.5\n', 109 '@ s1 errorbar linewidth 0.5\n', 110 '@ s1 errorbar riser linewidth 0.5\n', 111 '@ s1 legend "NE1 spins"\n', 112 '@target G0.S0\n', 113 '@type xydy\n', 114 '4 0.033980647852827 0.020203299032766 \n', 115 '5 0.309532371944714 0.232002467165734 \n', 116 '6 0.416994327453571 0.026067523940085 \n', 117 '40 -0.653948134905490 0.038300618865379 \n', 118 '55 -0.804236440412648 0.031836147771836 \n', 119 '&\n', 120 '@target G0.S1\n', 121 '@type xydy\n', 122 '40 -0.670738797320466 0.014260663438353 \n', 123 '&\n', 124 '@with g0\n', 125 '@autoscale\n' 126 ] 127 128 # Check the Grace file. 129 file = open(ds.tmpfile) 130 lines = file.readlines() 131 file.close() 132 for i in range(len(lines)): 133 print(" '%s\\n'," % lines[i][:-1].replace('"', "\\\"")) 134 for i in range(len(lines)): 135 self.assertEqual(data[i], lines[i])
136