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