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