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