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

Source Code for Module test_suite.relax_fit

  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 Relax_fit:
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 # Sparky loading test. 33 if test_name == 'read_sparky': 34 # The name of the test. 35 self.name = "Loading of Sparky peak heights" 36 37 # The test. 38 self.test = self.read_sparky
39 40
41 - def read_sparky(self, run):
42 """The Sparky peak height loading test.""" 43 44 # Arguments. 45 self.run = run 46 47 # Load the original state. 48 self.relax.interpreter._State.load(file='rx.save', dir=sys.path[-1] + '/test_suite/data/curve_fitting') 49 50 # Create the run. 51 self.relax.generic.runs.create(self.run, "mf") 52 53 # Load the Lupin Ap4Aase sequence. 54 self.relax.interpreter._Sequence.read(self.run, file="Ap4Aase.seq", dir=sys.path[-1] + "/test_suite/data") 55 56 # Read the peak heights. 57 self.relax.interpreter._Relax_fit.read(self.run, file="T2_ncyc1_ave.list", dir=sys.path[-1] + "/test_suite/data/curve_fitting", relax_time=0.0176) 58 59 60 # Test the integrity of the data. 61 ################################# 62 63 # Print out. 64 print "\nTesting the integrity of the loaded data.\n" 65 66 # Loop over the residues of the original data. 67 for i in xrange(len(self.relax.data.res['rx'])): 68 # Aliases 69 orig_data = self.relax.data.res['rx'][i] 70 new_data = self.relax.data.res[self.run][i] 71 72 # Residue alias. 73 self.orig_res = `orig_data.num` + orig_data.name 74 self.new_res = `new_data.num` + new_data.name 75 76 # Residue numbers. 77 if orig_data.num != new_data.num: 78 self.print_error('residue numbers') 79 return 80 81 # Residue names. 82 if orig_data.name != new_data.name: 83 self.print_error('residue names') 84 return 85 86 # Skip unselected residues. 87 if not orig_data.select: 88 continue 89 90 # The intensity. 91 if orig_data.intensities[0][0] != new_data.intensities[0][0]: 92 self.print_error('intensities') 93 return 94 95 # Success. 96 print "The data structures have been created successfully." 97 return 1
98 99
100 - def print_error(self, name):
101 """Function for printing a residue mismatch.""" 102 103 print "The " + name + " of " + self.orig_res + " and " + self.new_res + " do not match."
104