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

Source Code for Module test_suite.diffusion_tensor

  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 Diffusion_tensor:
27 - def __init__(self, relax, test_name):
28 """Class for testing various aspects specific to the diffusion tensor.""" 29 30 self.relax = relax 31 32 # Initialisation test. 33 if test_name == 'init': 34 self.name = "The user function diffusion_tensor.init()" 35 self.test = self.init 36 37 # Deletion test. 38 if test_name == 'delete': 39 self.name = "The user function diffusion_tensor.delete()" 40 self.test = self.delete 41 42 # Display test. 43 if test_name == 'display': 44 self.name = "The user function diffusion_tensor.display()" 45 self.test = self.display 46 47 # Copy test. 48 if test_name == 'copy': 49 self.name = "The user function diffusion_tensor.copy()" 50 self.test = self.copy
51 52
53 - def copy(self, run):
54 """The copy test.""" 55 56 # Initialise. 57 self.initialise_tensors() 58 59 # Create three additional runs for copying the spherical, spheroidal, and ellipsoidal diffusion data. 60 self.relax.generic.runs.create('sphere2', 'mf') 61 self.relax.generic.runs.create('spheroid2', 'mf') 62 self.relax.generic.runs.create('ellipsoid2', 'mf') 63 64 # Delete the data. 65 self.relax.interpreter._Diffusion_tensor.copy('sphere', 'sphere2') 66 self.relax.interpreter._Diffusion_tensor.copy('spheroid', 'spheroid2') 67 self.relax.interpreter._Diffusion_tensor.copy('ellipsoid', 'ellipsoid2') 68 69 # Success. 70 return 1
71 72
73 - def delete(self, run):
74 """The deletion test.""" 75 76 # Initialise. 77 self.initialise_tensors() 78 79 # Delete the data. 80 self.relax.interpreter._Diffusion_tensor.delete('sphere') 81 self.relax.interpreter._Diffusion_tensor.delete('spheroid') 82 self.relax.interpreter._Diffusion_tensor.delete('ellipsoid') 83 84 # Success. 85 return 1
86 87
88 - def display(self, run):
89 """The display test.""" 90 91 # Initialise some tensors. 92 self.initialise_tensors() 93 94 # Display the data. 95 self.relax.interpreter._Diffusion_tensor.display('sphere') 96 self.relax.interpreter._Diffusion_tensor.display('spheroid') 97 self.relax.interpreter._Diffusion_tensor.display('ellipsoid') 98 99 # Success. 100 return 1
101 102
103 - def init(self, run):
104 """The initialisation test.""" 105 106 # Initialise some tensors. 107 self.initialise_tensors() 108 109 # Success. 110 return 1
111 112
113 - def initialise_tensors(self):
114 """Fucntion for initialising a spherical, spheroidal, and ellipsoidal diffusion tensor.""" 115 116 # Create three runs for spherical, spheroidal, and ellipsoidal diffusion. 117 self.relax.generic.runs.create('sphere', 'mf') 118 self.relax.generic.runs.create('spheroid', 'mf') 119 self.relax.generic.runs.create('ellipsoid', 'mf') 120 121 # Initialise some data. 122 self.relax.interpreter._Diffusion_tensor.init('sphere', 10e-9, fixed=1) 123 self.relax.interpreter._Diffusion_tensor.init('spheroid', (2e-8, 1.3, 60-360, 290), param_types=2, spheroid_type='prolate', fixed=1) 124 self.relax.interpreter._Diffusion_tensor.init('ellipsoid', (9e-8, 5e6, 0.3, 60+360, 290, 100), fixed=0)
125