Package test_suite :: Module generic
[hide private]
[frames] | no frames]

Source Code for Module test_suite.generic

 1  ############################################################################### 
 2  #                                                                             # 
 3  # Copyright (C) 2006 Edward d'Auvergne                                        # 
 4  #                                                                             # 
 5  # This file is part of the program relax.                                     # 
 6  #                                                                             # 
 7  # relax 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 2 of the License, or           # 
10  # (at your option) any later version.                                         # 
11  #                                                                             # 
12  # relax 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 relax; if not, write to the Free Software                        # 
19  # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA   # 
20  #                                                                             # 
21  ############################################################################### 
22   
23  import sys 
24   
25   
26 -class Generic:
27 - def __init__(self, relax, test_name):
28 """Class for testing various aspects specific to relaxation curve-fitting.""" 29 30 self.relax = relax 31 32 # Value difference test. 33 if test_name == 'value_diff': 34 # The name of the test. 35 self.name = "S2 difference stored in a new run." 36 37 # The test. 38 self.test = self.value_diff
39 40
41 - def value_diff(self, run):
42 """The test of storing an S2 difference in a new run.""" 43 44 # Arguments. 45 self.run = run 46 47 # Create three runs. 48 self.relax.interpreter._Run.create('orig1', "mf") 49 self.relax.interpreter._Run.create('orig2', "mf") 50 self.relax.interpreter._Run.create('new', "mf") 51 52 # Load the Lupin Ap4Aase sequence. 53 self.relax.interpreter._Sequence.read('orig1', file="Ap4Aase.seq", dir=sys.path[-1] + "/test_suite/data") 54 self.relax.interpreter._Sequence.read('orig2', file="Ap4Aase.seq", dir=sys.path[-1] + "/test_suite/data") 55 self.relax.interpreter._Sequence.read('new', file="Ap4Aase.seq", dir=sys.path[-1] + "/test_suite/data") 56 57 # Only select residue 8. 58 self.relax.interpreter._Select.res('orig1', num=8, change_all=1) 59 self.relax.interpreter._Select.res('orig2', num=8, change_all=1) 60 self.relax.interpreter._Select.res('new', num=8, change_all=1) 61 62 # Set two order parameter values. 63 self.relax.interpreter._Value.set('orig1', 0.9, 'S2', res_num=8) 64 self.relax.interpreter._Value.set('orig2', 0.7, 'S2', res_num=8) 65 66 # Calculate the difference and assign it to residue 8 (located in position 7). 67 diff = self.relax.data.res['orig1'][7].s2 - self.relax.data.res['orig2'][7].s2 68 self.relax.interpreter._Value.set('new', diff, 'S2', res_num=8) 69 70 # Test if the difference is 0.2! 71 if abs(self.relax.data.res['new'][7].s2 - 0.2) > 0.00001: 72 print "The difference of '" + `diff` + "' should be equal to 0.2." 73 return 74 75 # Success. 76 else: 77 return 1
78