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