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