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

Source Code for Module test_suite.system_tests.model_free

   1  ############################################################################### 
   2  #                                                                             # 
   3  # Copyright (C) 2006-2012 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  # Python module imports. 
  24  from math import pi 
  25  import platform 
  26  import numpy 
  27  from os import sep 
  28  from re import search 
  29  from shutil import copytree 
  30  from tempfile import mkdtemp 
  31   
  32  # relax module imports. 
  33  from base_classes import SystemTestCase 
  34  from data import Relax_data_store; ds = Relax_data_store() 
  35  import dep_check 
  36  from generic_fns import pipes 
  37  from generic_fns.mol_res_spin import spin_loop 
  38  from physical_constants import N15_CSA, NH_BOND_LENGTH 
  39  from relax_io import DummyFileObject, open_read_file 
  40  from status import Status; status = Status() 
  41   
  42   
  43  # Get the platform/version information. 
  44  SYSTEM = platform.system() 
  45  RELEASE = platform.release() 
  46  VERSION = platform.version() 
  47  WIN32_VER = platform.win32_ver() 
  48  DIST = platform.dist() 
  49  ARCH = platform.architecture() 
  50  MACH = platform.machine() 
  51  PROC = platform.processor() 
  52  PY_VER = platform.python_version() 
  53  NUMPY_VER = numpy.__version__ 
  54  LIBC_VER = platform.libc_ver() 
  55   
  56  # Windows system name pain. 
  57  if SYSTEM == 'Windows' or SYSTEM == 'Microsoft': 
  58      # Set the system to 'Windows' no matter what. 
  59      SYSTEM = 'Windows' 
  60   
  61   
  62   
63 -class Mf(SystemTestCase):
64 """TestCase class for the functional tests of model-free analysis.""" 65
66 - def setUp(self):
67 """Set up for all the functional tests.""" 68 69 # Create the data pipe. 70 self.interpreter.pipe.create('mf', 'mf')
71 72
73 - def mesg_opt_debug(self, spin):
74 """Method for returning a string to help debug the minimisation. 75 76 @param spin: The SpinContainer of the optimised spin. 77 @type spin: SpinContainer instance 78 @return: The debugging string. 79 @rtype: str 80 """ 81 82 # Initialise the string. 83 string = 'Optimisation failure.\n\n' 84 85 # Create the string. 86 string = string + "%-18s%-25s\n" % ("System: ", SYSTEM) 87 string = string + "%-18s%-25s\n" % ("Release: ", RELEASE) 88 string = string + "%-18s%-25s\n" % ("Version: ", VERSION) 89 string = string + "%-18s%-25s\n" % ("Win32 version: ", (WIN32_VER[0] + " " + WIN32_VER[1] + " " + WIN32_VER[2] + " " + WIN32_VER[3])) 90 string = string + "%-18s%-25s\n" % ("Distribution: ", (DIST[0] + " " + DIST[1] + " " + DIST[2])) 91 string = string + "%-18s%-25s\n" % ("Architecture: ", (ARCH[0] + " " + ARCH[1])) 92 string = string + "%-18s%-25s\n" % ("Machine: ", MACH) 93 string = string + "%-18s%-25s\n" % ("Processor: ", PROC) 94 string = string + "%-18s%-25s\n" % ("Python version: ", PY_VER) 95 string = string + "%-18s%-25s\n" % ("Numpy version: ", NUMPY_VER) 96 string = string + "%-18s%-25s\n" % ("Libc version: ", (LIBC_VER[0] + " " + LIBC_VER[1])) 97 98 99 # Minimisation info. 100 string = string + '\n' 101 if spin.local_tm != None: 102 string = string + "%-15s %30.16g\n" % ('local_tm (ns):', spin.local_tm * 1e9) 103 if spin.s2 != None: 104 string = string + "%-15s %30.16g\n" % ('s2:', spin.s2) 105 if spin.s2f != None: 106 string = string + "%-15s %30.16g\n" % ('s2f:', spin.s2f) 107 if spin.s2s != None: 108 string = string + "%-15s %30.16g\n" % ('s2s:', spin.s2s) 109 if spin.te != None: 110 string = string + "%-15s %30.13g\n" % ('te (ps):', spin.te * 1e12) 111 if spin.tf != None: 112 string = string + "%-15s %30.13g\n" % ('tf (ps):', spin.tf * 1e12) 113 if spin.ts != None: 114 string = string + "%-15s %30.13g\n" % ('ts (ps):', spin.ts * 1e12) 115 if spin.rex != None: 116 string = string + "%-15s %30.17g\n" % ('rex:', spin.rex * (2.0 * pi * cdp.frq[cdp.ri_ids[0]])**2) 117 string = string + "%-15s %30.17g\n" % ('chi2:', spin.chi2) 118 string = string + "%-15s %30i\n" % ('iter:', spin.iter) 119 string = string + "%-15s %30i\n" % ('f_count:', spin.f_count) 120 string = string + "%-15s %30i\n" % ('g_count:', spin.g_count) 121 string = string + "%-15s %30i\n" % ('h_count:', spin.h_count) 122 string = string + "%-15s %30s\n" % ('warning:', spin.warning) 123 124 # Return the string. 125 return string
126 127
128 - def monte_carlo(self):
129 """Run Monte Carlo simulations for the optimised model-free model.""" 130 131 # Monte Carlo simulations. 132 self.interpreter.monte_carlo.setup(number=3) 133 self.interpreter.monte_carlo.create_data() 134 self.interpreter.monte_carlo.initial_values() 135 self.interpreter.minimise('newton') 136 #self.interpreter.eliminate() 137 self.interpreter.monte_carlo.error_analysis()
138 139
140 - def object_comparison(self, obj1=None, obj2=None, skip=None):
141 """Check if the contents of 2 objects are the same.""" 142 143 # The names are the same. 144 self.assertEqual(dir(obj1), dir(obj2)) 145 146 # Loop over the objects in the base objects. 147 for name in dir(obj1): 148 # Skip special objects. 149 if skip and name in skip: 150 continue 151 152 # Skip objects starting with '_'. 153 if search('^_', name): 154 continue 155 156 # Skip original class methods. 157 if name in list(obj1.__class__.__dict__.keys()): 158 continue 159 160 # Print out. 161 print(("\t" + name)) 162 163 # Get the sub-objects. 164 sub_obj1 = getattr(obj1, name) 165 sub_obj2 = getattr(obj2, name) 166 167 # Check that they are of the same type. 168 self.assertEqual(type(sub_obj1), type(sub_obj2)) 169 170 # Check that they are equal (converting to strings to avoid comparison nastiness). 171 self.assertEqual(str(sub_obj1), str(sub_obj2))
172 173
175 """Test catching bug #14872, the unicode string selection failure as submitted by Olivier Serve.""" 176 177 # Execute the script. 178 self.interpreter.run(script_file=status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'model_free'+sep+'bug_14872_unicode_selection.py')
179 180
182 """Test catching bug #14941, the local tm global model selection problem as submitted by Mikaela Stewart (mikaela dot stewart att gmail dot com).""" 183 184 # Execute the script. 185 self.interpreter.run(script_file=status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'model_free'+sep+'bug_14941_local_tm_global_selection.py')
186 187
188 - def test_bug_15050(self):
189 """Test catching bug #15050, 'PipeContainer' object has no attribute 'diff_tensor' error as submitted by Tiago Pais (https://web.archive.org/web/https://gna.org/users/tpais).""" 190 191 # Execute the script. 192 self.interpreter.run(script_file=status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'model_free'+sep+'bug_15050.py')
193 194
196 """Test catching bugs #12582, #12591 and #12607 as submitted by Chris Brosey.""" 197 198 # Execute the script. 199 self.interpreter.run(script_file=status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'model_free'+sep+'bugs_12582_12591_12607.py') 200 201 # Test for bug #12607 (S2 changes because it is in the grid search when it should not be). 202 self.assertNotEqual(cdp.mol[0].res[1].spin[0].s2, 1.0)
203 204
205 - def test_bug_18790(self):
206 """Test catching bug #18790, the negative relaxation data RelaxError reported by Vitaly Vostrikov.""" 207 208 # Execute the script. 209 self.interpreter.run(script_file=status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'model_free'+sep+'bug_18790_negative_error.py')
210 211
212 - def test_create_m4(self):
213 """Creating model m4 with parameters {S2, te, Rex} using model_free.create_model().""" 214 215 # Execute the script. 216 self.interpreter.run(script_file=status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'model_free'+sep+'create_m4.py') 217 218 # Test the model. 219 self.assertEqual(cdp.mol[0].res[1].spin[0].model, 'm4') 220 self.assertEqual(cdp.mol[0].res[1].spin[0].params, ['s2', 'te', 'rex'])
221 222
223 - def test_dauvergne_protocol(self):
224 """Check the execution of auto_analyses.dauvergne_protocol.""" 225 226 # Create a temporary directory for dumping files. 227 ds.tmpdir = mkdtemp() 228 229 # Execute the script. 230 self.interpreter.run(script_file=status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'model_free'+sep+'dauvergne_protocol.py') 231 232 # Check the diffusion tensor. 233 self.assertEqual(cdp.diff_tensor.type, 'sphere') 234 self.assertAlmostEqual(cdp.diff_tensor.tm, 1e-8) 235 self.assertEqual(cdp.diff_tensor.fixed, True) 236 237 # The global minimisation info. 238 self.assertAlmostEqual(cdp.chi2, 4e-19) 239 240 # The spin ID info. 241 mol_names = ["sphere_mol1"] * 9 242 res_names = ["GLY"] * 9 243 res_nums = range(1, 10) 244 spin_names = ["N"] * 9 245 spin_nums = numpy.array(range(9)) * 2 + 1 246 247 # Check the spin data. 248 i = 0 249 for spin, mol_name, res_num, res_name in spin_loop(full_info=True): 250 # The ID info. 251 self.assertEqual(mol_name, mol_names[i]) 252 self.assertEqual(res_name, res_names[i]) 253 self.assertEqual(res_num, res_nums[i]) 254 self.assertEqual(spin.name, spin_names[i]) 255 self.assertEqual(spin.num, spin_nums[i]) 256 257 # The data. 258 self.assertEqual(spin.select, True) 259 self.assertEqual(spin.fixed, False) 260 self.assertEqual(spin.proton_type, '1H') 261 self.assertEqual(spin.heteronuc_type, '15N') 262 self.assertEqual(spin.attached_proton, None) 263 self.assertEqual(spin.nucleus, None) 264 self.assertAlmostEqual(spin.r, 1.02 * 1e-10) 265 self.assertAlmostEqual(spin.csa, -172e-6) 266 267 # The model-free data. 268 self.assertEqual(spin.model, 'm2') 269 self.assertEqual(spin.equation, 'mf_orig') 270 self.assertEqual(len(spin.params), 2) 271 self.assertEqual(spin.params[0], 's2') 272 self.assertEqual(spin.params[1], 'te') 273 self.assertAlmostEqual(spin.s2, 0.8) 274 self.assertEqual(spin.s2f, None) 275 self.assertEqual(spin.s2s, None) 276 self.assertEqual(spin.local_tm, None) 277 self.assertAlmostEqual(spin.te, 20e-12) 278 self.assertEqual(spin.tf, None) 279 self.assertEqual(spin.ts, None) 280 self.assertEqual(spin.rex, None) 281 282 # The spin minimisation info. 283 self.assertEqual(spin.chi2, None) 284 self.assertEqual(spin.iter, None) 285 self.assertEqual(spin.f_count, None) 286 self.assertEqual(spin.g_count, None) 287 self.assertEqual(spin.h_count, None) 288 self.assertEqual(spin.warning, None) 289 290 # Increment the index. 291 i += 1
292 293
294 - def test_generate_ri(self):
295 """Back-calculate relaxation data.""" 296 297 # Execute the script. 298 self.interpreter.run(script_file=status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'model_free'+sep+'generate_ri.py')
299 300
301 - def test_latex_table(self):
302 """Test the creation of a LaTeX table of model-free results, mimicking the latex_mf_table.py sample script.""" 303 304 # Execute the script. 305 self.interpreter.run(script_file=status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'model_free'+sep+'latex_mf_table.py')
306 307
309 """Test the optimisation of the test set {tm=10, S2=0.8, te=40}.""" 310 311 # Setup the data pipe for optimisation. 312 self.interpreter.run(script_file=status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'model_free'+sep+'opt_setup_local_tm_10_S2_0_8_te_40.py') 313 314 # The proton frequencies in MHz. 315 frq = ['400', '500', '600', '700', '800', '900', '1000'] 316 317 # Load the relaxation data. 318 for i in range(len(frq)): 319 self.interpreter.relax_data.read('NOE_%s'%frq[i], 'NOE', float(frq[i])*1e6, 'noe.%s.out' % frq[i], dir=cdp.path, res_num_col=1, res_name_col=2, data_col=3, error_col=4) 320 self.interpreter.relax_data.read('R1_%s'%frq[i], 'R1', float(frq[i])*1e6, 'r1.%s.out' % frq[i], dir=cdp.path, res_num_col=1, res_name_col=2, data_col=3, error_col=4) 321 self.interpreter.relax_data.read('R2_%s'%frq[i], 'R2', float(frq[i])*1e6, 'r2.%s.out' % frq[i], dir=cdp.path, res_num_col=1, res_name_col=2, data_col=3, error_col=4) 322 323 # Set up the initial model-free parameter values (bypass the grid search for speed). 324 self.interpreter.value.set([15.0e-9, 1.0, 0.0], ['local_tm', 's2', 'te']) 325 326 # Minimise. 327 self.interpreter.minimise('newton', 'gmw', 'back') 328 329 # Alias the relevent spin container. 330 spin = cdp.mol[0].res[0].spin[0] 331 332 # Check the values. 333 self.value_test(spin, local_tm=10, s2=0.8, te=40, chi2=0.0)
334 335
337 """Test the optimisation of the test set {tm=10, S2=0.8, te=40}.""" 338 339 # Setup the data pipe for optimisation. 340 self.interpreter.run(script_file=status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'model_free'+sep+'opt_setup_local_tm_10_S2_0_8_te_40.py') 341 342 # The proton frequencies in MHz. 343 frq = ['400', '500', '600', '700', '800', '900', '1000'] 344 345 # Load the relaxation data. 346 for i in range(len(frq)): 347 self.interpreter.relax_data.read('NOE_%s'%frq[i], 'NOE', float(frq[i])*1e6, 'noe.%s.out' % frq[i], dir=cdp.path, res_num_col=1, res_name_col=2, data_col=3, error_col=4) 348 self.interpreter.relax_data.read('R1_%s'%frq[i], 'R1', float(frq[i])*1e6, 'r1.%s.out' % frq[i], dir=cdp.path, res_num_col=1, res_name_col=2, data_col=3, error_col=4) 349 self.interpreter.relax_data.read('R2_%s'%frq[i], 'R2', float(frq[i])*1e6, 'r2.%s.out' % frq[i], dir=cdp.path, res_num_col=1, res_name_col=2, data_col=3, error_col=4) 350 351 # Set up the initial model-free parameter values (bypass the grid search for speed). 352 self.interpreter.value.set([15.0e-9, 1.0, 0.0], ['local_tm', 's2', 'te']) 353 354 # Minimise. 355 self.interpreter.minimise('newton', 'gmw', 'back') 356 357 # Alias the relevent spin container. 358 spin = cdp.mol[0].res[0].spin[0] 359 360 # Check the values. 361 self.value_test(spin, local_tm=10, s2=0.8, te=40, chi2=0.0)
362 363
365 """Test the optimisation of the test set {tm=10, S2=0.8, te=40}.""" 366 367 # Setup the data pipe for optimisation. 368 self.interpreter.run(script_file=status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'model_free'+sep+'opt_setup_local_tm_10_S2_0_8_te_40.py') 369 370 # Load the relaxation data. 371 self.interpreter.relax_data.read('R2_700', 'R2', 700*1e6, 'r2.700.out', dir=cdp.path, res_num_col=1, res_name_col=2, data_col=3, error_col=4) 372 self.interpreter.relax_data.read('NOE_500', 'NOE', 500*1e6, 'noe.500.out', dir=cdp.path, res_num_col=1, res_name_col=2, data_col=3, error_col=4) 373 self.interpreter.relax_data.read('R1_500', 'R1', 500*1e6, 'r1.500.out', dir=cdp.path, res_num_col=1, res_name_col=2, data_col=3, error_col=4) 374 self.interpreter.relax_data.read('R1_900', 'R1', 900*1e6, 'r1.900.out', dir=cdp.path, res_num_col=1, res_name_col=2, data_col=3, error_col=4) 375 self.interpreter.relax_data.read('NOE_900', 'NOE', 900*1e6, 'noe.900.out', dir=cdp.path, res_num_col=1, res_name_col=2, data_col=3, error_col=4) 376 self.interpreter.relax_data.read('R2_900', 'R2', 900*1e6, 'r2.900.out', dir=cdp.path, res_num_col=1, res_name_col=2, data_col=3, error_col=4) 377 self.interpreter.relax_data.read('R1_700', 'R1', 700*1e6, 'r1.700.out', dir=cdp.path, res_num_col=1, res_name_col=2, data_col=3, error_col=4) 378 self.interpreter.relax_data.read('NOE_700', 'NOE', 700*1e6, 'noe.700.out', dir=cdp.path, res_num_col=1, res_name_col=2, data_col=3, error_col=4) 379 self.interpreter.relax_data.read('R2_500', 'R2', 500*1e6, 'r2.500.out', dir=cdp.path, res_num_col=1, res_name_col=2, data_col=3, error_col=4) 380 381 # Set up the initial model-free parameter values (bypass the grid search for speed). 382 self.interpreter.value.set([15.0e-9, 1.0, 0.0], ['local_tm', 's2', 'te']) 383 384 # Minimise. 385 self.interpreter.minimise('newton', 'gmw', 'back') 386 387 # Alias the relevent spin container. 388 spin = cdp.mol[0].res[0].spin[0] 389 390 # Check the values. 391 self.value_test(spin, local_tm=10, s2=0.8, te=40, chi2=0.0)
392 393
394 - def test_m0_grid(self):
395 """Test the optimisation of the m0 model-free model against the tm0 parameter grid.""" 396 397 # Initialise. 398 cdp._model = 'm0' 399 cdp._value_test = self.value_test 400 401 # Setup the data pipe for optimisation. 402 self.interpreter.run(script_file=status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'model_free'+sep+'opt_tm0_grid.py')
403 404
405 - def test_m0_grid_vs_m1(self):
406 """Test the optimisation of the m1 model-free model against the tm0 parameter grid.""" 407 408 # Initialise. 409 cdp._model = 'm1' 410 cdp._value_test = self.value_test 411 412 # Setup the data pipe for optimisation. 413 self.interpreter.run(script_file=status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'model_free'+sep+'opt_tm0_grid.py')
414 415
416 - def test_m0_grid_vs_m2(self):
417 """Test the optimisation of the m2 model-free model against the tm0 parameter grid.""" 418 419 # Initialise. 420 cdp._model = 'm2' 421 cdp._value_test = self.value_test 422 423 # Setup the data pipe for optimisation. 424 self.interpreter.run(script_file=status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'model_free'+sep+'opt_tm0_grid.py')
425 426
427 - def test_m0_grid_vs_m3(self):
428 """Test the optimisation of the m3 model-free model against the tm0 parameter grid.""" 429 430 # Initialise. 431 cdp._model = 'm3' 432 cdp._value_test = self.value_test 433 434 # Setup the data pipe for optimisation. 435 self.interpreter.run(script_file=status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'model_free'+sep+'opt_tm0_grid.py')
436 437
438 - def test_m0_grid_vs_m4(self):
439 """Test the optimisation of the m4 model-free model against the tm0 parameter grid.""" 440 441 # Initialise. 442 cdp._model = 'm4' 443 cdp._value_test = self.value_test 444 445 # Setup the data pipe for optimisation. 446 self.interpreter.run(script_file=status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'model_free'+sep+'opt_tm0_grid.py')
447 448
449 - def test_m1_grid(self):
450 """Test the optimisation of the m1 model-free model against the tm1 parameter grid.""" 451 452 # Initialise. 453 cdp._model = 'm1' 454 cdp._value_test = self.value_test 455 456 # Setup the data pipe for optimisation. 457 self.interpreter.run(script_file=status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'model_free'+sep+'opt_tm1_grid.py')
458 459
460 - def test_m2_grid(self):
461 """Test the optimisation of the m2 model-free model against the tm2 parameter grid.""" 462 463 # Initialise. 464 cdp._model = 'm2' 465 cdp._value_test = self.value_test 466 467 # Setup the data pipe for optimisation. 468 self.interpreter.run(script_file=status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'model_free'+sep+'opt_tm2_grid.py')
469 470
471 - def test_m2_grid_vs_m4(self):
472 """Test the optimisation of the m4 model-free model against the tm2 parameter grid.""" 473 474 # Initialise. 475 cdp._model = 'm4' 476 cdp._value_test = self.value_test 477 478 # Setup the data pipe for optimisation. 479 self.interpreter.run(script_file=status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'model_free'+sep+'opt_tm2_grid.py')
480 481
482 - def test_m3_grid(self):
483 """Test the optimisation of the m3 model-free model against the tm3 parameter grid.""" 484 485 # Initialise. 486 cdp._model = 'm3' 487 cdp._value_test = self.value_test 488 489 # Setup the data pipe for optimisation. 490 self.interpreter.run(script_file=status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'model_free'+sep+'opt_tm3_grid.py')
491 492
493 - def test_m4_grid(self):
494 """Test the optimisation of the m4 model-free model against the tm4 parameter grid.""" 495 496 # Initialise. 497 cdp._model = 'm4' 498 cdp._value_test = self.value_test 499 500 # Setup the data pipe for optimisation. 501 self.interpreter.run(script_file=status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'model_free'+sep+'opt_tm4_grid.py')
502 503
504 - def test_m5_grid(self):
505 """Test the optimisation of the m5 model-free model against the tm5 parameter grid.""" 506 507 # Initialise. 508 cdp._model = 'm5' 509 cdp._value_test = self.value_test 510 511 # Setup the data pipe for optimisation. 512 self.interpreter.run(script_file=status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'model_free'+sep+'opt_tm5_grid.py')
513 514
515 - def test_m6_grid(self):
516 """Test the optimisation of the m6 model-free model against the tm6 parameter grid.""" 517 518 # Initialise. 519 cdp._model = 'm6' 520 cdp._value_test = self.value_test 521 522 # Setup the data pipe for optimisation. 523 self.interpreter.run(script_file=status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'model_free'+sep+'opt_tm6_grid.py')
524 525
526 - def test_m7_grid(self):
527 """Test the optimisation of the m7 model-free model against the tm7 parameter grid.""" 528 529 # Initialise. 530 cdp._model = 'm7' 531 cdp._value_test = self.value_test 532 533 # Setup the data pipe for optimisation. 534 self.interpreter.run(script_file=status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'model_free'+sep+'opt_tm7_grid.py')
535 536
537 - def test_m8_grid(self):
538 """Test the optimisation of the m8 model-free model against the tm8 parameter grid.""" 539 540 # Initialise. 541 cdp._model = 'm8' 542 cdp._value_test = self.value_test 543 544 # Setup the data pipe for optimisation. 545 self.interpreter.run(script_file=status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'model_free'+sep+'opt_tm8_grid.py')
546 547
548 - def test_m9_grid(self):
549 """Test the optimisation of the m9 model-free model against the tm9 parameter grid.""" 550 551 # Initialise. 552 cdp._model = 'm9' 553 cdp._value_test = self.value_test 554 555 # Setup the data pipe for optimisation. 556 self.interpreter.run(script_file=status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'model_free'+sep+'opt_tm9_grid.py')
557 558
559 - def test_omp_analysis(self):
560 """Try a very minimal model-free analysis on the OMP relaxation data.""" 561 562 # Execute the script. 563 self.interpreter.run(script_file=status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'model_free'+sep+'omp_model_free.py') 564 565 # Alias the final data pipe. 566 dp = pipes.get_pipe('final') 567 568 # Some checks. 569 self.assertEqual(dp.mol[0].res[0].spin[0].select_sim, [True, False, True]) 570 self.assertEqual(dp.mol[0].res[1].spin[0].select_sim, [True, True, False]) 571 self.assertEqual(dp.mol[0].res[2].spin[0].select_sim, [True, True, True]) 572 self.assert_(not hasattr(dp.mol[0].res[3].spin[0], 'select_sim'))
573 574
575 - def test_opendx_s2_te_rex(self):
576 """Mapping the {S2, te, Rex} chi2 space through the OpenDX user function dx.map().""" 577 578 # Execute the script. 579 self.interpreter.run(script_file=status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'model_free'+sep+'opendx_s2_te_rex.py')
580 581
582 - def test_opendx_theta_phi_da(self):
583 """Mapping the {theta, phi, Da} chi2 space through the OpenDX user function dx.map().""" 584 585 # Path of the files. 586 path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'model_free'+sep+'S2_0.970_te_2048_Rex_0.149' 587 588 # Read the PDF file and set the vectors. 589 self.interpreter.structure.read_pdb(file='pdb', dir=path, read_model=1) 590 self.interpreter.structure.load_spins('@N') 591 self.interpreter.structure.vectors(attached='H') 592 593 # Read the relaxation data. 594 self.interpreter.relax_data.read('R1_600', 'R1', 600.0*1e6, 'r1.600.out', dir=path, res_num_col=1, res_name_col=2, data_col=3, error_col=4) 595 self.interpreter.relax_data.read('R2_600', 'R2', 600.0*1e6, 'r2.600.out', dir=path, res_num_col=1, res_name_col=2, data_col=3, error_col=4) 596 self.interpreter.relax_data.read('NOE_600', 'NOE', 600.0*1e6, 'noe.600.out', dir=path, res_num_col=1, res_name_col=2, data_col=3, error_col=4) 597 self.interpreter.relax_data.read('R1_500', 'R1', 500.0*1e6, 'r1.500.out', dir=path, res_num_col=1, res_name_col=2, data_col=3, error_col=4) 598 self.interpreter.relax_data.read('R2_500', 'R2', 500.0*1e6, 'r2.500.out', dir=path, res_num_col=1, res_name_col=2, data_col=3, error_col=4) 599 self.interpreter.relax_data.read('NOE_500', 'NOE', 500.0*1e6, 'noe.500.out', dir=path, res_num_col=1, res_name_col=2, data_col=3, error_col=4) 600 601 # Setup other values. 602 self.interpreter.diffusion_tensor.init((1.601 * 1e7, 1.34, 72.4, 90-77.9), param_types=4) 603 self.interpreter.value.set([N15_CSA, NH_BOND_LENGTH], ['csa', 'r']) 604 self.interpreter.value.set([0.8, 50 * 1e-12, 0.0], ['s2', 'te', 'rex']) 605 self.interpreter.value.set('15N', 'heteronuc_type') 606 self.interpreter.value.set('1H', 'proton_type') 607 608 # Select the model. 609 self.interpreter.model_free.select_model(model='m4') 610 611 # Map the space. 612 self.interpreter.dx.map(params=['theta', 'phi', 'Da'], spin_id=':2', inc=2, lower=[0, 0, -0.5*1e7], upper=[pi, 2.0*pi, 1.0*1e7], file_prefix='devnull')
613 614
615 - def test_opendx_tm_s2_te(self):
616 """Mapping the {local_tm, S2, te} chi2 space through the OpenDX user function dx.map().""" 617 618 # Path of the files. 619 path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'model_free'+sep+'S2_0.970_te_2048_Rex_0.149' 620 621 # Read the sequence. 622 self.interpreter.sequence.read(file='noe.500.out', dir=path, res_num_col=1, res_name_col=2) 623 624 # Read the relaxation data. 625 self.interpreter.relax_data.read('R1_600', 'R1', 600.0*1e6, 'r1.600.out', dir=path, res_num_col=1, res_name_col=2, data_col=3, error_col=4) 626 self.interpreter.relax_data.read('R2_600', 'R2', 600.0*1e6, 'r2.600.out', dir=path, res_num_col=1, res_name_col=2, data_col=3, error_col=4) 627 self.interpreter.relax_data.read('NOE_600', 'NOE', 600.0*1e6, 'noe.600.out', dir=path, res_num_col=1, res_name_col=2, data_col=3, error_col=4) 628 self.interpreter.relax_data.read('R1_500', 'R1', 500.0*1e6, 'r1.500.out', dir=path, res_num_col=1, res_name_col=2, data_col=3, error_col=4) 629 self.interpreter.relax_data.read('R2_500', 'R2', 500.0*1e6, 'r2.500.out', dir=path, res_num_col=1, res_name_col=2, data_col=3, error_col=4) 630 self.interpreter.relax_data.read('NOE_500', 'NOE', 500.0*1e6, 'noe.500.out', dir=path, res_num_col=1, res_name_col=2, data_col=3, error_col=4) 631 632 # Setup other values. 633 self.interpreter.value.set([N15_CSA, NH_BOND_LENGTH], ['csa', 'r']) 634 self.interpreter.value.set('15N', 'heteronuc_type') 635 self.interpreter.value.set('1H', 'proton_type') 636 637 # Select the model. 638 self.interpreter.model_free.select_model(model='tm2') 639 640 # Map the space. 641 self.interpreter.dx.map(params=['local_tm', 's2', 'te'], spin_id=':2', inc=2, lower=[5e-9, 0.0, 0.0], file_prefix='devnull')
642 643
645 """Constrained BFGS opt, backtracking line search {S2=0.970, te=2048, Rex=0.149} 646 647 The optimisation options are: 648 - BFGS optimisation. 649 - Backtracking line search. 650 - Constrained. 651 652 The true data set is: 653 - S2 = 0.970 654 - te = 2048 ps 655 - Rex = 0.149 s^-1 656 """ 657 658 # Setup the data pipe for optimisation. 659 self.interpreter.run(script_file=status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'model_free'+sep+'opt_setup_S2_0_970_te_2048_Rex_0_149.py') 660 661 # Set up the initial model-free parameter values (bypass the grid search for speed). 662 self.interpreter.value.set([1.0, 0.0, 0.0], ['s2', 'te', 'rex']) 663 664 # Minimise. 665 self.interpreter.minimise('bfgs', 'back') 666 667 # Alias the relevent spin container. 668 spin = cdp.mol[0].res[1].spin[0] 669 670 # Optimisation differences. 671 ########################### 672 673 # 32-bit Linux. 674 # iter: 203 675 # f_count: 955 676 # g_count: 209 677 678 # 32-bit i686 Linux (http://www.nmr-relax.com/mail.gna.org/public/relax-devel/2009-05/msg00003.html). 679 # System: Linux 680 # Release: 2.6.28-gentoo-r5 681 # Version: #1 SMP Sat Apr 25 13:31:51 EDT 2009 682 # Win32 version: 683 # Distribution: 684 # Architecture: 32bit ELF 685 # Machine: i686 686 # Processor: Intel(R) Pentium(R) M processor 1.80GHz 687 # Python version: 2.5.4 688 # numpy version: 1.2.1 689 # 690 # s2: 0.9700000000012307 691 # te: 2048.0000002299716 692 # rex: 0.14899999997647859 693 # chi2: 1.9223825944220359e-20 694 # iter: 157 695 # f_count: 722 696 # g_count: 164 697 # h_count: 0 698 # warning: None 699 700 # 32-bit i686 Linux. 701 # System: Linux 702 # Release: 2.6.33.7-desktop-2mnb 703 # Version: #1 SMP Mon Sep 20 19:00:25 UTC 2010 704 # Win32 version: 705 # Distribution: mandrake 2010.2 Official 706 # Architecture: 32bit ELF 707 # Machine: i686 708 # Processor: i686 709 # Python version: 2.6.5 710 # Numpy version: 1.4.1 711 # Libc version: glibc 2.0 712 # 713 # s2: 0.9700000000016741 714 # te (ps): 2048.000000312 715 # rex: 0.14899999996808433 716 # chi2: 3.5466670276032307e-20 717 # iter: 158 718 # f_count: 744 719 # g_count: 165 720 # h_count: 0 721 # warning: None 722 723 # 32-bit i686 Linux. 724 # System: Linux 725 # Release: 2.6.33.7-desktop-2mnb 726 # Version: #1 SMP Mon Sep 20 19:00:25 UTC 2010 727 # Win32 version: 728 # Distribution: mandrake 2010.2 Official 729 # Architecture: 32bit ELF 730 # Machine: i686 731 # Processor: i686 732 # Python version: 2.6.5 733 # Numpy version: 1.4.1 734 # Libc version: glibc 2.0 735 # 736 # s2: 0.9700000000016741 737 # te: 2048.000000312 738 # rex: 0.14899999996808433 739 # chi2: 3.5466670276032307e-20 740 # iter: 158 741 # f_count: 744 742 # g_count: 165 743 # h_count: 0 744 # warning: None 745 746 # 32-bit i686 Linux (http://www.nmr-relax.com/mail.gna.org/public/relax-users/2011-01/msg00029.html). 747 # System: Linux 748 # Release: 2.6.28-17-generic 749 # Version: #58-Ubuntu SMP Tue Dec 1 18:57:07 UTC 2009 750 # Win32 version: 751 # Distribution: Ubuntu 9.04 jaunty 752 # Architecture: 32bit ELF 753 # Machine: i686 754 # Processor: 755 # Python version: 2.6.2 756 # Numpy version: 1.2.1 757 # Libc version: glibc 2.4 758 # 759 # s2: 0.970000000000951 760 # te (ps): 2048.000000178 761 # rex: 0.14899999998189395 762 # chi2: 1.1498599057727952e-20 763 # iter: 154 764 # f_count: 598 765 # g_count: 161 766 # h_count: 0 767 # warning: None 768 769 # 64-bit x86_64 Linux. 770 # System: Linux 771 # Release: 2.6.24.7-server-2mnb 772 # Version: #1 SMP Thu Oct 30 14:50:37 EDT 2008 773 # Win32 version: 774 # Distribution: mandriva 2008.1 Official 775 # Architecture: 64bit ELF 776 # Machine: x86_64 777 # Processor: Intel(R) Core(TM)2 Duo CPU E8400 @ 3.00GHz 778 # Python version: 2.5.2 779 # Numpy version: 1.2.0 780 # Libc version: glibc 2.2.5 781 # 782 # s2: 0.9699999999999785 783 # te: 2047.9999999962433 784 # rex: 0.14900000000039709 785 # chi2: 5.2479491342506911e-24 786 # iter: 162 787 # f_count: 758 788 # g_count: 169 789 # h_count: 0 790 # warning: None 791 792 # 32-bit Windows. 793 # iter: 156 794 # f_count: 701 795 # g_count: 163 796 797 # 32-bit powerpc Darwin (https://web.archive.org/web/https://gna.org/bugs/?12573, http://www.nmr-relax.com/mail.gna.org/public/relax-users/2008-10/msg00089.html). 798 # System: Darwin 799 # Release: 9.5.0 800 # Version: Darwin Kernel Version 9.5.0: Wed Sep 3 11:31:44 PDT 2008; root:xnu-1228.7.58~1/RELEASE_PPC 801 # Win32 version: 802 # Distribution: 803 # Architecture: 32bit 804 # Machine: Power Macintosh 805 # Processor: powerpc 806 # Python version: 2.5.2 807 # numpy version: 1.1.1 808 # 809 # s2: 0.9699999999999861 810 # te: 2047.9999999978033 811 # rex: 0.14900000000028032 812 # chi2: 1.8533903598853284e-24 813 # iter: 156 814 # f_count: 695 815 # g_count: 162 816 # h_count: 0 817 # warning: None 818 819 # 32-bit i386 Darwin (https://web.archive.org/web/https://gna.org/bugs/?14173). 820 # System: Darwin 821 # Release: 9.8.0 822 # Version: Darwin Kernel Version 9.8.0: Wed Jul 15 16:55:01 PDT 2009; root:xnu-1228.15.4~1/RELEASE_I386 823 # Win32 version: 824 # Distribution: 825 # Architecture: 32bit 826 # Machine: i386 827 # Processor: i386 828 # Python version: 2.6.2 829 # numpy version: 1.3.0 830 # 831 # s2: 0.9700000000009170 832 # te: 2048.0000001751678 833 # rex: 0.14899999998256069 834 # chi2: 1.1151721805269898e-20 835 # iter: 175 836 # f_count: 735 837 # g_count: 182 838 # h_count: 0 839 # warning: None 840 841 # 64-bit i386 Darwin (https://web.archive.org/web/https://gna.org/bugs/?14173). 842 # System: Darwin 843 # Release: 9.8.0 844 # Version: Darwin Kernel Version 9.8.0: Wed Jul 15 16:55:01 PDT 2009; root:xnu-1228.15.4~1/RELEASE_I386 845 # Win32 version: 846 # Distribution: 847 # Architecture: 64bit 848 # Machine: i386 849 # Processor: i386 850 # Python version: 2.6.2 851 # numpy version: 1.3.0 852 # 853 # s2: 0.9699999999999785 854 # te: 2047.9999999962433 855 # rex: 0.14900000000039709 856 # chi2: 5.2479491342506911e-24 857 # iter: 162 858 # f_count: 758 859 # g_count: 169 860 # h_count: 0 861 # warning: None 862 863 # Optimisation values. 864 select = True 865 s2 = 0.9699999999999995 866 te = 2048.000000000022283 867 rex = 0.14900000000000566 / (2.0 * pi * cdp.frq[cdp.ri_ids[0]])**2 868 chi2 = 3.1024517431117421e-27 869 iter = [154, 156, 157, 158, 162, 175, 203] 870 f_count = [598, 695, 701, 722, 735, 744, 758, 955] 871 g_count = [161, 162, 163, 164, 165, 169, 182, 209] 872 h_count = 0 873 warning = None 874 875 # Test the values. 876 self.assertEqual(cdp.mol[0].res[0].spin[0].select, False) 877 self.value_test(spin, select=select, s2=s2, te=te, rex=rex, chi2=chi2)
878 879
881 """Constrained BFGS opt, More and Thuente line search {S2=0.970, te=2048, Rex=0.149} 882 883 The optimisation options are: 884 - BFGS optimisation. 885 - More and Thuente line search. 886 - Constrained. 887 888 The true data set is: 889 - S2 = 0.970 890 - te = 2048 ps 891 - Rex = 0.149 s^-1 892 """ 893 894 # Setup the data pipe for optimisation. 895 self.interpreter.run(script_file=status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'model_free'+sep+'opt_setup_S2_0_970_te_2048_Rex_0_149.py') 896 897 # Set up the initial model-free parameter values (bypass the grid search for speed). 898 self.interpreter.value.set([1.0, 0.0, 0.0], ['s2', 'te', 'rex']) 899 900 # Minimise. 901 self.interpreter.minimise('bfgs', 'mt') 902 903 # Alias the relevent spin container. 904 spin = cdp.mol[0].res[1].spin[0] 905 906 # Optimisation differences. 907 ########################### 908 909 # 32-bit Linux. 910 # f_count: 388 911 # g_count: 388 912 913 # 32-bit i686 Linux (http://www.nmr-relax.com/mail.gna.org/public/relax-devel/2009-05/msg00003.html). 914 # System: Linux 915 # Release: 2.6.28-gentoo-r5 916 # Version: #1 SMP Sat Apr 25 13:31:51 EDT 2009 917 # Win32 version: 918 # Distribution: 919 # Architecture: 32bit ELF 920 # Machine: i686 921 # Processor: Intel(R) Pentium(R) M processor 1.80GHz 922 # Python version: 2.5.4 923 # numpy version: 1.2.1 924 # 925 # s2: 0.9700000000000604 926 # te: 2048.0000000114946 927 # rex: 0.14899999999885985 928 # chi2: 4.762657780645096e-23 929 # iter: 120 930 # f_count: 386 931 # g_count: 386 932 # h_count: 0 933 # warning: None 934 935 # 32-bit i686 Linux (http://www.nmr-relax.com/mail.gna.org/public/relax-users/2011-01/msg00029.html). 936 # System: Linux 937 # Release: 2.6.28-17-generic 938 # Version: #58-Ubuntu SMP Tue Dec 1 18:57:07 UTC 2009 939 # Win32 version: 940 # Distribution: Ubuntu 9.04 jaunty 941 # Architecture: 32bit ELF 942 # Machine: i686 943 # Processor: 944 # Python version: 2.6.2 945 # Numpy version: 1.2.1 946 # Libc version: glibc 2.4 947 # 948 # s2: 0.9700000000000614 949 # te (ps): 2048.000000012 950 # rex: 0.14899999999883881 951 # chi2: 4.9272178768519757e-23 952 # iter: 120 953 # f_count: 381 954 # g_count: 381 955 # h_count: 0 956 # warning: None 957 958 # 64-bit x86_64 Linux. 959 # System: Linux 960 # Release: 2.6.24.7-server-2mnb 961 # Version: #1 SMP Thu Oct 30 14:50:37 EDT 2008 962 # Win32 version: 963 # Distribution: mandriva 2008.1 Official 964 # Architecture: 64bit ELF 965 # Machine: x86_64 966 # Processor: Intel(R) Core(TM)2 Duo CPU E8400 @ 3.00GHz 967 # Python version: 2.5.2 968 # Numpy version: 1.2.0 969 # Libc version: glibc 2.2.5 970 # 971 # s2: 0.9700000000000603 972 # te: 2048.0000000114601 973 # rex: 0.14899999999886163 974 # chi2: 4.7289676642197204e-23 975 # iter: 120 976 # f_count: 384 977 # g_count: 384 978 # h_count: 0 979 # warning: None 980 981 # 32-bit powerpc Darwin (https://web.archive.org/web/https://gna.org/bugs/?12573, http://www.nmr-relax.com/mail.gna.org/public/relax-users/2008-10/msg00089.html). 982 # System: Darwin 983 # Release: 9.5.0 984 # Version: Darwin Kernel Version 9.5.0: Wed Sep 3 11:31:44 PDT 2008; 985 # root:xnu-1228.7.58~1/RELEASE_PPC 986 # Win32 version: 987 # Distribution: 988 # Architecture: 32bit 989 # Machine: Power Macintosh 990 # Processor: powerpc 991 # Python version: 2.5.2 992 # numpy version: 1.1.1 993 # 994 # s2: 0.9700000000000607 995 # te: 2048.0000000115510 996 # rex: 0.14899999999885080 997 # chi2: 4.8056261450870388e-23 998 # iter: 120 999 # f_count: 377 1000 # g_count: 377 1001 # h_count: 0 1002 # warning: None 1003 1004 # 32-bit i386 Darwin (https://web.archive.org/web/https://gna.org/bugs/?14174). 1005 # System: Darwin 1006 # Release: 9.8.0 1007 # Version: Darwin Kernel Version 9.8.0: Wed Jul 15 16:55:01 PDT 2009; root:xnu-1228.15.4~1/RELEASE_I386 1008 # Win32 version: 1009 # Distribution: 1010 # Architecture: 32bit 1011 # Machine: i386 1012 # Processor: i386 1013 # Python version: 2.6.2 1014 # numpy version: 1.3.0 1015 # 1016 # s2: 0.9700000000000604 1017 # te: 2048.0000000114997 1018 # rex: 0.14899999999886168 1019 # chi2: 4.7647467884964078e-23 1020 # iter: 120 1021 # f_count: 386 1022 # g_count: 386 1023 # h_count: 0 1024 # warning: None 1025 1026 # 64-bit i386 Darwin (https://web.archive.org/web/https://gna.org/bugs/?14174). 1027 # System: Darwin 1028 # Release: 9.8.0 1029 # Version: Darwin Kernel Version 9.8.0: Wed Jul 15 16:55:01 PDT 2009; root:xnu-1228.15.4~1/RELEASE_I386 1030 # Win32 version: 1031 # Distribution: 1032 # Architecture: 64bit 1033 # Machine: i386 1034 # Processor: i386 1035 # Python version: 2.6.2 1036 # numpy version: 1.3.0 1037 # 1038 # s2: 0.9700000000000603 1039 # te: 2048.0000000114601 1040 # rex: 0.14899999999886163 1041 # chi2: 4.7289676642197204e-23 1042 # iter: 120 1043 # f_count: 384 1044 # g_count: 384 1045 # h_count: 0 1046 # warning: None 1047 1048 # Optimisation values. 1049 select = True 1050 s2 = 0.9700000000000580 1051 te = 2048.000000011044449 1052 rex = 0.148999999998904 / (2.0 * pi * cdp.frq[cdp.ri_ids[0]])**2 1053 chi2 = 4.3978813282102374e-23 1054 iter = 120 1055 f_count = [377, 381, 384, 386, 388] 1056 g_count = [377, 381, 384, 386, 388] 1057 h_count = 0 1058 warning = None 1059 1060 # Test the values. 1061 self.assertEqual(cdp.mol[0].res[0].spin[0].select, False) 1062 self.value_test(spin, select=select, s2=s2, te=te, rex=rex, chi2=chi2)
1063 1064
1066 """Constrained coordinate descent opt, backtracking line search {S2=0.970, te=2048, Rex=0.149} 1067 1068 The optimisation options are: 1069 - Coordinate descent optimisation. 1070 - Backtracking line search. 1071 - Constrained. 1072 1073 The true data set is: 1074 - S2 = 0.970 1075 - te = 2048 ps 1076 - Rex = 0.149 s^-1 1077 """ 1078 1079 # Setup the data pipe for optimisation. 1080 self.interpreter.run(script_file=status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'model_free'+sep+'opt_setup_S2_0_970_te_2048_Rex_0_149.py') 1081 1082 # Set up the initial model-free parameter values (bypass the grid search for speed). 1083 self.interpreter.value.set([1.0, 0.0, 0.0], ['s2', 'te', 'rex']) 1084 1085 # Minimise. 1086 self.interpreter.minimise('cd', 'back', max_iter=50) 1087 1088 # Alias the relevent spin container. 1089 spin = cdp.mol[0].res[1].spin[0] 1090 1091 # Optimisation differences. 1092 ########################### 1093 1094 # 64-bit x86_64 Linux. 1095 # System: Linux 1096 # Release: 2.6.24.7-server-2mnb 1097 # Version: #1 SMP Thu Oct 30 14:50:37 EDT 2008 1098 # Win32 version: 1099 # Distribution: mandriva 2008.1 Official 1100 # Architecture: 64bit ELF 1101 # Machine: x86_64 1102 # Processor: Intel(R) Core(TM)2 Duo CPU E8400 @ 3.00GHz 1103 # Python version: 2.5.2 1104 # Numpy version: 1.2.0 1105 # Libc version: glibc 2.2.5 1106 # 1107 # s2: 0.9097900390625000 1108 # te: 25.0000000000000 1109 # rex: 1.24017333984375000 1110 # chi2: 53.476155463267176 1111 # iter: 50 1112 # f_count: 131 1113 # g_count: 51 1114 # h_count: 0 1115 # warning: Maximum number of iterations reached 1116 1117 # Optimisation values. 1118 select = True 1119 s2 = 0.9097900390625 1120 te = 25.00000000000000 1121 rex = 1.24017333984375 / (2.0 * pi * cdp.frq[cdp.ri_ids[0]])**2 1122 chi2 = 53.476155463267176 1123 iter = 50 1124 f_count = 131 1125 g_count = 51 1126 h_count = 0 1127 warning = 'Maximum number of iterations reached' 1128 1129 # Test the values. 1130 self.assertEqual(cdp.mol[0].res[0].spin[0].select, False) 1131 self.value_test(spin, select=select, s2=s2, te=te, rex=rex, chi2=chi2)
1132 1133
1135 """Constrained coordinate descent opt, More and Thuente line search {S2=0.970, te=2048, Rex=0.149} 1136 1137 The optimisation options are: 1138 - Coordinate descent optimisation. 1139 - More and Thuente line search. 1140 - Constrained. 1141 1142 The true data set is: 1143 - S2 = 0.970 1144 - te = 2048 ps 1145 - Rex = 0.149 s^-1 1146 """ 1147 1148 # Setup the data pipe for optimisation. 1149 self.interpreter.run(script_file=status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'model_free'+sep+'opt_setup_S2_0_970_te_2048_Rex_0_149.py') 1150 1151 # Set up the initial model-free parameter values (bypass the grid search for speed). 1152 self.interpreter.value.set([1.0, 0.0, 0.0], ['s2', 'te', 'rex']) 1153 1154 # Minimise. 1155 self.interpreter.minimise('cd', 'mt') 1156 1157 # Alias the relevent spin container. 1158 spin = cdp.mol[0].res[1].spin[0] 1159 1160 # Optimisation differences. 1161 ########################### 1162 1163 # 32-bit Linux. 1164 # f_count: 738 1165 # g_count: 738 1166 1167 # 32-bit i686 Linux. 1168 # System: Linux 1169 # Release: 2.6.33.7-desktop-2mnb 1170 # Version: #1 SMP Mon Sep 20 19:00:25 UTC 2010 1171 # Win32 version: 1172 # Distribution: mandrake 2010.2 Official 1173 # Architecture: 32bit ELF 1174 # Machine: i686 1175 # Processor: i686 1176 # Python version: 2.6.5 1177 # Numpy version: 1.4.1 1178 # Libc version: glibc 2.0 1179 # 1180 # s2: 0.9700000000219662 1181 # te: 2048.000001534 1182 # rex: 0.14899999946980566 1183 # chi2: 2.3474910055938013e-18 1184 # iter: 200 1185 # f_count: 874 1186 # g_count: 874 1187 # h_count: 0 1188 # warning: None 1189 1190 # 64-bit x86_64 Linux. 1191 # System: Linux 1192 # Release: 2.6.24.7-server-2mnb 1193 # Version: #1 SMP Thu Oct 30 14:50:37 EDT 2008 1194 # Win32 version: 1195 # Distribution: mandriva 2008.1 Official 1196 # Architecture: 64bit ELF 1197 # Machine: x86_64 1198 # Processor: Intel(R) Core(TM)2 Duo CPU E8400 @ 3.00GHz 1199 # Python version: 2.5.2 1200 # Numpy version: 1.2.0 1201 # Libc version: glibc 2.2.5 1202 # 1203 # s2: 0.9700000000219674 1204 # te: 2048.0000015341870 1205 # rex: 0.14899999946977982 1206 # chi2: 2.3477234248531005e-18 1207 # iter: 198 1208 # f_count: 757 1209 # g_count: 757 1210 # h_count: 0 1211 # warning: None 1212 1213 # 32-bit powerpc Darwin (https://web.archive.org/web/https://gna.org/bugs/?12573, http://www.nmr-relax.com/mail.gna.org/public/relax-users/2008-10/msg00089.html). 1214 # System: Darwin 1215 # Release: 9.5.0 1216 # Version: Darwin Kernel Version 9.5.0: Wed Sep 3 11:31:44 PDT 2008; 1217 # root:xnu-1228.7.58~1/RELEASE_PPC 1218 # Win32 version: 1219 # Distribution: 1220 # Architecture: 32bit 1221 # Machine: Power Macintosh 1222 # Processor: powerpc 1223 # Python version: 2.5.2 1224 # numpy version: 1.1.1 1225 # 1226 # s2: 0.9700000000219674 1227 # te: 2048.0000015341870 1228 # rex: 0.14899999946977982 1229 # chi2: 2.3477234248531005e-18 1230 # iter: 198 1231 # f_count: 757 1232 # g_count: 757 1233 # h_count: 0 1234 # warning: None 1235 1236 # 64-bit i386 Darwin (https://web.archive.org/web/https://gna.org/bugs/?14175). 1237 # System: Darwin 1238 # Release: 9.8.0 1239 # Version: Darwin Kernel Version 9.8.0: Wed Jul 15 16:55:01 PDT 2009; root:xnu-1228.15.4~1/RELEASE_I386 1240 # Win32 version: 1241 # Distribution: 1242 # Architecture: 64bit 1243 # Machine: i386 1244 # Processor: i386 1245 # Python version: 2.6.2 1246 # numpy version: 1.3.0 1247 # 1248 # s2: 0.9700000000219674 1249 # te: 2048.0000015341870 1250 # rex: 0.14899999946977982 1251 # chi2: 2.3477234248531005e-18 1252 # iter: 198 1253 # f_count: 757 1254 # g_count: 757 1255 # h_count: 0 1256 # warning: None 1257 1258 # Optimisation values. 1259 select = True 1260 s2 = 0.9700000000219674 1261 te = 2048.000001534187049 1262 rex = 0.14899999946977982 / (2.0 * pi * cdp.frq[cdp.ri_ids[0]])**2 1263 chi2 = 2.3477234248531005e-18 1264 iter = [198, 200] 1265 f_count = [738, 757, 874] 1266 g_count = [738, 757, 874] 1267 h_count = 0 1268 warning = None 1269 1270 # Test the values. 1271 self.assertEqual(cdp.mol[0].res[0].spin[0].select, False) 1272 self.value_test(spin, select=select, s2=s2, te=te, rex=rex, chi2=chi2)
1273 1274
1276 """Constrained Newton opt, GMW Hessian mod, backtracking line search {S2=0.970, te=2048, Rex=0.149} 1277 1278 The optimisation options are: 1279 - Newton optimisation. 1280 - GMW Hessian modification. 1281 - Backtracking line search. 1282 - Constrained. 1283 1284 The true data set is: 1285 - S2 = 0.970 1286 - te = 2048 ps 1287 - Rex = 0.149 s^-1 1288 """ 1289 1290 # Setup the data pipe for optimisation. 1291 self.interpreter.run(script_file=status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'model_free'+sep+'opt_setup_S2_0_970_te_2048_Rex_0_149.py') 1292 1293 # Set up the initial model-free parameter values (bypass the grid search for speed). 1294 self.interpreter.value.set([1.0, 0.0, 0.0], ['s2', 'te', 'rex']) 1295 1296 # Minimise. 1297 self.interpreter.minimise('newton', 'gmw', 'back') 1298 1299 # Alias the relevent spin container. 1300 spin = cdp.mol[0].res[1].spin[0] 1301 1302 # Optimisation differences. 1303 ########################### 1304 1305 # 32-bit Linux. 1306 # f_count: 55 1307 # g_count: 23 1308 1309 # 32-bit i686 Linux. 1310 # System: Linux 1311 # Release: 2.6.33.7-desktop-2mnb 1312 # Version: #1 SMP Mon Sep 20 19:00:25 UTC 2010 1313 # Win32 version: 1314 # Distribution: mandrake 2010.2 Official 1315 # Architecture: 32bit ELF 1316 # Machine: i686 1317 # Processor: i686 1318 # Python version: 2.6.5 1319 # Numpy version: 1.4.1 1320 # Libc version: glibc 2.0 1321 # 1322 # s2: 0.9699999999999992 1323 # te: 2048 1324 # rex: 0.14900000000002034 1325 # chi2: 1.1701970207791308e-27 1326 # iter: 18 1327 # f_count: 57 1328 # g_count: 23 1329 # h_count: 18 1330 # warning: None 1331 1332 # 64-bit x86_64 Linux. 1333 # System: Linux 1334 # Release: 2.6.24.7-server-2mnb 1335 # Version: #1 SMP Thu Oct 30 14:50:37 EDT 2008 1336 # Win32 version: 1337 # Distribution: mandriva 2008.1 Official 1338 # Architecture: 64bit ELF 1339 # Machine: x86_64 1340 # Processor: Intel(R) Core(TM)2 Duo CPU E8400 @ 3.00GHz 1341 # Python version: 2.5.2 1342 # Numpy version: 1.2.0 1343 # Libc version: glibc 2.2.5 1344 # 1345 # s2: 0.9699999999999995 1346 # te: 2048.0000000000473 1347 # rex: 0.14900000000001926 1348 # chi2: 7.9357208397255696e-28 1349 # iter: 18 1350 # f_count: 55 1351 # g_count: 23 1352 # h_count: 18 1353 # warning: None 1354 1355 # 32-bit powerpc Darwin (https://web.archive.org/web/https://gna.org/bugs/?12573, http://www.nmr-relax.com/mail.gna.org/public/relax-users/2008-10/msg00089.html). 1356 # System: Darwin 1357 # Release: 9.5.0 1358 # Version: Darwin Kernel Version 9.5.0: Wed Sep 3 11:31:44 PDT 2008; 1359 # root:xnu-1228.7.58~1/RELEASE_PPC 1360 # Win32 version: 1361 # Distribution: 1362 # Architecture: 32bit 1363 # Machine: Power Macintosh 1364 # Processor: powerpc 1365 # Python version: 2.5.2 1366 # numpy version: 1.1.1 1367 # 1368 # s2: 0.9699999999999993 1369 # te: 2048.0000000000427 1370 # rex: 0.14900000000002098 1371 # chi2: 5.7085251917483392e-28 1372 # iter: 18 1373 # f_count: 94 1374 # g_count: 23 1375 # h_count: 18 1376 # warning: None 1377 1378 # 64-bit i386 Darwin (https://web.archive.org/web/https://gna.org/bugs/?14177). 1379 # System: Darwin 1380 # Release: 9.8.0 1381 # Version: Darwin Kernel Version 9.8.0: Wed Jul 15 16:55:01 PDT 2009; root:xnu-1228.15.4~1/RELEASE_I386 1382 # Win32 version: 1383 # Distribution: 1384 # Architecture: 32bit 1385 # Machine: i386 1386 # Processor: i386 1387 # Python version: 2.6.2 1388 # numpy version: 1.3.0 1389 # 1390 # s2: 0.9699999999999994 1391 # te: 2048.0000000000455 1392 # rex: 0.14900000000001823 1393 # chi2: 7.3040158179665562e-28 1394 # iter: 18 1395 # f_count: 55 1396 # g_count: 23 1397 # h_count: 18 1398 # warning: None 1399 1400 # Optimisation values. 1401 select = True 1402 s2 = 0.9699999999999994 1403 te = 2048.000000000045020 1404 rex = 0.14900000000001817 / (2.0 * pi * cdp.frq[cdp.ri_ids[0]])**2 1405 chi2 = 7.3040158179665562e-28 1406 iter = 18 1407 f_count = [55, 57, 94] 1408 g_count = [23] 1409 h_count = 18 1410 warning = None 1411 1412 # Test the values. 1413 self.assertEqual(cdp.mol[0].res[0].spin[0].select, False) 1414 self.value_test(spin, select=select, s2=s2, te=te, rex=rex, chi2=chi2)
1415 1416
1418 """Constrained Newton opt, GMW Hessian mod, More and Thuente line search {S2=0.970, te=2048, Rex=0.149} 1419 1420 The optimisation options are: 1421 - Newton optimisation. 1422 - GMW Hessian modification. 1423 - More and Thuente line search. 1424 - Constrained. 1425 1426 The true data set is: 1427 - S2 = 0.970 1428 - te = 2048 ps 1429 - Rex = 0.149 s^-1 1430 """ 1431 1432 # Setup the data pipe for optimisation. 1433 self.interpreter.run(script_file=status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'model_free'+sep+'opt_setup_S2_0_970_te_2048_Rex_0_149.py') 1434 1435 # Set up the initial model-free parameter values (bypass the grid search for speed). 1436 self.interpreter.value.set([1.0, 0.0, 0.0], ['s2', 'te', 'rex']) 1437 1438 # Minimise. 1439 self.interpreter.minimise('newton', 'gmw', 'mt') 1440 1441 # Monte Carlo simulations. 1442 self.monte_carlo() 1443 1444 # Alias the relevent spin container. 1445 spin = cdp.mol[0].res[1].spin[0] 1446 1447 # Optimisation differences. 1448 ########################### 1449 1450 # 32-bit Linux. 1451 # f_count: 159, 95 1452 # g_count: 159 1453 1454 # 32-bit i686 Linux. 1455 # System: Linux 1456 # Release: 2.6.33.7-desktop-2mnb 1457 # Version: #1 SMP Mon Sep 20 19:00:25 UTC 2010 1458 # Win32 version: 1459 # Distribution: mandrake 2010.2 Official 1460 # Architecture: 32bit ELF 1461 # Machine: i686 1462 # Processor: i686 1463 # Python version: 2.6.5 1464 # Numpy version: 1.4.1 1465 # Libc version: glibc 2.0 1466 # 1467 # s2: 0.9699999999999994 1468 # te: 2048 1469 # rex: 0.14900000000002014 1470 # chi2: 7.9326439528899843e-28 1471 # iter: 22 1472 # f_count: 95 1473 # g_count: 95 1474 # h_count: 22 1475 # warning: None 1476 1477 # 64-bit x86_64 Linux. 1478 # System: Linux 1479 # Release: 2.6.24.7-server-2mnb 1480 # Version: #1 SMP Thu Oct 30 14:50:37 EDT 2008 1481 # Win32 version: 1482 # Distribution: mandriva 2008.1 Official 1483 # Architecture: 64bit ELF 1484 # Machine: x86_64 1485 # Processor: Intel(R) Core(TM)2 Duo CPU E8400 @ 3.00GHz 1486 # Python version: 2.5.2 1487 # Numpy version: 1.2.0 1488 # Libc version: glibc 2.2.5 1489 # 1490 # s2: 0.9699999999999994 1491 # te: 2048.0000000000446 1492 # rex: 0.14900000000001615 1493 # chi2: 8.3312601381368332e-28 1494 # iter: 22 1495 # f_count: 91 1496 # g_count: 91 1497 # h_count: 22 1498 # warning: None 1499 1500 # 64-bit x86_64 Linux (Not sure why there is a difference here, maybe this is gcc or blas/lapack - Python and numpy versions are identical). 1501 # f_count: 153 1502 # g_count: 153 1503 1504 # 32-bit powerpc Darwin (https://web.archive.org/web/https://gna.org/bugs/?12573, http://www.nmr-relax.com/mail.gna.org/public/relax-users/2008-10/msg00089.html). 1505 # System: Darwin 1506 # Release: 9.5.0 1507 # Version: Darwin Kernel Version 9.5.0: Wed Sep 3 11:31:44 PDT 2008; 1508 # root:xnu-1228.7.58~1/RELEASE_PPC 1509 # Win32 version: 1510 # Distribution: 1511 # Architecture: 32bit 1512 # Machine: Power Macintosh 1513 # Processor: powerpc 1514 # Python version: 2.5.2 1515 # numpy version: 1.1.1 1516 # 1517 # s2: 0.9699999999999993 1518 # te: 2048.0000000000409 1519 # rex: 0.14900000000002178 1520 # chi2: 6.8756889983348349e-28 1521 # iter: 22 1522 # f_count: 160 1523 # g_count: 160 1524 # h_count: 22 1525 # warning: None 1526 1527 # 32-bit Windows. 1528 # f_count: 165 1529 # g_count: 165 1530 1531 # 32-bit i386 Darwin (https://web.archive.org/web/https://gna.org/bugs/?14176). 1532 # System: Darwin 1533 # Release: 9.8.0 1534 # Version: Darwin Kernel Version 9.8.0: Wed Jul 15 16:55:01 PDT 2009; root:xnu-1228.15.4~1/RELEASE_I386 1535 # Win32 version: 1536 # Distribution: 1537 # Architecture: 32bit 1538 # Machine: i386 1539 # Processor: i386 1540 # Python version: 2.6.2 1541 # numpy version: 1.3.0 1542 # 1543 # s2: 0.9699999999999994 1544 # te: 2048.0000000000446 1545 # rex: 0.14900000000001609 1546 # chi2: 8.3312601381368332e-28 1547 # iter: 22 1548 # f_count: 91 1549 # g_count: 91 1550 # h_count: 22 1551 # warning: None 1552 1553 # 64-bit i386 Darwin (https://web.archive.org/web/https://gna.org/bugs/?14176). 1554 # System: Darwin 1555 # Release: 9.8.0 1556 # Version: Darwin Kernel Version 9.8.0: Wed Jul 15 16:55:01 PDT 2009; root:xnu-1228.15.4~1/RELEASE_I386 1557 # Win32 version: 1558 # Distribution: 1559 # Architecture: 64bit 1560 # Machine: i386 1561 # Processor: i386 1562 # Python version: 2.6.2 1563 # numpy version: 1.3.0 1564 # 1565 # s2: 0.9699999999999994 1566 # te: 2048.0000000000446 1567 # rex: 0.14900000000001609 1568 # chi2: 8.3312601381368332e-28 1569 # iter: 22 1570 # f_count: 91 1571 # g_count: 91 1572 # h_count: 22 1573 # warning: None 1574 1575 # Optimisation values. 1576 select = True 1577 s2 = 0.9699999999999993 1578 te = 2048.000000000041837 1579 rex = 0.14900000000002225 / (2.0 * pi * cdp.frq[cdp.ri_ids[0]])**2 1580 chi2 = 6.8756889983348349e-28 1581 iter = 22 1582 f_count = [91, 95, 153, 159, 160, 165] 1583 g_count = [91, 95, 153, 159, 160, 165] 1584 h_count = 22 1585 warning = None 1586 1587 # Test the values. 1588 self.assertEqual(cdp.mol[0].res[0].spin[0].select, False) 1589 self.value_test(spin, select=select, s2=s2, te=te, rex=rex, chi2=chi2)
1590 1591
1593 """Constrained steepest descent opt, backtracking line search {S2=0.970, te=2048, Rex=0.149} 1594 1595 The optimisation options are: 1596 - Steepest descent optimisation. 1597 - Backtracking line search. 1598 - Constrained. 1599 1600 The true data set is: 1601 - S2 = 0.970 1602 - te = 2048 ps 1603 - Rex = 0.149 s^-1 1604 """ 1605 1606 # Setup the data pipe for optimisation. 1607 self.interpreter.run(script_file=status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'model_free'+sep+'opt_setup_S2_0_970_te_2048_Rex_0_149.py') 1608 1609 # Set up the initial model-free parameter values (bypass the grid search for speed). 1610 self.interpreter.value.set([1.0, 0.0, 0.0], ['s2', 'te', 'rex']) 1611 1612 # Minimise. 1613 self.interpreter.minimise('sd', 'back', max_iter=50) 1614 1615 # Alias the relevent spin container. 1616 spin = cdp.mol[0].res[1].spin[0] 1617 1618 # Optimisation differences. 1619 ########################### 1620 1621 # 64-bit x86_64 Linux. 1622 # System: Linux 1623 # Release: 2.6.24.7-server-2mnb 1624 # Version: #1 SMP Thu Oct 30 14:50:37 EDT 2008 1625 # Win32 version: 1626 # Distribution: mandriva 2008.1 Official 1627 # Architecture: 64bit ELF 1628 # Machine: x86_64 1629 # Processor: Intel(R) Core(TM)2 Duo CPU E8400 @ 3.00GHz 1630 # Python version: 2.5.2 1631 # Numpy version: 1.2.0 1632 # Libc version: glibc 2.2.5 1633 # 1634 # s2: 0.9157922083468916 1635 # te: 0.3056865872253 1636 # rex: 0.34008409798064831 1637 # chi2: 68.321956795340569 1638 # iter: 50 1639 # f_count: 134 1640 # g_count: 51 1641 # h_count: 0 1642 # warning: Maximum number of iterations reached 1643 1644 # Optimisation values. 1645 select = True 1646 s2 = 0.91579220834688024 1647 te = 0.30568658722531733 1648 rex = 0.34008409798366124 / (2.0 * pi * cdp.frq[cdp.ri_ids[0]])**2 1649 chi2 = 68.321956795264342 1650 iter = 50 1651 f_count = 134 1652 g_count = 51 1653 h_count = 0 1654 warning = 'Maximum number of iterations reached' 1655 1656 # Test the values. 1657 self.assertEqual(cdp.mol[0].res[0].spin[0].select, False) 1658 self.value_test(spin, select=select, s2=s2, te=te, rex=rex, chi2=chi2)
1659 1660
1662 """Constrained steepest descent opt, More and Thuente line search {S2=0.970, te=2048, Rex=0.149} 1663 1664 The optimisation options are: 1665 - Steepest descent optimisation. 1666 - More and Thuente line search. 1667 - Constrained. 1668 1669 The true data set is: 1670 - S2 = 0.970 1671 - te = 2048 ps 1672 - Rex = 0.149 s^-1 1673 """ 1674 1675 # Setup the data pipe for optimisation. 1676 self.interpreter.run(script_file=status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'model_free'+sep+'opt_setup_S2_0_970_te_2048_Rex_0_149.py') 1677 1678 # Set up the initial model-free parameter values (bypass the grid search for speed). 1679 self.interpreter.value.set([1.0, 0.0, 0.0], ['s2', 'te', 'rex']) 1680 1681 # Minimise. 1682 self.interpreter.minimise('sd', 'mt', max_iter=50) 1683 1684 # Alias the relevent spin container. 1685 spin = cdp.mol[0].res[1].spin[0] 1686 1687 # Optimisation differences. 1688 ########################### 1689 1690 # 64-bit x86_64 Linux. 1691 # System: Linux 1692 # Release: 2.6.24.7-server-2mnb 1693 # Version: #1 SMP Thu Oct 30 14:50:37 EDT 2008 1694 # Win32 version: 1695 # Distribution: mandriva 2008.1 Official 1696 # Architecture: 64bit ELF 1697 # Machine: x86_64 1698 # Processor: Intel(R) Core(TM)2 Duo CPU E8400 @ 3.00GHz 1699 # Python version: 2.5.2 1700 # Numpy version: 1.2.0 1701 # Libc version: glibc 2.2.5 1702 # 1703 # s2: 0.9161999495781851 1704 # te: 0.1231968757090 1705 # rex: 0.16249110939079675 1706 # chi2: 73.843613548025075 1707 # iter: 50 1708 # f_count: 108 1709 # g_count: 108 1710 # h_count: 0 1711 # warning: Maximum number of iterations reached 1712 1713 # Optimisation values. 1714 select = True 1715 s2 = 0.91619994957822126 1716 te = 0.12319687570987945 1717 rex = 0.16249110942961512 / (2.0 * pi * cdp.frq[cdp.ri_ids[0]])**2 1718 chi2 = 73.843613546506191 1719 iter = 50 1720 f_count = 108 1721 g_count = 108 1722 h_count = 0 1723 warning = 'Maximum number of iterations reached' 1724 1725 # Test the values. 1726 self.assertEqual(cdp.mol[0].res[0].spin[0].select, False) 1727 self.value_test(spin, select=select, s2=s2, te=te, rex=rex, chi2=chi2)
1728 1729
1731 """Constrained grid search {S2=0.970, te=2048, Rex=0.149}. 1732 1733 The optimisation options are: 1734 - Constrained grid search. 1735 1736 The true data set is: 1737 - S2 = 0.970 1738 - te = 2048 ps 1739 - Rex = 0.149 s^-1 1740 """ 1741 1742 # Setup the data pipe for optimisation. 1743 self.interpreter.run(script_file=status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'model_free'+sep+'opt_setup_S2_0_970_te_2048_Rex_0_149.py') 1744 1745 # Grid search. 1746 self.interpreter.grid_search(inc=11) 1747 1748 # Alias the relevent spin container. 1749 spin = cdp.mol[0].res[1].spin[0] 1750 1751 # Optimisation differences. 1752 ########################### 1753 1754 # 64-bit x86_64 Linux. 1755 # System: Linux 1756 # Release: 2.6.24.7-server-2mnb 1757 # Version: #1 SMP Thu Oct 30 14:50:37 EDT 2008 1758 # Win32 version: 1759 # Distribution: mandriva 2008.1 Official 1760 # Architecture: 64bit ELF 1761 # Machine: x86_64 1762 # Processor: Intel(R) Core(TM)2 Duo CPU E8400 @ 3.00GHz 1763 # Python version: 2.5.2 1764 # Numpy version: 1.2.0 1765 # Libc version: glibc 2.2.5 1766 # 1767 # s2: 1 1768 # te: 0 1769 # rex: 0 1770 # chi2: 3.9844117908982288 1771 # iter: 1331 1772 # f_count: 1331 1773 # g_count: 0 1774 # h_count: 0 1775 # warning: None 1776 1777 # Optimisation values. 1778 select = True 1779 s2 = 1.0 1780 te = 0.0 1781 rex = 0.0 1782 chi2 = 3.9844117908982288 1783 iter = 1331 1784 f_count = 1331 1785 g_count = 0 1786 h_count = 0 1787 warning = None 1788 1789 # Test the values. 1790 self.assertEqual(cdp.mol[0].res[0].spin[0].select, False) 1791 self.value_test(spin, select=select, s2=s2, te=te, rex=rex, chi2=chi2)
1792 1793
1794 - def test_read_relax_data(self):
1795 """Reading of relaxation data using the user function relax_data.read().""" 1796 1797 # Path of the files. 1798 path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'model_free'+sep+'S2_0.970_te_2048_Rex_0.149' 1799 1800 # Read the sequence. 1801 self.interpreter.sequence.read(file='noe.500.out', dir=path, res_num_col=1, res_name_col=2) 1802 1803 # Read the relaxation data. 1804 self.interpreter.relax_data.read(ri_id='R1_600', ri_type='R1', frq=600.0 * 1e6, file='r1.600.out', dir=path, res_num_col=1, res_name_col=2, data_col=3, error_col=4) 1805 1806 # Test the data and error. 1807 self.assertEqual(cdp.mol[0].res[1].spin[0].ri_data['R1_600'], 1.3874977659397683) 1808 self.assertEqual(cdp.mol[0].res[1].spin[0].ri_data_err['R1_600'], 0.027749955318795365)
1809 1810
1811 - def test_read_results_1_2(self):
1812 """Read a relax 1.2 model-free results file using the user function results.read().""" 1813 1814 # Read the results. 1815 self.interpreter.results.read(file='results_1.2', dir=status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'model_free') 1816 1817 # Debugging print out. 1818 print(cdp) 1819 1820 # The spin specific data. 1821 num = [3, 4, 5, 6, 7, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 24, 25, 26, 27, 28, 29, 30, 31, 33, 34, 35] 1822 select = [False, False, False, False, False, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, False, False, False] 1823 model = ['m6', 'm8', 'm6', 'm6', 'm5', 'm5', 'm6', 'm5', 'm5', 'm5', 'm5', 'm5', 'm5', 'm5', 'm5', 'm5', 'm5', 'm5', 'm5', 'm5', 'm5', 'm8'] 1824 params = [['s2f', 'tf', 's2', 'ts'], ['s2f', 'tf', 's2', 'ts', 'rex'], ['s2f', 'tf', 's2', 'ts'], ['s2f', 'tf', 's2', 'ts'], ['s2f', 's2', 'ts'], ['s2f', 's2', 'ts'], ['s2f', 'tf', 's2', 'ts'], ['s2f', 's2', 'ts'], ['s2f', 's2', 'ts'], ['s2f', 's2', 'ts'], ['s2f', 's2', 'ts'], ['s2f', 's2', 'ts'], ['s2f', 's2', 'ts'], ['s2f', 's2', 'ts'], ['s2f', 's2', 'ts'], ['s2f', 's2', 'ts'], ['s2f', 's2', 'ts'], ['s2f', 's2', 'ts'], ['s2f', 's2', 'ts'], ['s2f', 's2', 'ts'], ['s2f', 's2', 'ts'], ['s2f', 'tf', 's2', 'ts', 'rex']] 1825 s2 = [0.36670427146403667, 0.29007016882193892, 0.32969827132809559, 0.32795333510352148, 0.48713005133752196, 0.40269538236298569, 0.40700811448591556, 0.4283551026406261, 0.51176783207279875, 0.40593664887508263, 0.39437732735324443, 0.51457448574034614, 0.3946900969237977, 0.44740698217286901, 0.48527716982891644, 0.40845486062540021, 0.45839900995265137, 0.52650140958170921, 0.4293599736020427, 0.4057313062564018, 0.49877862202992485, 0.2592017578673716] 1826 s2f = [0.74487419686217116, 0.75358958979175727, 0.77751085082436211, 0.79095600331751026, 0.81059857999556584, 0.83190224667917501, 0.80119109731193627, 0.83083248649122576, 0.86030420847112021, 0.84853537580616367, 0.82378413185968968, 0.82419108009774422, 0.85121172821954216, 0.8736616181472916, 0.84117641395909415, 0.82881488883235521, 0.82697284935760407, 0.85172375147802715, 0.81366357660551614, 0.80525752789388483, 0.87016608774434312, 0.72732036363757913] 1827 s2s = [0.49230363061145249, 0.38491796164819009, 0.4240433056059994, 0.41462904855388333, 0.60095102971952741, 0.48406574687168274, 0.50800379067049317, 0.51557336720143987, 0.59486845122178478, 0.47839684761453399, 0.47873867934666214, 0.62433881919629686, 0.46368028522041266, 0.51210557140148982, 0.57690296800513374, 0.49281795745831319, 0.55430962492751434, 0.61815983018913379, 0.5276873464009153, 0.50385285725620466, 0.57319933407525203, 0.35637907423767778] 1828 tf = [51.972302580836775, 40.664901270582988, 28.130299965023671, 33.804249387275249, None, None, 39.01236115991609, None, None, None, None, None, None, None, None, None, None, None, None, None, None, 44.039078787981225] 1829 ts = [4485.91415175767, 4102.7781982031429, 3569.2837792404325, 6879.5308400989479, 3372.9879908647699, 4029.0617588044606, 4335.5290462417324, 4609.1336532777468, 2628.5638771308277, 3618.1332115807745, 6208.3028336637644, 3763.0843884066526, 3847.9994107906346, 2215.2061317769703, 2936.1282626562524, 3647.0715185456729, 3803.6990762708042, 2277.5259401416288, 3448.4496004396187, 3884.6917561878495, 1959.3267951363712, 4100.8496898773756] 1830 rex = [None, 0.37670424516405815, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, 0.71472288436387088] 1831 1832 # Relaxation data. 1833 ri_ids = ['R1_500', 'R2_500', 'NOE_500', 'R1_600', 'R2_600', 'NOE_600', 'R1_750', 'R2_750', 'NOE_750'] 1834 types_list = ['R1', 'R2', 'NOE', 'R1', 'R2', 'NOE', 'R1', 'R2', 'NOE'] 1835 frqs_list = [500000000.0] * 3 + [600000000.0] * 3 + [750000000.0] * 3 1836 ri_type = {} 1837 frqs = {} 1838 for i in range(len(ri_ids)): 1839 ri_type[ri_ids[i]] = types_list[i] 1840 frqs[ri_ids[i]] = frqs_list[i] 1841 1842 ri_data = {} 1843 ri_data['R1_500'] = [2.2480000000000002, 2.2679999999999998, 2.2309999999999999, 2.383, 2.1960000000000002, 2.3570000000000002, 2.3340000000000001, 2.3999999999999999, 2.2839999999999998, 2.3889999999999998, 2.375, 2.274, 2.407, 2.3220000000000001, 2.2130000000000001, 2.351, 2.3260000000000001, 2.2949999999999999, 2.2829999999999999, 2.302, 2.2719999999999998, 2.2280000000000002] 1844 ri_data['R2_500'] = [5.3419999999999996, 5.3730000000000002, 5.1280000000000001, 5.6749999999999998, 5.9669999999999996, 5.8410000000000002, 5.774, 6.0419999999999998, 6.3129999999999997, 5.9210000000000003, 6.1269999999999998, 6.1120000000000001, 6.0570000000000004, 5.6399999999999997, 6.2809999999999997, 5.8890000000000002, 5.875, 6.1429999999999998, 5.7370000000000001, 5.5490000000000004, 5.7110000000000003, 5.4020000000000001] 1845 ri_data['NOE_500'] = [0.4617, 0.46560000000000001, 0.61670000000000003, 0.60860000000000003, 0.68869999999999998, 0.6663, 0.58620000000000005, 0.64939999999999998, 0.61070000000000002, 0.61180000000000001, 0.73129999999999995, 0.69650000000000001, 0.65139999999999998, 0.4929, 0.65920000000000001, 0.63029999999999997, 0.64380000000000004, 0.53500000000000003, 0.63839999999999997, 0.65000000000000002, 0.49909999999999999, 0.45979999999999999] 1846 ri_data['R1_600'] = [1.8879999999999999, 1.992, 2.0270000000000001, 1.9790000000000001, 1.9399999999999999, 2.0550000000000002, 2.0030000000000001, 2.0139999999999998, 1.982, 2.1000000000000001, 2.008, 1.927, 2.1019999999999999, 2.0830000000000002, 1.9910000000000001, 2.036, 1.9990000000000001, 1.9490000000000001, 1.976, 1.9870000000000001, 2.0, 1.9379999999999999] 1847 ri_data['R2_600'] = [5.6100000000000003, 5.7869999999999999, 5.4029999999999996, 6.1849999999999996, 6.3150000000000004, 5.9809999999999999, 6.1600000000000001, 6.2460000000000004, 6.4340000000000002, 6.0069999999999997, 6.399, 6.6799999999999997, 6.1369999999999996, 5.952, 6.3239999999999998, 5.9699999999999998, 6.3979999999999997, 6.4379999999999997, 6.1139999999999999, 6.0960000000000001, 6.3250000000000002, 6.1050000000000004] 1848 ri_data['NOE_600'] = [0.62929999999999997, 0.64429999999999998, 0.5393, 0.71509999999999996, 0.73870000000000002, 0.75580000000000003, 0.64239999999999997, 0.74429999999999996, 0.69440000000000002, 0.73140000000000005, 0.7681, 0.73399999999999999, 0.75680000000000003, 0.62470000000000003, 0.73529999999999995, 0.73740000000000006, 0.73080000000000001, 0.6603, 0.70899999999999996, 0.69040000000000001, 0.59199999999999997, 0.56830000000000003] 1849 ri_data['R1_750'] = [1.6220000000000001, 1.706, 1.73, 1.665, 1.627, 1.768, 1.706, 1.7030000000000001, 1.7649999999999999, 1.8129999999999999, 1.675, 1.6339999999999999, 1.845, 1.7829999999999999, 1.764, 1.7470000000000001, 1.681, 1.647, 1.6850000000000001, 1.667, 1.7010000000000001, 1.6850000000000001] 1850 ri_data['R2_750'] = [6.2619999999999996, 6.5359999999999996, 5.8959999999999999, 6.6840000000000002, 6.8819999999999997, 6.7569999999999997, 6.5620000000000003, 7.0030000000000001, 6.9740000000000002, 6.649, 6.9829999999999997, 7.2309999999999999, 6.4429999999999996, 6.6840000000000002, 6.8070000000000004, 6.4850000000000003, 6.9400000000000004, 6.944, 6.4640000000000004, 6.4889999999999999, 6.9009999999999998, 6.9539999999999997] 1851 ri_data['NOE_750'] = [0.61909999999999998, 0.65890000000000004, 0.72009999999999996, 0.71009999999999995, 0.75219999999999998, 0.80420000000000003, 0.70020000000000004, 0.81999999999999995, 0.81040000000000001, 0.83409999999999995, 0.81299999999999994, 0.81910000000000005, 0.7782, 0.74760000000000004, 0.8115, 0.7379, 0.81100000000000005, 0.78249999999999997, 0.75729999999999997, 0.78259999999999996, 0.75139999999999996, 0.65210000000000001] 1852 1853 ri_data_err = {} 1854 ri_data_err['R1_500'] = [0.044999999999999998, 0.044999999999999998, 0.044499999999999998, 0.048000000000000001, 0.043999999999999997, 0.047, 0.0465, 0.048000000000000001, 0.045499999999999999, 0.048000000000000001, 0.047500000000000001, 0.045499999999999999, 0.048000000000000001, 0.0465, 0.044499999999999998, 0.047, 0.0465, 0.045499999999999999, 0.045499999999999999, 0.045999999999999999, 0.045499999999999999, 0.044499999999999998] 1855 ri_data_err['R2_500'] = [0.107, 0.1075, 0.10249999999999999, 0.1135, 0.11899999999999999, 0.11650000000000001, 0.11600000000000001, 0.121, 0.1265, 0.11799999999999999, 0.123, 0.122, 0.1215, 0.1125, 0.17599999999999999, 0.11749999999999999, 0.11749999999999999, 0.123, 0.1145, 0.111, 0.1145, 0.108] 1856 ri_data_err['NOE_500'] = [0.050000000000000003, 0.050000000000000003, 0.050000000000000003, 0.050000000000000003, 0.050000000000000003, 0.050000000000000003, 0.050000000000000003, 0.050000000000000003, 0.050000000000000003, 0.050000000000000003, 0.050000000000000003, 0.050000000000000003, 0.050000000000000003, 0.050000000000000003, 0.050000000000000003, 0.050000000000000003, 0.050000000000000003, 0.050000000000000003, 0.050000000000000003, 0.050000000000000003, 0.050000000000000003, 0.050000000000000003] 1857 ri_data_err['R1_600'] = [0.037999999999999999, 0.040000000000000001, 0.040500000000000001, 0.0395, 0.0385, 0.041000000000000002, 0.040000000000000001, 0.040500000000000001, 0.040000000000000001, 0.042000000000000003, 0.041500000000000002, 0.039, 0.042000000000000003, 0.042000000000000003, 0.0395, 0.040500000000000001, 0.040000000000000001, 0.039, 0.0395, 0.040000000000000001, 0.040500000000000001, 0.039] 1858 ri_data_err['R2_600'] = [0.1125, 0.11550000000000001, 0.108, 0.1235, 0.1265, 0.1275, 0.123, 0.125, 0.1285, 0.12, 0.128, 0.13350000000000001, 0.1225, 0.11899999999999999, 0.1265, 0.1195, 0.128, 0.129, 0.1225, 0.122, 0.1265, 0.1225] 1859 ri_data_err['NOE_600'] = [0.050000000000000003, 0.050000000000000003, 0.050000000000000003, 0.050000000000000003, 0.050000000000000003, 0.050000000000000003, 0.050000000000000003, 0.050000000000000003, 0.050000000000000003, 0.050000000000000003, 0.050000000000000003, 0.050000000000000003, 0.050000000000000003, 0.050000000000000003, 0.050000000000000003, 0.050000000000000003, 0.050000000000000003, 0.050000000000000003, 0.050000000000000003, 0.050000000000000003, 0.050000000000000003, 0.050000000000000003] 1860 ri_data_err['R1_750'] = [0.032500000000000001, 0.034000000000000002, 0.035000000000000003, 0.033500000000000002, 0.032500000000000001, 0.035499999999999997, 0.034000000000000002, 0.034000000000000002, 0.035499999999999997, 0.036499999999999998, 0.033500000000000002, 0.032500000000000001, 0.036999999999999998, 0.035499999999999997, 0.035499999999999997, 0.035000000000000003, 0.033500000000000002, 0.033000000000000002, 0.034000000000000002, 0.033000000000000002, 0.034000000000000002, 0.033500000000000002] 1861 ri_data_err['R2_750'] = [0.1255, 0.1305, 0.11799999999999999, 0.13400000000000001, 0.13800000000000001, 0.13550000000000001, 0.13150000000000001, 0.14050000000000001, 0.13950000000000001, 0.13300000000000001, 0.14000000000000001, 0.14449999999999999, 0.129, 0.13400000000000001, 0.13600000000000001, 0.1295, 0.13850000000000001, 0.13900000000000001, 0.1295, 0.13, 0.13800000000000001, 0.13900000000000001] 1862 ri_data_err['NOE_750'] = [0.050000000000000003, 0.050000000000000003, 0.050000000000000003, 0.050000000000000003, 0.050000000000000003, 0.050000000000000003, 0.050000000000000003, 0.050000000000000003, 0.050000000000000003, 0.050000000000000003, 0.050000000000000003, 0.050000000000000003, 0.050000000000000003, 0.050000000000000003, 0.050000000000000003, 0.050000000000000003, 0.050000000000000003, 0.050000000000000003, 0.050000000000000003, 0.050000000000000003, 0.050000000000000003, 0.050000000000000003] 1863 1864 # Misc tests. 1865 self.assertEqual(cdp.pipe_type, 'mf') 1866 self.assertEqual(cdp.hybrid_pipes, []) 1867 1868 # Diffusion tensor tests. 1869 self.assertEqual(cdp.diff_tensor.type, 'sphere') 1870 self.assertEqual(cdp.diff_tensor.tm, 6.2029050826362826e-09) 1871 1872 # Global minimisation statistic tests. 1873 self.assertEqual(cdp.chi2, 88.0888600975) 1874 self.assertEqual(cdp.iter, 1) 1875 self.assertEqual(cdp.f_count, 20) 1876 self.assertEqual(cdp.g_count, 2) 1877 self.assertEqual(cdp.h_count, 1) 1878 self.assertEqual(cdp.warning, None) 1879 1880 # Global relaxation data tests. 1881 self.assertEqual(cdp.ri_ids, ri_ids) 1882 for ri_id in ri_ids: 1883 self.assertEqual(cdp.ri_type[ri_id], ri_type[ri_id]) 1884 self.assertEqual(cdp.frq[ri_id], frqs[ri_id]) 1885 1886 # Loop over the residues of the original data. 1887 j = 0 1888 for i in xrange(len(cdp.mol[0].res)): 1889 # Aliases 1890 res = cdp.mol[0].res[i] 1891 spin = cdp.mol[0].res[i].spin[0] 1892 1893 # Debugging print out. 1894 print(res) 1895 print(spin) 1896 1897 # Spin info tests. 1898 self.assertEqual(res.num, num[i]) 1899 self.assertEqual(res.name, 'XXX') 1900 self.assertEqual(spin.num, None) 1901 self.assertEqual(spin.name, None) 1902 self.assertEqual(spin.select, select[i]) 1903 self.assertEqual(spin.fixed, False) 1904 1905 # Skip deselected spins. 1906 if not select[i]: 1907 continue 1908 1909 # Structural info. 1910 self.assertEqual(spin.heteronuc_type, '15N') 1911 self.assertEqual(spin.proton_type, '1H') 1912 self.assertEqual(spin.attached_proton, None) 1913 self.assertEqual(spin.nucleus, None) 1914 1915 # Model-free tests. 1916 self.assertEqual(spin.model, model[j]) 1917 self.assertEqual(spin.equation, 'mf_ext') 1918 self.assertEqual(spin.params, params[j]) 1919 self.assertEqual(spin.s2, s2[j]) 1920 self.assertEqual(spin.s2f, s2f[j]) 1921 self.assertEqual(spin.s2s, s2s[j]) 1922 self.assertEqual(spin.local_tm, None) 1923 self.assertEqual(spin.te, None) 1924 if tf[j] != None: 1925 tf[j] = tf[j]*1e-12 1926 self.assertEqual(spin.tf, tf[j]) 1927 self.assertEqual(spin.ts, ts[j]*1e-12) 1928 if rex[j] != None: 1929 rex[j] = rex[j]/(2.0*pi*500000000.0)**2 1930 self.assertEqual(spin.rex, rex[j]) 1931 self.assertEqual(spin.r, 1.0200000000000001e-10) 1932 self.assertEqual(spin.csa, -0.00016999999999999999) 1933 1934 # Minimisation statistic tests. 1935 self.assertEqual(spin.chi2, None) 1936 self.assertEqual(spin.iter, None) 1937 self.assertEqual(spin.f_count, None) 1938 self.assertEqual(spin.g_count, None) 1939 self.assertEqual(spin.h_count, None) 1940 self.assertEqual(spin.warning, None) 1941 1942 # Relaxation data tests. 1943 for ri_id in cdp.ri_ids: 1944 print(ri_id) 1945 self.assertEqual(spin.ri_data[ri_id], ri_data[ri_id][j]) 1946 self.assertEqual(spin.ri_data_err[ri_id], ri_data_err[ri_id][j]) 1947 1948 # Secondary index. 1949 j = j + 1
1950 1951
1952 - def test_read_results_1_2_pse4(self):
1953 """Read the truncated relax 1.2 model-free results file for PSE-4.""" 1954 1955 # Read the results. 1956 self.interpreter.results.read(file='pse4_trunc', dir=status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'model_free') 1957 1958 # Debugging print out. 1959 print(cdp) 1960 1961 # The spin specific data. 1962 num = [24, 27] 1963 name = ['ser', 'gln'] 1964 eqi = [None, 'mf_ext'] 1965 select = [False, True] 1966 model = [None, 'm5'] 1967 params = [[], ['s2f', 's2', 'ts']] 1968 s2 = [None, 0.86578779694713515] 1969 s2f = [None, 0.88618694421409949] 1970 s2s = [None, 0.97698098871784322] 1971 s2s_sim = [[None, None, None], 1972 [0.95852080081635382, 0.97574415413309512, 0.97293450506144197]] 1973 tf = [None, None] 1974 ts = [None, 598.8142249659868e-12] 1975 rex = [None, None] 1976 r = [None, 1.0200000000000001e-10] 1977 csa = [None, -0.00017199999999999998] 1978 ri_ids = ['R1_800', 'NOE_800', 'R1_600', 'R2_600', 'NOE_600', 'R1_500', 'R2_500', 'NOE_500'] 1979 ri_type_list = ['R1', 'NOE', 'R1', 'R2', 'NOE', 'R1', 'R2', 'NOE'] 1980 frq_list = [799744000.0]*2 + [599737000.0]*3 + [499719000.0]*3 1981 ri_data_list = [[], 1982 [0.6835, 0.81850000000000001, 0.98409999999999997, 16.5107, 0.79796699999999998, 1.3174999999999999, 15.381500000000001, 0.73046900000000003]] 1983 ri_data_err_list = [[], 1984 [0.026957200000000001, 0.025881000000000001, 0.0243073, 0.497137, 0.028663000000000001, 0.038550000000000001, 0.40883999999999998, 0.022016299999999999]] 1985 ri_type = {} 1986 frq = {} 1987 ri_data = [{}, {}] 1988 ri_data_err = [{}, {}] 1989 for i in range(len(ri_ids)): 1990 ri_type[ri_ids[i]] = ri_type_list[i] 1991 frq[ri_ids[i]] = frq_list[i] 1992 ri_data[1][ri_ids[i]] = ri_data_list[1][i] 1993 ri_data_err[1][ri_ids[i]] = ri_data_err_list[1][i] 1994 1995 # Misc tests. 1996 self.assertEqual(cdp.pipe_type, 'mf') 1997 self.assertEqual(cdp.hybrid_pipes, []) 1998 1999 # Diffusion tensor tests. 2000 self.assertEqual(cdp.diff_tensor.type, 'ellipsoid') 2001 self.assertEqual(cdp.diff_tensor.tm, 1.2682770910095516e-08) 2002 self.assertEqual(cdp.diff_tensor.tm_err, 2.4053909822304126e-11) 2003 self.assertEqual(cdp.diff_tensor.tm_sim[0], 1.2666656725867738e-08) 2004 self.assertEqual(cdp.diff_tensor.tm_sim[1], 1.2689812011679408e-08) 2005 self.assertEqual(cdp.diff_tensor.tm_sim[2], 1.2698266641804573e-08) 2006 2007 # Global minimisation statistic tests. 2008 self.assertEqual(cdp.chi2, 935.13348627485448) 2009 self.assertEqual(cdp.chi2_sim[0], 898.0981500197106) 2010 self.assertEqual(cdp.chi2_sim[1], 904.11113814725172) 2011 self.assertEqual(cdp.chi2_sim[2], 902.03890817023728) 2012 self.assertEqual(cdp.iter, 1) 2013 self.assertEqual(cdp.iter_sim[0], 23) 2014 self.assertEqual(cdp.iter_sim[1], 30) 2015 self.assertEqual(cdp.iter_sim[2], 16) 2016 self.assertEqual(cdp.f_count, 21) 2017 self.assertEqual(cdp.f_count_sim[0], 61) 2018 self.assertEqual(cdp.f_count_sim[1], 501) 2019 self.assertEqual(cdp.f_count_sim[2], 59) 2020 self.assertEqual(cdp.g_count, 2) 2021 self.assertEqual(cdp.g_count_sim[0], 27) 2022 self.assertEqual(cdp.g_count_sim[1], 34) 2023 self.assertEqual(cdp.g_count_sim[2], 20) 2024 self.assertEqual(cdp.h_count, 1) 2025 self.assertEqual(cdp.h_count_sim[0], 23) 2026 self.assertEqual(cdp.h_count_sim[1], 30) 2027 self.assertEqual(cdp.h_count_sim[2], 16) 2028 self.assertEqual(cdp.warning, None) 2029 self.assertEqual(cdp.warning_sim[0], None) 2030 self.assertEqual(cdp.warning_sim[1], None) 2031 self.assertEqual(cdp.warning_sim[2], None) 2032 2033 # Global relaxation data tests. 2034 self.assertEqual(cdp.ri_ids, ri_ids) 2035 for ri_id in ri_ids: 2036 self.assertEqual(cdp.ri_type[ri_id], ri_type[ri_id]) 2037 self.assertEqual(cdp.frq[ri_id], frq[ri_id]) 2038 2039 # Loop over the residues of the original data. 2040 for i in xrange(len(cdp.mol[0].res)): 2041 # Aliases 2042 res = cdp.mol[0].res[i] 2043 spin = cdp.mol[0].res[i].spin[0] 2044 2045 # Debugging print out. 2046 print(res) 2047 print(spin) 2048 2049 # Spin info tests. 2050 self.assertEqual(res.num, num[i]) 2051 self.assertEqual(res.name, name[i]) 2052 self.assertEqual(spin.num, None) 2053 self.assertEqual(spin.name, None) 2054 self.assertEqual(spin.select, select[i]) 2055 self.assertEqual(spin.fixed, False) 2056 2057 # Structural info. 2058 self.assertEqual(spin.heteronuc_type, '15N') 2059 self.assertEqual(spin.proton_type, '1H') 2060 self.assertEqual(spin.attached_proton, 'H') 2061 #FIXME 2062 #self.assertEqual(spin.nucleus, 'N') 2063 2064 # Model-free tests. 2065 self.assertEqual(spin.model, model[i]) 2066 self.assertEqual(spin.equation, eqi[i]) 2067 self.assertEqual(spin.params, params[i]) 2068 self.assertEqual(spin.s2, s2[i]) 2069 self.assertEqual(spin.s2f, s2f[i]) 2070 self.assertEqual(spin.s2s, s2s[i]) 2071 self.assertEqual(spin.local_tm, None) 2072 self.assertEqual(spin.te, None) 2073 self.assertEqual(spin.tf, tf[i]) 2074 self.assertEqual(spin.ts, ts[i]) 2075 self.assertEqual(spin.rex, rex[i]) 2076 self.assertEqual(spin.r, r[i]) 2077 self.assertEqual(spin.csa, csa[i]) 2078 for j in range(3): 2079 self.assertEqual(spin.s2s_sim[j], s2s_sim[i][j]) 2080 2081 # Minimisation statistic tests. 2082 self.assertEqual(spin.chi2, None) 2083 self.assertEqual(spin.iter, None) 2084 self.assertEqual(spin.f_count, None) 2085 self.assertEqual(spin.g_count, None) 2086 self.assertEqual(spin.h_count, None) 2087 self.assertEqual(spin.warning, None) 2088 2089 # Relaxation data tests. 2090 if i == 0: 2091 self.assertEqual(spin.ri_data, {}) 2092 self.assertEqual(spin.ri_data_err, {}) 2093 else: 2094 for ri_id in ri_ids: 2095 self.assertEqual(spin.ri_data[ri_id], ri_data[i][ri_id]) 2096 self.assertEqual(spin.ri_data_err[ri_id], ri_data_err[i][ri_id])
2097 2098
2099 - def test_read_results_1_2_tem1(self):
2100 """Read the truncated relax 1.2 model-free results file for TEM-1.""" 2101 2102 # Read the results. 2103 self.interpreter.results.read(file='tem1_trunc', dir=status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'model_free') 2104 2105 # Debugging print out. 2106 print(cdp) 2107 2108 # The spin specific data. 2109 num = [26, 27, 29, 30, 31, 32, 33, 34] 2110 name = ['His', 'Pro', 'Thr', 'Leu', 'Val', 'Lys', 'Val', 'Lys'] 2111 eqi = [None, None, None, 'mf_ext', 'mf_orig', 'mf_orig', None, 'mf_orig'] 2112 select = [False, False, False, True, True, True, False, True] 2113 model = [None, None, None, 'm5', 'm2', 'm1', None, 'm1'] 2114 params = [None, None, None, ['s2f', 's2', 'ts'], ['s2', 'te'], ['s2'], None, ['s2']] 2115 s2 = [None, None, None, 0.85674161305142216, 0.89462664243726608, 0.90201790111143165, None, 0.92099297347361675] 2116 s2f = [None, None, None, 0.88220054271390302, None, None, None, None] 2117 s2s = [None, None, None, 0.97114156200339452, None, None, None, None] 2118 te = [None, None, None, None, 43.262426916926735*1e-12, None, None, None] 2119 tf = [None, None, None, None, None, None, None, None] 2120 ts = [None, None, None, 2385.912514843546*1e-12, None, None, None, None] 2121 rex = [None, None, None, None, None, None, None, None] 2122 r = [None, None, None, 1.0200000000000001e-10, 1.0200000000000001e-10, 1.0200000000000001e-10, None, 1.0200000000000001e-10] 2123 csa = [None, None, None, -0.00017199999999999998, -0.00017199999999999998, -0.00017199999999999998, None, -0.00017199999999999998] 2124 ri_ids = ['R1_800', 'R2_800', 'R1_600', 'R2_600', 'NOE_600', 'R1_500', 'R2_500', 'NOE_500'] 2125 ri_type_list = ['R1', 'R2', 'R1', 'R2', 'NOE', 'R1', 'R2', 'NOE'] 2126 frq_list = [799812000.0]*2 + [599739000.0]*3 + [499827000.0]*3 2127 ri_data_list = [[], 2128 [], 2129 [], 2130 [0.75680000000000003, 18.797999999999998, 1.0747, 16.477, 0.86873100000000003, 1.2625999999999999, 15.3367, 0.77803197999999996], 2131 [0.75019999999999998, 19.201599999999999, 1.0617000000000001, 17.652899999999999, 0.73757200000000001, 1.3165, 15.949, 0.72442474000000001], 2132 [0.75860000000000005, 19.303799999999999, 1.0605, 16.593699999999998, 0.79137500000000005, 1.3425, 15.327199999999999, 0.83449132000000004], 2133 [], 2134 [0.71919999999999995, 20.165400000000002, 1.0729, 17.291899999999998, 0.80444599999999999, 1.2971999999999999, 15.9963, 0.73164684999999996]] 2135 ri_data_err_list = [[], 2136 [], 2137 [], 2138 [0.028001600000000001, 0.21729999999999999, 0.031166300000000001, 0.44487900000000002, 0.043210699999999998, 0.054291800000000001, 0.69015199999999999, 0.038901600000000001], 2139 [0.028899999999999999, 0.25640000000000002, 0.030789299999999999, 0.476628, 0.036686799999999999, 0.0566095, 0.71770500000000004, 0.036221200000000002], 2140 [0.033399999999999999, 0.2233, 0.030754500000000001, 0.44802999999999998, 0.039363000000000002, 0.057727500000000001, 0.689724, 0.041724600000000001], 2141 [], 2142 [0.027699999999999999, 0.52810000000000001, 0.031399999999999997, 0.46688099999999999, 0.040013100000000003, 0.055779599999999999, 0.71983399999999997, 0.036582299999999998]] 2143 ri_type = {} 2144 frq = {} 2145 ri_data = [] 2146 ri_data_err = [] 2147 for i in range(len(ri_data_list)): 2148 ri_data.append({}) 2149 ri_data_err.append({}) 2150 2151 for i in range(len(ri_ids)): 2152 ri_type[ri_ids[i]] = ri_type_list[i] 2153 frq[ri_ids[i]] = frq_list[i] 2154 for j in range(len(ri_data_list)): 2155 if len(ri_data_list[j]): 2156 ri_data[j][ri_ids[i]] = ri_data_list[j][i] 2157 ri_data_err[j][ri_ids[i]] = ri_data_err_list[j][i] 2158 2159 chi2 = [None, None, None, 7.9383923597292441, 10.93852890925343, 3.1931459495488084, None, 8.3598891989018611] 2160 iter = [None, None, None, 55, 10, 3, None, 3] 2161 f_count = [None, None, None, 170, 148, 10, None, 10] 2162 g_count = [None, None, None, 60, 14, 6, None, 6] 2163 h_count = [None, None, None, 55, 10, 3, None, 3] 2164 2165 # Misc tests. 2166 self.assertEqual(cdp.pipe_type, 'mf') 2167 self.assertEqual(cdp.hybrid_pipes, []) 2168 2169 # Diffusion tensor tests. 2170 self.assertEqual(cdp.diff_tensor.type, 'ellipsoid') 2171 self.assertEqual(cdp.diff_tensor.tm, 1.2526607261882971e-08) 2172 self.assertEqual(cdp.diff_tensor.Da, 2784606.8835473624) 2173 self.assertEqual(cdp.diff_tensor.Dr, 0.097243698709517518) 2174 self.assertEqual(cdp.diff_tensor.alpha, 48.852555276419558 / 360.0 * 2.0 * pi) 2175 self.assertEqual(cdp.diff_tensor.beta, 9.7876096346750447 / 360.0 * 2.0 * pi) 2176 self.assertEqual(cdp.diff_tensor.gamma, 42.15815798778408 / 360.0 * 2.0 * pi) 2177 2178 # Global relaxation data tests. 2179 self.assertEqual(cdp.ri_ids, ri_ids) 2180 for ri_id in ri_ids: 2181 self.assertEqual(cdp.ri_type[ri_id], ri_type[ri_id]) 2182 self.assertEqual(cdp.frq[ri_id], frq[ri_id]) 2183 2184 # Loop over the residues of the original data. 2185 for i in xrange(len(cdp.mol[0].res)): 2186 # Aliases 2187 res = cdp.mol[0].res[i] 2188 spin = cdp.mol[0].res[i].spin[0] 2189 2190 # Debugging print out. 2191 print(res) 2192 print(spin) 2193 2194 # Spin info tests. 2195 self.assertEqual(res.num, num[i]) 2196 self.assertEqual(res.name, name[i]) 2197 self.assertEqual(spin.num, None) 2198 self.assertEqual(spin.name, None) 2199 self.assertEqual(spin.select, select[i]) 2200 self.assertEqual(spin.fixed, False) 2201 2202 # Structural info. 2203 self.assertEqual(spin.heteronuc_type, '15N') 2204 self.assertEqual(spin.proton_type, '1H') 2205 self.assertEqual(spin.attached_proton, 'H') 2206 #FIXME 2207 #self.assertEqual(spin.nucleus, 'N') 2208 2209 # Model-free tests. 2210 self.assertEqual(spin.model, model[i]) 2211 self.assertEqual(spin.equation, eqi[i]) 2212 self.assertEqual(spin.params, params[i]) 2213 self.assertEqual(spin.s2, s2[i]) 2214 self.assertEqual(spin.s2f, s2f[i]) 2215 self.assertEqual(spin.s2s, s2s[i]) 2216 self.assertEqual(spin.local_tm, None) 2217 self.assertEqual(spin.te, te[i]) 2218 self.assertEqual(spin.tf, tf[i]) 2219 self.assertEqual(spin.ts, ts[i]) 2220 self.assertEqual(spin.rex, rex[i]) 2221 self.assertEqual(spin.r, r[i]) 2222 self.assertEqual(spin.csa, csa[i]) 2223 2224 # Minimisation statistic tests. 2225 self.assertEqual(spin.chi2, chi2[i]) 2226 self.assertEqual(spin.iter, iter[i]) 2227 self.assertEqual(spin.f_count, f_count[i]) 2228 self.assertEqual(spin.g_count, g_count[i]) 2229 self.assertEqual(spin.h_count, h_count[i]) 2230 self.assertEqual(spin.warning, None) 2231 2232 # Relaxation data tests. 2233 print ri_data 2234 if not ri_data[i].keys(): 2235 self.assertEqual(spin.ri_data, {}) 2236 self.assertEqual(spin.ri_data_err, {}) 2237 else: 2238 for ri_id in ri_ids: 2239 self.assertEqual(spin.ri_data[ri_id], ri_data[i][ri_id]) 2240 self.assertEqual(spin.ri_data_err[ri_id], ri_data_err[i][ri_id])
2241 2242
2243 - def test_read_results_1_3(self):
2244 """Read a relax 1.3 model-free results file using the user function results.read().""" 2245 2246 # Path of the files. 2247 path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'model_free'+sep+'OMP' 2248 2249 # Read the results file. 2250 self.interpreter.pipe.create('1.3', 'mf') 2251 self.interpreter.results.read(file='final_results_trunc_1.3', dir=path) 2252 2253 # Read the equivalent 1.2 results file for the checks. 2254 self.interpreter.pipe.create('1.2', 'mf') 2255 self.interpreter.results.read(file='final_results_trunc_1.2', dir=path) 2256 2257 # Get the two data pipes. 2258 pipe_12 = pipes.get_pipe('1.2') 2259 pipe_13 = pipes.get_pipe('1.3') 2260 2261 # Test that the objects in the base pipes are the same. 2262 print("Comparison of the objects of the base data pipe:") 2263 self.object_comparison(obj1=pipe_12, obj2=pipe_13, skip=['mol', 'diff_tensor']) 2264 2265 # Test that the diffusion tensor data is the same. 2266 print("Comparison of the objects of the diffusion tensor:") 2267 self.object_comparison(obj1=pipe_12.diff_tensor, obj2=pipe_13.diff_tensor) 2268 2269 # Test the number of molecules. 2270 self.assertEqual(len(pipe_12.mol), len(pipe_13.mol)) 2271 2272 # Loop over the molecules. 2273 for i in xrange(len(pipe_12.mol)): 2274 # Test the objects. 2275 print("Comparison of the objects of the molecule:") 2276 self.object_comparison(obj1=pipe_12.mol[i], obj2=pipe_13.mol[i], skip=['res']) 2277 2278 # Test the number of residues. 2279 self.assertEqual(len(pipe_12.mol[i].res), len(pipe_13.mol[i].res)) 2280 2281 # Loop over the residues. 2282 for j in xrange(len(pipe_12.mol[i].res)): 2283 # Ok, really don't need to do a full comparison of all 162 residues for this test! 2284 if j > 10: 2285 break 2286 2287 # Test the objects. 2288 print("Comparison of the objects of the residue:") 2289 self.object_comparison(obj1=pipe_12.mol[i].res[j], obj2=pipe_13.mol[i].res[j], skip=['spin']) 2290 2291 # Test the number of spins. 2292 self.assertEqual(len(pipe_12.mol[i].res[j].spin), len(pipe_13.mol[i].res[j].spin)) 2293 2294 # Loop over the spins. 2295 for k in xrange(len(pipe_12.mol[i].res[j].spin)): 2296 # Test the objects. 2297 print("Comparison of the objects of the spin:") 2298 self.object_comparison(obj1=pipe_12.mol[i].res[j].spin[k], obj2=pipe_13.mol[i].res[j].spin[k])
2299 2300 2301
2302 - def test_select_m4(self):
2303 """Selecting model m4 with parameters {S2, te, Rex} using model_free.select_model().""" 2304 2305 # Path of the files. 2306 path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'model_free'+sep+'S2_0.970_te_2048_Rex_0.149' 2307 2308 # Read the sequence. 2309 self.interpreter.sequence.read(file='noe.500.out', dir=path, res_num_col=1, res_name_col=2) 2310 2311 # Select the model. 2312 self.interpreter.model_free.select_model(model='m4') 2313 2314 # Test the model. 2315 self.assertEqual(cdp.mol[0].res[1].spin[0].model, 'm4') 2316 self.assertEqual(cdp.mol[0].res[1].spin[0].params, ['s2', 'te', 'rex'])
2317 2318
2319 - def test_set_bond_length(self):
2320 """Setting the bond length through the user function value.set().""" 2321 2322 # Path of the files. 2323 path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'model_free'+sep+'S2_0.970_te_2048_Rex_0.149' 2324 2325 # Read the sequence. 2326 self.interpreter.sequence.read(file='noe.500.out', dir=path, res_num_col=1, res_name_col=2) 2327 2328 # Set the CSA value. 2329 self.interpreter.value.set(NH_BOND_LENGTH, 'r') 2330 2331 # Test the value. 2332 self.assertEqual(cdp.mol[0].res[1].spin[0].r, NH_BOND_LENGTH)
2333 2334
2335 - def test_set_csa(self):
2336 """Setting the CSA value through the user function value.set().""" 2337 2338 # Path of the files. 2339 path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'model_free'+sep+'S2_0.970_te_2048_Rex_0.149' 2340 2341 # Read the sequence. 2342 self.interpreter.sequence.read(file='noe.500.out', dir=path, res_num_col=1, res_name_col=2) 2343 2344 # Set the CSA value. 2345 self.interpreter.value.set(N15_CSA, 'csa') 2346 2347 # Test the value. 2348 self.assertEqual(cdp.mol[0].res[1].spin[0].csa, N15_CSA)
2349 2350
2351 - def test_set_csa_bond_length(self):
2352 """Setting both the CSA value and bond length through the user function value.set().""" 2353 2354 # Path of the files. 2355 path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'model_free'+sep+'S2_0.970_te_2048_Rex_0.149' 2356 2357 # Read the sequence. 2358 self.interpreter.sequence.read(file='noe.500.out', dir=path, res_num_col=1, res_name_col=2) 2359 2360 # Set the CSA value and bond length simultaneously. 2361 self.interpreter.value.set([N15_CSA, NH_BOND_LENGTH], ['csa', 'r']) 2362 2363 # Test the values. 2364 self.assertEqual(cdp.mol[0].res[1].spin[0].csa, N15_CSA) 2365 self.assertEqual(cdp.mol[0].res[1].spin[0].r, NH_BOND_LENGTH)
2366 2367
2368 - def test_tm0_grid(self):
2369 """Test the optimisation of the tm0 model-free parameter grid.""" 2370 2371 # Initialise. 2372 cdp._model = 'tm0' 2373 cdp._value_test = self.value_test 2374 2375 # Setup the data pipe for optimisation. 2376 self.interpreter.run(script_file=status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'model_free'+sep+'opt_tm0_grid.py')
2377 2378
2379 - def test_tm1_grid(self):
2380 """Test the optimisation of the tm1 model-free parameter grid.""" 2381 2382 # Initialise. 2383 cdp._model = 'tm1' 2384 cdp._value_test = self.value_test 2385 2386 # Setup the data pipe for optimisation. 2387 self.interpreter.run(script_file=status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'model_free'+sep+'opt_tm1_grid.py')
2388 2389
2390 - def test_tm2_grid(self):
2391 """Test the optimisation of the tm2 model-free parameter grid.""" 2392 2393 # Initialise. 2394 cdp._model = 'tm2' 2395 cdp._value_test = self.value_test 2396 2397 # Setup the data pipe for optimisation. 2398 self.interpreter.run(script_file=status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'model_free'+sep+'opt_tm2_grid.py')
2399 2400
2401 - def test_tm3_grid(self):
2402 """Test the optimisation of the tm3 model-free parameter grid.""" 2403 2404 # Initialise. 2405 cdp._model = 'tm3' 2406 cdp._value_test = self.value_test 2407 2408 # Setup the data pipe for optimisation. 2409 self.interpreter.run(script_file=status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'model_free'+sep+'opt_tm3_grid.py')
2410 2411
2412 - def test_tm4_grid(self):
2413 """Test the optimisation of the tm4 model-free parameter grid.""" 2414 2415 # Initialise. 2416 cdp._model = 'tm4' 2417 cdp._value_test = self.value_test 2418 2419 # Setup the data pipe for optimisation. 2420 self.interpreter.run(script_file=status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'model_free'+sep+'opt_tm4_grid.py')
2421 2422
2423 - def test_tm5_grid(self):
2424 """Test the optimisation of the tm5 model-free parameter grid.""" 2425 2426 # Initialise. 2427 cdp._model = 'tm5' 2428 cdp._value_test = self.value_test 2429 2430 # Setup the data pipe for optimisation. 2431 self.interpreter.run(script_file=status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'model_free'+sep+'opt_tm5_grid.py')
2432 2433
2434 - def test_tm6_grid(self):
2435 """Test the optimisation of the tm6 model-free parameter grid.""" 2436 2437 # Initialise. 2438 cdp._model = 'tm6' 2439 cdp._value_test = self.value_test 2440 2441 # Setup the data pipe for optimisation. 2442 self.interpreter.run(script_file=status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'model_free'+sep+'opt_tm6_grid.py')
2443 2444
2445 - def test_tm7_grid(self):
2446 """Test the optimisation of the tm7 model-free parameter grid.""" 2447 2448 # Initialise. 2449 cdp._model = 'tm7' 2450 cdp._value_test = self.value_test 2451 2452 # Setup the data pipe for optimisation. 2453 self.interpreter.run(script_file=status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'model_free'+sep+'opt_tm7_grid.py')
2454 2455
2456 - def test_tm8_grid(self):
2457 """Test the optimisation of the tm8 model-free parameter grid.""" 2458 2459 # Initialise. 2460 cdp._model = 'tm8' 2461 cdp._value_test = self.value_test 2462 2463 # Setup the data pipe for optimisation. 2464 self.interpreter.run(script_file=status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'model_free'+sep+'opt_tm8_grid.py')
2465 2466
2467 - def test_tm9_grid(self):
2468 """Test the optimisation of the tm9 model-free parameter grid.""" 2469 2470 # Initialise. 2471 cdp._model = 'tm9' 2472 cdp._value_test = self.value_test 2473 2474 # Setup the data pipe for optimisation. 2475 self.interpreter.run(script_file=status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'model_free'+sep+'opt_tm9_grid.py')
2476 2477
2478 - def test_tylers_peptide(self):
2479 """Try a component of model-free analysis on Tyler Reddy's peptide data (truncated).""" 2480 2481 # Execute the script. 2482 self.interpreter.run(script_file=status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'model_free'+sep+'tylers_peptide.py')
2483 2484
2485 - def test_write_results(self):
2486 """Writing of model-free results using the user function results.write().""" 2487 2488 # Path of the files. 2489 path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'model_free'+sep+'OMP' 2490 2491 # Read the results file. 2492 self.interpreter.results.read(file='final_results_trunc_1.2', dir=path) 2493 2494 # A dummy file object for catching the results.write() output. 2495 file = DummyFileObject() 2496 2497 # Write the results file into a dummy file. 2498 self.interpreter.results.write(file=file, dir=path) 2499 2500 # Now, get the contents of that file, and then 'close' that file. 2501 test_lines = file.readlines() 2502 file.close() 2503 2504 # Read the 1.3 results file, extract the data, then close it again. 2505 a, b, c = platform.python_version_tuple() 2506 if dep_check.xml_type == 'internal' and int(a) >= 2 and int(b) >= 7 and int(c) >= 3: 2507 file = open_read_file(file_name='final_results_trunc_1.3_new', dir=path) 2508 else: 2509 file = open_read_file(file_name='final_results_trunc_1.3', dir=path) 2510 true_lines = file.readlines() 2511 file.close() 2512 2513 # Test the rest of the lines. 2514 for i in xrange(len(test_lines)): 2515 # Skip the second line, as it contains the date and hence should not be the same. 2516 # Also skip the third line, as the pipe names are different. 2517 if i == 1 or i == 2: 2518 continue 2519 2520 # Try to convert the test line into a python object (for cross-platform support). 2521 try: 2522 test_line = eval(test_lines[i]) 2523 except: 2524 test_line = test_lines[i] 2525 2526 # Try to convert the true line into a python object (for cross-platform support). 2527 try: 2528 true_line = eval(true_lines[i]) 2529 except: 2530 true_line = true_lines[i] 2531 2532 # Test that the line is the same. 2533 self.assertEqual(test_line, true_line)
2534 2535
2536 - def value_test(self, spin, select=True, local_tm=None, s2=None, s2f=None, s2s=None, te=None, tf=None, ts=None, rex=None, chi2=None, iter=None, f_count=None, g_count=None, h_count=None, warning=None):
2537 """Test the optimisation values.""" 2538 2539 # Get the debugging message. 2540 mesg = self.mesg_opt_debug(spin) 2541 2542 # Convert to lists. 2543 if iter != None and not isinstance(iter, list): 2544 iter = [iter] 2545 if f_count != None and not isinstance(f_count, list): 2546 f_count = [f_count] 2547 if g_count != None and not isinstance(g_count, list): 2548 g_count = [g_count] 2549 if h_count != None and not isinstance(h_count, list): 2550 h_count = [h_count] 2551 2552 # Test all the values. 2553 ###################### 2554 2555 # Spin selection. 2556 self.assertEqual(spin.select, select, msg=mesg) 2557 2558 # The local tm correlation time. 2559 if local_tm != None: 2560 self.assertAlmostEqual(spin.local_tm / 1e-9, local_tm, msg=mesg) 2561 else: 2562 self.assertEqual(spin.local_tm, None, msg=mesg) 2563 2564 # S2 order parameter. 2565 if s2 != None: 2566 self.assertAlmostEqual(spin.s2, s2, msg=mesg) 2567 else: 2568 self.assertEqual(spin.s2, None, msg=mesg) 2569 2570 # S2f order parameter. 2571 if s2f != None: 2572 self.assertAlmostEqual(spin.s2f, s2f, 5, msg=mesg) 2573 else: 2574 self.assertEqual(spin.s2f, None, msg=mesg) 2575 2576 # S2s order parameter. 2577 if s2s != None: 2578 self.assertAlmostEqual(spin.s2s, s2s, 5, msg=mesg) 2579 else: 2580 self.assertEqual(spin.s2s, None, msg=mesg) 2581 2582 # te correlation time. 2583 if isinstance(te, float): 2584 self.assertAlmostEqual(spin.te / 1e-12, te, 5, msg=mesg) 2585 elif te == None: 2586 self.assertEqual(spin.te, None, msg=mesg) 2587 2588 # tf correlation time. 2589 if isinstance(tf, float): 2590 self.assertAlmostEqual(spin.tf / 1e-12, tf, 4, msg=mesg) 2591 elif tf == None: 2592 self.assertEqual(spin.tf, None, msg=mesg) 2593 2594 # ts correlation time. 2595 if isinstance(ts, float): 2596 self.assertAlmostEqual(spin.ts / 1e-12, ts, 4, msg=mesg) 2597 elif ts == None: 2598 self.assertEqual(spin.ts, None, msg=mesg) 2599 2600 # Chemical exchange. 2601 if isinstance(rex, float): 2602 self.assertAlmostEqual(spin.rex * (2.0 * pi * cdp.frq[cdp.ri_ids[0]])**2, rex * (2.0 * pi * cdp.frq[cdp.ri_ids[0]])**2, msg=mesg) 2603 elif rex == None: 2604 self.assertEqual(spin.rex, None, msg=mesg) 2605 2606 # The optimisation stats. 2607 if chi2 != None: 2608 self.assertAlmostEqual(spin.chi2, chi2, msg=mesg) 2609 if iter != None: 2610 self.assert_(spin.iter in iter, msg=mesg) 2611 if f_count != None: 2612 self.assert_(spin.f_count in f_count, msg=mesg) 2613 if g_count != None: 2614 self.assert_(spin.g_count in g_count, msg=mesg) 2615 if h_count != None: 2616 self.assert_(spin.h_count in h_count, msg=mesg) 2617 if warning != None: 2618 self.assertEqual(spin.warning, warning, msg=mesg)
2619