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