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