1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 from math import pi
24 import platform
25 import numpy
26 from os import sep
27 from tempfile import mkdtemp
28
29
30 from data_store import Relax_data_store; ds = Relax_data_store()
31 import dep_check
32 from status import Status; status = Status()
33 from test_suite.system_tests.base_classes import SystemTestCase
34
35
36
37 SYSTEM = platform.system()
38 RELEASE = platform.release()
39 VERSION = platform.version()
40 WIN32_VER = platform.win32_ver()
41 DIST = platform.dist()
42 ARCH = platform.architecture()
43 MACH = platform.machine()
44 PROC = platform.processor()
45 PY_VER = platform.python_version()
46 NUMPY_VER = numpy.__version__
47 LIBC_VER = platform.libc_ver()
48
49
50 if SYSTEM == 'Windows' or SYSTEM == 'Microsoft':
51
52 SYSTEM = 'Windows'
53
54
55
57 """TestCase class for the functional tests of the frame order theories."""
58
59 - def __init__(self, methodName='runTest', skip_tests=True):
60 """Skip the tests if scipy is not installed.
61
62 @keyword methodName: The name of the test.
63 @type methodName: str
64 @keyword skip_tests: A flag which if True will cause a large number of redundant tests to be skipped.
65 @type skip_tests: bool
66 """
67
68
69 super(Frame_order, self).__init__(methodName)
70
71
72 blacklist = [
73 'test_cam_free_rotor_pcs',
74 'test_cam_free_rotor_rdc',
75 'test_cam_free_rotor2_pcs',
76 'test_cam_free_rotor2_rdc',
77 'test_cam_iso_cone_pcs',
78 'test_cam_iso_cone_rdc',
79 'test_cam_iso_cone_free_rotor_pcs',
80 'test_cam_iso_cone_free_rotor_rdc',
81 'test_cam_iso_cone_free_rotor2_pcs',
82 'test_cam_iso_cone_free_rotor2_rdc',
83 'test_cam_iso_cone_torsionless_pcs',
84 'test_cam_iso_cone_torsionless_rdc',
85 'test_cam_pseudo_ellipse2_pcs',
86 'test_cam_pseudo_ellipse2_rdc',
87 'test_cam_pseudo_ellipse_free_rotor_pcs',
88 'test_cam_pseudo_ellipse_free_rotor_rdc',
89 'test_cam_pseudo_ellipse_torsionless_pcs',
90 'test_cam_pseudo_ellipse_torsionless_rdc',
91 'test_cam_rigid_pcs',
92 'test_cam_rigid_rdc',
93 'test_cam_rotor_pcs',
94 'test_cam_rotor_rdc',
95 'test_cam_rotor_2_state_pcs',
96 'test_cam_rotor_2_state_rdc',
97 'test_cam_rotor2_pcs',
98 'test_cam_rotor2_rdc'
99 ]
100
101
102 if skip_tests and methodName in blacklist:
103 status.skipped_tests.append([methodName, None, self._skip_type])
104
105
106 if not dep_check.scipy_module:
107
108 status.skipped_tests.append([methodName, 'Scipy', self._skip_type])
109
110
112 """Set up for all the functional tests."""
113
114
115 self.cam_path = status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'frame_order'+sep+'cam'+sep
116
117
118 ds.tmpdir = mkdtemp()
119
120
122 """Clean up after the tests."""
123
124
125 self.interpreter.reset()
126
127
128 if hasattr(status, 'flag_rdc'):
129 del status.flag_rdc
130 if hasattr(status, 'flag_pcs'):
131 del status.flag_pcs
132
133
135 """Check the function evaluation."""
136
137
138 self.interpreter.pipe.switch('frame order')
139
140
141 self.mesg = self.mesg_opt_debug()
142
143
144 if chi2 > 1000.0:
145 chi2 = chi2 / 1000.0
146 chi2_fit = cdp.chi2 / 1000.0
147 elif chi2 > 100.0:
148 chi2 = chi2 / 100.0
149 chi2_fit = cdp.chi2 / 100.0
150 elif chi2 > 10.0:
151 chi2 = chi2 / 10.0
152 chi2_fit = cdp.chi2 / 10.0
153 else:
154 chi2 = chi2
155 chi2_fit = cdp.chi2
156
157
158 self.assertAlmostEqual(chi2_fit, chi2, places, msg=self.mesg)
159
160
161 - def flags(self, rdc=True, pcs=True, opt=False):
162 """Set a number of flags for the scripts."""
163
164
165 status.flag_rdc = rdc
166 status.flag_pcs = pcs
167 status.flag_opt = opt
168
169
171 """Method for returning a string to help debug the minimisation.
172
173 @return: The debugging string.
174 @rtype: str
175 """
176
177
178 string = 'Optimisation failure.\n\n'
179
180
181 string = string + "%-18s%-25s\n" % ("System: ", SYSTEM)
182 string = string + "%-18s%-25s\n" % ("Release: ", RELEASE)
183 string = string + "%-18s%-25s\n" % ("Version: ", VERSION)
184 string = string + "%-18s%-25s\n" % ("Win32 version: ", (WIN32_VER[0] + " " + WIN32_VER[1] + " " + WIN32_VER[2] + " " + WIN32_VER[3]))
185 string = string + "%-18s%-25s\n" % ("Distribution: ", (DIST[0] + " " + DIST[1] + " " + DIST[2]))
186 string = string + "%-18s%-25s\n" % ("Architecture: ", (ARCH[0] + " " + ARCH[1]))
187 string = string + "%-18s%-25s\n" % ("Machine: ", MACH)
188 string = string + "%-18s%-25s\n" % ("Processor: ", PROC)
189 string = string + "%-18s%-25s\n" % ("Python version: ", PY_VER)
190 string = string + "%-18s%-25s\n" % ("Numpy version: ", NUMPY_VER)
191 string = string + "%-18s%-25s\n" % ("Libc version: ", (LIBC_VER[0] + " " + LIBC_VER[1]))
192
193
194
195 string = string + "\n"
196 for param in ['ave_pos_alpha', 'ave_pos_beta', 'ave_pos_gamma', 'eigen_alpha', 'eigen_beta', 'eigen_gamma', 'axis_theta', 'axis_phi', 'cone_theta_x', 'cone_theta_y', 'cone_theta', 'cone_s1', 'cone_sigma_max']:
197 if hasattr(cdp, param):
198 obj = getattr(cdp, param)
199 string = string + "%-15s %30.17g\n" % (param, obj)
200
201 string = string + "%-15s %30.17g\n" % ('chi2:', cdp.chi2)
202 if hasattr(cdp, 'num_int_pts'):
203 string = string + "%-15s %30i\n" % ('num_int_pts:', cdp.num_int_pts)
204 if hasattr(cdp, 'iter') and cdp.iter != None:
205 string = string + "%-15s %30i\n" % ('iter:', cdp.iter)
206 if hasattr(cdp, 'f_count') and cdp.f_count != None:
207 string = string + "%-15s %30i\n" % ('f_count:', cdp.f_count)
208 if hasattr(cdp, 'g_count') and cdp.g_count != None:
209 string = string + "%-15s %30i\n" % ('g_count:', cdp.g_count)
210 if hasattr(cdp, 'h_count') and cdp.h_count != None:
211 string = string + "%-15s %30i\n" % ('h_count:', cdp.h_count)
212 if hasattr(cdp, 'warning'):
213 string = string + "%-15s %30s\n" % ('warning:', cdp.warning)
214
215
216 return string
217
218
219 - def space_probe(self, ref_chi2=None, params=None, delta=3.0 / 360.0 * 2.0 * pi):
220 """Probe the space around the supposed minimum."""
221
222
223 self.interpreter.intro_off()
224
225
226 self.interpreter.calc()
227 print("%-20s %10.5f" % ("chi2 minimum", cdp.chi2))
228 self.assertAlmostEqual(cdp.chi2, ref_chi2)
229
230
231 for param in params:
232 print("\n\nParam: %s" % param)
233 print("%-20s %10.5f" % ("chi2 orig", ref_chi2))
234
235
236 curr = getattr(cdp, param)
237
238
239 setattr(cdp, param, curr+delta)
240 self.interpreter.calc()
241 print("%-20s %10.5f" % ("chi2 up", cdp.chi2))
242 self.assert_(cdp.chi2 > ref_chi2)
243
244
245 setattr(cdp, param, curr-delta)
246 self.interpreter.calc()
247 print("%-20s %10.5f" % ("chi2 down", cdp.chi2))
248 self.assert_(cdp.chi2 > ref_chi2)
249
250
251 setattr(cdp, param, curr)
252
253
255 """Test the free rotor frame order model of CaM."""
256
257
258 self.flags()
259 self.interpreter.run(script_file=self.cam_path+'free_rotor.py')
260 self.check_chi2(26.111745902046135)
261
262
264 """Test the free rotor frame order model of CaM."""
265
266
267 self.flags()
268 self.interpreter.run(script_file=self.cam_path+'free_rotor_missing_data.py')
269 self.check_chi2(19.769652316529044)
270
271
273 """Test the free rotor frame order model of CaM (with only PCS data)."""
274
275
276 self.flags(rdc=False)
277 self.interpreter.run(script_file=self.cam_path+'free_rotor.py')
278 self.check_chi2(26.0561429411961)
279
280
282 """Test the free rotor frame order model of CaM (with only RDC data)."""
283
284
285 self.flags(pcs=False)
286 self.interpreter.run(script_file=self.cam_path+'free_rotor.py')
287 self.check_chi2(0.055602960850032274)
288
289
291 """Test the second free rotor frame order model of CaM."""
292
293
294 self.flags()
295 self.interpreter.run(script_file=self.cam_path+'free_rotor2.py')
296 self.check_chi2(20.036591746561481)
297
298
300 """Test the second free rotor frame order model of CaM (with only PCS data)."""
301
302
303 self.flags(rdc=False)
304 self.interpreter.run(script_file=self.cam_path+'free_rotor2.py')
305 self.check_chi2(19.974062558612736)
306
307
309 """Test the second free rotor frame order model of CaM (with only RDC data)."""
310
311
312 self.flags(pcs=False)
313 self.interpreter.run(script_file=self.cam_path+'free_rotor2.py')
314 self.check_chi2(0.062529187948743833)
315
316
318 """Test the isotropic cone, free rotor frame order model of CaM."""
319
320
321 self.flags()
322 self.interpreter.run(script_file=self.cam_path+'iso_cone.py')
323 self.check_chi2(4.4891048094666539)
324
325
327 """Test the isotropic cone, free rotor frame order model of CaM (with only PCS data)."""
328
329
330 self.flags(rdc=False)
331 self.interpreter.run(script_file=self.cam_path+'iso_cone.py')
332 self.check_chi2(4.4418007653570815)
333
334
336 """Test the isotropic cone, free rotor frame order model of CaM (with only RDC data)."""
337
338
339 self.flags(pcs=False)
340 self.interpreter.run(script_file=self.cam_path+'iso_cone.py')
341 self.check_chi2(0.047304044109578447)
342
343
345 """Test the isotropic cone, free rotor frame order model of CaM."""
346
347
348 self.flags()
349 self.interpreter.run(script_file=self.cam_path+'iso_cone_free_rotor.py')
350 self.check_chi2(31.400316262936347)
351
352
354 """Test the isotropic cone, free rotor frame order model of CaM (with only PCS data)."""
355
356
357 self.flags(rdc=False)
358 self.interpreter.run(script_file=self.cam_path+'iso_cone_free_rotor.py')
359 self.check_chi2(31.340571886727734)
360
361
363 """Test the isotropic cone, free rotor frame order model of CaM (with only RDC data)."""
364
365
366 self.flags(pcs=False)
367 self.interpreter.run(script_file=self.cam_path+'iso_cone_free_rotor.py')
368 self.check_chi2(0.058871004304276831)
369
370
372 """Test the second isotropic cone, free rotor frame order model of CaM."""
373
374
375 self.flags()
376 self.interpreter.run(script_file=self.cam_path+'iso_cone_free_rotor2.py')
377 self.check_chi2(25.367430594567658)
378
379
381 """Test the second isotropic cone, free rotor frame order model of CaM (with only PCS data)."""
382
383
384 self.flags(rdc=False)
385 self.interpreter.run(script_file=self.cam_path+'iso_cone_free_rotor2.py')
386 self.check_chi2(25.326543785930376)
387
388
390 """Test the second isotropic cone, free rotor frame order model of CaM (with only RDC data)."""
391
392
393 self.flags(pcs=False)
394 self.interpreter.run(script_file=self.cam_path+'iso_cone_free_rotor2.py')
395 self.check_chi2(0.034276292191227402)
396
397
399 """Test the second isotropic cone, free rotor frame order model of CaM."""
400
401
402 self.flags()
403 self.interpreter.run(script_file=self.cam_path+'iso_cone_torsionless.py')
404 self.check_chi2(0.18003434152054845)
405
406
408 """Test the second isotropic cone, free rotor frame order model of CaM (with only PCS data)."""
409
410
411 self.flags(rdc=False)
412 self.interpreter.run(script_file=self.cam_path+'iso_cone_torsionless.py')
413 self.check_chi2(0.13111619461084989)
414
415
417 """Test the second isotropic cone, free rotor frame order model of CaM (with only RDC data)."""
418
419
420 self.flags(pcs=False)
421 self.interpreter.run(script_file=self.cam_path+'iso_cone_torsionless.py')
422 self.check_chi2(0.04891814690969206)
423
424
426 """Test the second isotropic cone, free rotor frame order model of CaM."""
427
428
429 self.flags(opt=True)
430 self.interpreter.run(script_file=self.cam_path+'pseudo_ellipse.py')
431 self.check_chi2(1.8246387150578596)
432
433
435 """Test the second isotropic cone, free rotor frame order model of CaM (with only PCS data)."""
436
437
438 self.flags(rdc=False)
439 self.interpreter.run(script_file=self.cam_path+'pseudo_ellipse.py')
440 self.check_chi2(1.7291771910814087)
441
442
444 """Test the second isotropic cone, free rotor frame order model of CaM (with only RDC data)."""
445
446
447 self.flags(pcs=False)
448 self.interpreter.run(script_file=self.cam_path+'pseudo_ellipse.py')
449 self.check_chi2(0.095461523976414595)
450
451
453 """Test the second isotropic cone, free rotor frame order model of CaM."""
454
455
456 self.flags()
457 self.interpreter.run(script_file=self.cam_path+'pseudo_ellipse2.py')
458 self.check_chi2(1.3234054898860625)
459
460
462 """Test the second isotropic cone, free rotor frame order model of CaM (with only PCS data)."""
463
464
465 self.flags(rdc=False)
466 self.interpreter.run(script_file=self.cam_path+'pseudo_ellipse2.py')
467 self.check_chi2(1.2924141815581189)
468
469
471 """Test the second isotropic cone, free rotor frame order model of CaM (with only RDC data)."""
472
473
474 self.flags(pcs=False)
475 self.interpreter.run(script_file=self.cam_path+'pseudo_ellipse2.py')
476 self.check_chi2(0.030991308327923742)
477
478
480 """Test the second isotropic cone, free rotor frame order model of CaM."""
481
482
483 self.flags()
484 self.interpreter.run(script_file=self.cam_path+'pseudo_ellipse_free_rotor.py')
485 self.check_chi2(3.1209520727818716)
486
487
489 """Test the second isotropic cone, free rotor frame order model of CaM (with only PCS data)."""
490
491
492 self.flags(rdc=False)
493 self.interpreter.run(script_file=self.cam_path+'pseudo_ellipse_free_rotor.py')
494 self.check_chi2(3.0780325068058922)
495
496
498 """Test the second isotropic cone, free rotor frame order model of CaM (with only RDC data)."""
499
500
501 self.flags(pcs=False)
502 self.interpreter.run(script_file=self.cam_path+'pseudo_ellipse_free_rotor.py')
503 self.check_chi2(0.042919565975988075)
504
505
507 """Test the second isotropic cone, free rotor frame order model of CaM."""
508
509
510 self.flags()
511 self.interpreter.run(script_file=self.cam_path+'pseudo_ellipse_torsionless.py')
512 self.check_chi2(4.0391154988414177)
513
514
516 """Test the second isotropic cone, free rotor frame order model of CaM (with only PCS data)."""
517
518
519 self.flags(rdc=False)
520 self.interpreter.run(script_file=self.cam_path+'pseudo_ellipse_torsionless.py')
521 self.check_chi2(4.0006946519066426)
522
523
525 """Test the second isotropic cone, free rotor frame order model of CaM (with only RDC data)."""
526
527
528 self.flags(pcs=False)
529 self.interpreter.run(script_file=self.cam_path+'pseudo_ellipse_torsionless.py')
530 self.check_chi2(0.038420846934775092)
531
532
534 """Test the rigid frame order model of CaM."""
535
536
537 self.flags()
538 self.interpreter.run(script_file=self.cam_path+'rigid.py')
539 self.check_chi2(0.081177248776880595)
540
541
543 """Test the rigid frame order model of CaM (with only PCS data)."""
544
545
546 self.flags(rdc=False)
547 self.interpreter.run(script_file=self.cam_path+'rigid.py')
548 self.check_chi2(1.61966778375118e-06)
549
550
552 """Test the rigid frame order model of CaM (with only RDC data)."""
553
554
555 self.flags(pcs=False)
556 self.interpreter.run(script_file=self.cam_path+'rigid.py')
557 self.check_chi2(0.081175629109096842)
558
559
561 """Test the rotor frame order model of CaM."""
562
563
564 self.flags()
565 self.interpreter.run(script_file=self.cam_path+'rotor.py')
566 self.check_chi2(0.081540635994869701)
567
568
570 """Test the rotor frame order model of CaM (with only PCS data)."""
571
572
573 self.flags(rdc=False)
574 self.interpreter.run(script_file=self.cam_path+'rotor.py')
575 self.check_chi2(0.00073477528703013134)
576
577
579 """Test the rotor frame order model of CaM (with only RDC data)."""
580
581
582 self.flags(pcs=False)
583 self.interpreter.run(script_file=self.cam_path+'rotor.py')
584 self.check_chi2(0.080805860707837754)
585
586
588 """Test the 2-state rotor frame order model of CaM."""
589
590
591 self.flags()
592 self.interpreter.run(script_file=self.cam_path+'rotor_2_state.py')
593 self.check_chi2(1.0043926000277981)
594
595
597 """Test the 2-state rotor frame order model of CaM (with only PCS data)."""
598
599
600 self.flags(rdc=False)
601 self.interpreter.run(script_file=self.cam_path+'rotor_2_state.py')
602 self.check_chi2(0.019243235025296658)
603
604
606 """Test the 2-state rotor frame order model of CaM (with only RDC data)."""
607
608
609 self.flags(pcs=False)
610 self.interpreter.run(script_file=self.cam_path+'rotor_2_state.py')
611 self.check_chi2(0.98514936500256733)
612
613
615 """Test the second rotor frame order model of CaM."""
616
617
618 self.flags()
619 self.interpreter.run(script_file=self.cam_path+'rotor2.py')
620 self.check_chi2(0.081769384900455433)
621
622
624 """Test the second rotor frame order model of CaM (with only PCS data)."""
625
626
627 self.flags(rdc=False)
628 self.interpreter.run(script_file=self.cam_path+'rotor2.py')
629 self.check_chi2(0.0010998457430728529)
630
631
633 """Test the second rotor frame order model of CaM (with only RDC data)."""
634
635
636 self.flags(pcs=False)
637 self.interpreter.run(script_file=self.cam_path+'rotor2.py')
638 self.check_chi2(0.080669539157379247)
639
640
642 """Generate the rotor2 distribution of CaM."""
643
644
645 self.interpreter.run(script_file=self.cam_path+'generate_rotor2_distribution.py')
646
647
649 """Test the free rotor frame order model."""
650
651
652 self.script_exec(status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'frame_order'+sep+'model_calcs'+sep+'free_rotor.py')
653
654
655 self.assertAlmostEqual(ds.chi2, 0.0216067401326)
656
657
659 """Test the free rotor frame order model in the eigenframe."""
660
661
662 self.script_exec(status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'frame_order'+sep+'model_calcs'+sep+'free_rotor_eigenframe.py')
663
664
665 self.assertAlmostEqual(ds.chi2, 0.00673210578744)
666
667
669 """Test the isotropic cone frame order model."""
670
671
672 self.script_exec(status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'frame_order'+sep+'model_calcs'+sep+'iso_cone.py')
673
674
675 chi2_ref = []
676 chi2_ref.append(0.131890484593)
677 chi2_ref.append(0.0539383731611)
678 chi2_ref.append(0.0135056297016)
679 chi2_ref.append(0.0163432453475)
680 chi2_ref.append(0.0775570503917)
681 chi2_ref.append(0.0535055367493)
682 chi2_ref.append(0.0994746492483)
683 chi2_ref.append(0.174830826376)
684 chi2_ref.append(0.193036744906)
685 chi2_ref.append(0.181480810794)
686 chi2_ref.append(0.215863920824)
687 chi2_ref.append(0.170088692559)
688 chi2_ref.append(0.152634493383)
689 chi2_ref.append(0.168711907446)
690 chi2_ref.append(0.168405354086)
691 chi2_ref.append(0.247439860108)
692 chi2_ref.append(0.143487410228)
693 chi2_ref.append(0.148318989268)
694
695
696 for i in range(18):
697 self.assertAlmostEqual(ds.chi2[i], chi2_ref[i])
698
699
701 """Test the free rotor isotropic cone frame order model."""
702
703
704 self.script_exec(status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'frame_order'+sep+'model_calcs'+sep+'iso_cone_free_rotor.py')
705
706
707 chi2_ref = []
708 chi2_ref.append(0.0177292447567 )
709 chi2_ref.append(0.0187585146766 )
710 chi2_ref.append(0.0440519894909 )
711 chi2_ref.append(0.0225223798489 )
712 chi2_ref.append(0.0239979046491 )
713 chi2_ref.append(0.0161048633259 )
714 chi2_ref.append(0.0267310958091 )
715 chi2_ref.append(0.0219820914478 )
716 chi2_ref.append(0.0194880630576 )
717 chi2_ref.append(0.0348242343833 )
718 chi2_ref.append(0.0401631858563 )
719 chi2_ref.append(0.0327461783858 )
720 chi2_ref.append(0.0391082177884 )
721 chi2_ref.append(0.0467056691507 )
722 chi2_ref.append(0.0407175857557 )
723 chi2_ref.append(0.0441514158832 )
724 chi2_ref.append(0.042078718831 )
725 chi2_ref.append(0.0403856796359 )
726
727
728 for i in range(18):
729 self.assertAlmostEqual(ds.chi2[i], chi2_ref[i])
730
731
733 """Test the free rotor isotropic cone frame order model in the eigenframe."""
734
735
736 self.script_exec(status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'frame_order'+sep+'model_calcs'+sep+'iso_cone_free_rotor_eigenframe.py')
737
738
739 chi2_ref = []
740 chi2_ref.append(0.115175446978 )
741 chi2_ref.append(0.156911214374 )
742 chi2_ref.append(0.209198723492 )
743 chi2_ref.append(0.155297079942 )
744 chi2_ref.append(0.0684780584219)
745 chi2_ref.append(0.0781922435531)
746 chi2_ref.append(0.103777394815 )
747 chi2_ref.append(0.173740596864 )
748 chi2_ref.append(0.199867814969 )
749 chi2_ref.append(0.297587241555 )
750 chi2_ref.append(0.308539214325 )
751 chi2_ref.append(0.2543934866 )
752 chi2_ref.append(0.168985365277 )
753 chi2_ref.append(0.190780393086 )
754 chi2_ref.append(0.186482798104 )
755 chi2_ref.append(0.153839910288 )
756 chi2_ref.append(0.160863854198 )
757 chi2_ref.append(0.157029368992 )
758
759
760 for i in range(18):
761 self.assertAlmostEqual(ds.chi2[i], chi2_ref[i])
762
763
765 """Test the pseudo-ellipse frame order model."""
766
767
768 self.script_exec(status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'frame_order'+sep+'model_calcs'+sep+'pseudo_ellipse.py')
769
770
771 chi2_ref = []
772 chi2_ref.append(0.0208490007203)
773 chi2_ref.append(0.00958146486076)
774 chi2_ref.append(0.0405488536626)
775 chi2_ref.append(0.0370142845551)
776 chi2_ref.append(0.0204537537661)
777 chi2_ref.append(0.0186122056988)
778 chi2_ref.append(0.0177783016875)
779 chi2_ref.append(0.0311747995923)
780 chi2_ref.append(0.0225532898175)
781 chi2_ref.append(0.0212562065194)
782 chi2_ref.append(0.018939663528)
783 chi2_ref.append(0.0224686987165)
784 chi2_ref.append(0.0201247095045)
785 chi2_ref.append(0.0215343817478)
786 chi2_ref.append(0.016509302331)
787 chi2_ref.append(0.0101988814638)
788 chi2_ref.append(0.00989431182393)
789 chi2_ref.append(0.0123400971524)
790
791
792 for i in range(18):
793 self.assertAlmostEqual(ds.chi2[i], chi2_ref[i])
794
795
797 """Test the free rotor pseudo-elliptic cone frame order model."""
798
799
800 self.script_exec(status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'frame_order'+sep+'model_calcs'+sep+'pseudo_ellipse_free_rotor.py')
801
802
803 chi2_ref = [[], []]
804 chi2_ref[0].append(0.0493245760341)
805 chi2_ref[0].append(0.0322727678945)
806 chi2_ref[0].append(0.0399505883966)
807 chi2_ref[0].append(0.0122539315721)
808 chi2_ref[0].append(0.0263840505182)
809 chi2_ref[0].append(0.0324871952484)
810 chi2_ref[0].append(0.0247369735031)
811 chi2_ref[0].append(0.0231896861006)
812 chi2_ref[0].append(0.0285947802273)
813 chi2_ref[0].append(0.0345542627808)
814 chi2_ref[0].append(0.0289869422491)
815 chi2_ref[0].append(0.0243038470127)
816 chi2_ref[0].append(0.0226686034191)
817 chi2_ref[0].append(0.0215714556045)
818 chi2_ref[0].append(0.0173836730495)
819 chi2_ref[0].append(0.0182530810025)
820 chi2_ref[0].append(0.0212669211551)
821 chi2_ref[0].append(0.0194359136977)
822
823 chi2_ref[1].append(0.0205287391277)
824 chi2_ref[1].append(0.0246463829816)
825 chi2_ref[1].append(0.0590186061204)
826 chi2_ref[1].append(0.0441193978727)
827 chi2_ref[1].append(0.0424299319779)
828 chi2_ref[1].append(0.032589994611)
829 chi2_ref[1].append(0.0523532207508)
830 chi2_ref[1].append(0.0488535879384)
831 chi2_ref[1].append(0.0424063218455)
832 chi2_ref[1].append(0.0553525984677)
833 chi2_ref[1].append(0.0495587286781)
834 chi2_ref[1].append(0.0446625345909)
835 chi2_ref[1].append(0.0470718361239)
836 chi2_ref[1].append(0.0493615476721)
837 chi2_ref[1].append(0.0492208206006)
838 chi2_ref[1].append(0.0429966323771)
839 chi2_ref[1].append(0.0442849187057)
840 chi2_ref[1].append(0.0436756306414)
841
842
843 for j in range(2):
844 for i in range(18):
845 self.assertAlmostEqual(ds.chi2[j][i], chi2_ref[j][i])
846
847
849 """Test the pseudo-ellipse frame order model."""
850
851
852 self.script_exec(status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'frame_order'+sep+'model_calcs'+sep+'pseudo_ellipse_torsionless.py')
853
854
855 chi2_ref = []
856 chi2_ref.append(0.340228489225)
857 chi2_ref.append(0.260847963487)
858 chi2_ref.append(0.250610744982)
859 chi2_ref.append(0.228947619476)
860 chi2_ref.append(0.251996758815)
861 chi2_ref.append(0.238724080817)
862 chi2_ref.append(0.182383602599)
863 chi2_ref.append(0.172830852017)
864 chi2_ref.append(0.159757813028)
865 chi2_ref.append(0.173833227524)
866 chi2_ref.append(0.156168102428)
867 chi2_ref.append(0.171406869781)
868 chi2_ref.append(0.202653838515)
869 chi2_ref.append(0.198919351788)
870 chi2_ref.append(0.169463187543)
871 chi2_ref.append(0.156867571611)
872 chi2_ref.append(0.146139931983)
873 chi2_ref.append(0.13307108095 )
874
875
876 for i in range(18):
877 self.assertAlmostEqual(ds.chi2[i], chi2_ref[i])
878
879
881 """Test the rotor frame order model."""
882
883
884 self.script_exec(status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'frame_order'+sep+'model_calcs'+sep+'rotor.py')
885
886
887 chi2_ref = []
888 chi2_ref.append(0.00410277546707 )
889 chi2_ref.append(0.00112443204411 )
890 chi2_ref.append(0.00759196190331 )
891 chi2_ref.append(0.0956596925692 )
892 chi2_ref.append(0.223717470059 )
893 chi2_ref.append(0.136723330704 )
894 chi2_ref.append(0.0588253217034 )
895 chi2_ref.append(0.0774693384156 )
896 chi2_ref.append(0.0855477856492 )
897 chi2_ref.append(0.198089516589 )
898 chi2_ref.append(0.227537351664 )
899 chi2_ref.append(0.202005777915 )
900 chi2_ref.append(0.192550395736 )
901 chi2_ref.append(0.126007906472 )
902 chi2_ref.append(0.124053264662 )
903 chi2_ref.append(0.18203965973 )
904 chi2_ref.append(0.191062017006 )
905 chi2_ref.append(0.13580013153 )
906
907
908 for i in range(18):
909 self.assertAlmostEqual(ds.chi2[i], chi2_ref[i])
910
911
913 """Test the rotor frame order model in the eigenframe."""
914
915
916 self.script_exec(status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'frame_order'+sep+'model_calcs'+sep+'rotor_eigenframe.py')
917
918
919 chi2_ref = []
920 chi2_ref.append(0.00308229284128)
921 chi2_ref.append(0.0117874014708 )
922 chi2_ref.append(0.0016108171487 )
923 chi2_ref.append(0.00532862954549)
924 chi2_ref.append(0.097784753109 )
925 chi2_ref.append(0.157147901966 )
926 chi2_ref.append(0.182397051711 )
927 chi2_ref.append(0.338977916543 )
928 chi2_ref.append(0.208516866654 )
929 chi2_ref.append(0.137660115226 )
930 chi2_ref.append(0.0580816149373 )
931 chi2_ref.append(0.0476543367845 )
932 chi2_ref.append(0.0360689584006 )
933 chi2_ref.append(0.0118024492136 )
934 chi2_ref.append(0.0824307041139 )
935 chi2_ref.append(0.0920614159956 )
936 chi2_ref.append(0.0936464288916 )
937 chi2_ref.append(0.0823025718101 )
938
939
940 for i in range(18):
941 self.assertAlmostEqual(ds.chi2[i], chi2_ref[i])
942
943
945 """Test the mapping of the Euler angle parameters for OpenDx viewing."""
946
947
948 self.script_exec(status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'frame_order'+sep+'opendx_euler_angle_map.py')
949
950
952 """Test the 'rigid' model for unrotated tensors with no motion."""
953
954
955 self.script_exec(status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'frame_order'+sep+'opt_rigid_no_rot.py')
956
957
958 self.mesg = self.mesg_opt_debug()
959
960
961 self.assertEqual(cdp.iter, 92, msg=self.mesg)
962 self.assertEqual(cdp.chi2, 0.0, msg=self.mesg)
963 self.assertEqual(cdp.ave_pos_alpha, 0.0, msg=self.mesg)
964 self.assertEqual(cdp.ave_pos_beta, 0.0, msg=self.mesg)
965 self.assertEqual(cdp.ave_pos_gamma, 0.0, msg=self.mesg)
966
967
969 """Test the 'rigid' model for randomly rotated tensors with no motion."""
970
971
972 self.script_exec(status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'frame_order'+sep+'opt_rigid_rand_rot.py')
973
974
975 self.mesg = self.mesg_opt_debug()
976
977
978 self.assertAlmostEqual(cdp.chi2, 3.085356555118994e-26, msg=self.mesg)
979 self.assertAlmostEqual(cdp.ave_pos_alpha, 5.0700283197712777, msg=self.mesg)
980 self.assertAlmostEqual(cdp.ave_pos_beta, 2.5615753919522359, msg=self.mesg)
981 self.assertAlmostEqual(cdp.ave_pos_gamma, 0.64895449611163691, msg=self.mesg)
982
983
985 """Parametric restriction of the isotropic cone to the free rotor isotropic cone frame order model."""
986
987
988 self.script_exec(status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'frame_order'+sep+'parametric_restriction'+sep+'iso_cone_to_iso_cone_free_rotor.py')
989
990
991 chi2_ref = []
992 chi2_ref.append(0.0177292447567 )
993 chi2_ref.append(0.0187585146766 )
994 chi2_ref.append(0.0440519894909 )
995 chi2_ref.append(0.0225223798489 )
996 chi2_ref.append(0.0239979046491 )
997 chi2_ref.append(0.0161048633259 )
998 chi2_ref.append(0.0267310958091 )
999 chi2_ref.append(0.0219820914478 )
1000 chi2_ref.append(0.0194880630576 )
1001 chi2_ref.append(0.0348242343833 )
1002 chi2_ref.append(0.0401631858563 )
1003 chi2_ref.append(0.0327461783858 )
1004 chi2_ref.append(0.0391082177884 )
1005 chi2_ref.append(0.0467056691507 )
1006 chi2_ref.append(0.0407175857557 )
1007 chi2_ref.append(0.0441514158832 )
1008 chi2_ref.append(0.042078718831 )
1009 chi2_ref.append(0.0403856796359 )
1010
1011
1012 for i in range(18):
1013 self.assertAlmostEqual(ds.chi2[i], chi2_ref[i])
1014
1015
1017 """Parametric restriction of the pseudo-ellipse to the isotropic cone frame order model."""
1018
1019
1020 self.script_exec(status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'frame_order'+sep+'parametric_restriction'+sep+'pseudo_ellipse_to_iso_cone.py')
1021
1022
1023 chi2_ref = []
1024 chi2_ref.append(0.131890484593)
1025 chi2_ref.append(0.0539383731611)
1026 chi2_ref.append(0.0135056297016)
1027 chi2_ref.append(0.0163432453475)
1028 chi2_ref.append(0.0775570503917)
1029 chi2_ref.append(0.0535055367493)
1030 chi2_ref.append(0.0994746492483)
1031 chi2_ref.append(0.174830826376)
1032 chi2_ref.append(0.193036744906)
1033 chi2_ref.append(0.181480810794)
1034 chi2_ref.append(0.215863920824)
1035 chi2_ref.append(0.170088692559)
1036 chi2_ref.append(0.152634493383)
1037 chi2_ref.append(0.168711907446)
1038 chi2_ref.append(0.168405354086)
1039 chi2_ref.append(0.247439860108)
1040 chi2_ref.append(0.143487410228)
1041 chi2_ref.append(0.148318989268)
1042
1043
1044 for i in range(18):
1045 self.assertAlmostEqual(ds.chi2[i], chi2_ref[i])
1046
1047
1049 """Parametric restriction of the pseudo-ellipse to the free rotor isotropic cone frame order model."""
1050
1051
1052 self.script_exec(status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'frame_order'+sep+'parametric_restriction'+sep+'pseudo_ellipse_to_iso_cone_free_rotor.py')
1053
1054
1055 chi2_ref = []
1056 chi2_ref.append(0.0177292447567 )
1057 chi2_ref.append(0.0187585146766 )
1058 chi2_ref.append(0.0440519894909 )
1059 chi2_ref.append(0.0225223798489 )
1060 chi2_ref.append(0.0239979046491 )
1061 chi2_ref.append(0.0161048633259 )
1062 chi2_ref.append(0.0267310958091 )
1063 chi2_ref.append(0.0219820914478 )
1064 chi2_ref.append(0.0194880630576 )
1065 chi2_ref.append(0.0348242343833 )
1066 chi2_ref.append(0.0401631858563 )
1067 chi2_ref.append(0.0327461783858 )
1068 chi2_ref.append(0.0391082177884 )
1069 chi2_ref.append(0.0467056691507 )
1070 chi2_ref.append(0.0407175857557 )
1071 chi2_ref.append(0.0441514158832 )
1072 chi2_ref.append(0.042078718831 )
1073 chi2_ref.append(0.0403856796359 )
1074
1075
1076 for i in range(18):
1077 self.assertAlmostEqual(ds.chi2[i], chi2_ref[i])
1078
1079
1081 """Parametric restriction of the pseudo-ellipse to the isotropic cone frame order model."""
1082
1083
1084 self.script_exec(status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'frame_order'+sep+'parametric_restriction'+sep+'pseudo_ellipse_free_rotor_to_iso_cone.py')
1085
1086
1087 chi2_ref = []
1088 chi2_ref.append(16957.4964577)
1089 chi2_ref.append(15727.13869)
1090 chi2_ref.append(13903.0982799)
1091 chi2_ref.append(11719.9390681)
1092 chi2_ref.append(9488.44060873)
1093 chi2_ref.append(7425.57820642)
1094 chi2_ref.append(5713.6467735)
1095 chi2_ref.append(4393.3273949)
1096 chi2_ref.append(3452.97770868)
1097 chi2_ref.append(2771.90973598)
1098 chi2_ref.append(2247.44444894)
1099 chi2_ref.append(1788.58977266)
1100 chi2_ref.append(1348.38250916)
1101 chi2_ref.append(921.060703519)
1102 chi2_ref.append(539.03217075)
1103 chi2_ref.append(244.341444558)
1104 chi2_ref.append(58.4566671195)
1105 chi2_ref.append(0.148318989268)
1106
1107
1108 for i in range(18):
1109 self.assertAlmostEqual(ds.chi2[i], chi2_ref[i])
1110
1111
1113 """Parametric restriction of the free rotor pseudo-ellipse to the free rotor isotropic cone frame order model."""
1114
1115
1116 self.script_exec(status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'frame_order'+sep+'parametric_restriction'+sep+'pseudo_ellipse_free_rotor_to_iso_cone_free_rotor.py')
1117
1118
1119 chi2_ref = []
1120 chi2_ref.append(0.0177292447567 )
1121 chi2_ref.append(0.0187585146766 )
1122 chi2_ref.append(0.0440519894909 )
1123 chi2_ref.append(0.0225223798489 )
1124 chi2_ref.append(0.0239979046491 )
1125 chi2_ref.append(0.0161048633259 )
1126 chi2_ref.append(0.0267310958091 )
1127 chi2_ref.append(0.0219820914478 )
1128 chi2_ref.append(0.0194880630576 )
1129 chi2_ref.append(0.0348242343833 )
1130 chi2_ref.append(0.0401631858563 )
1131 chi2_ref.append(0.0327461783858 )
1132 chi2_ref.append(0.0391082177884 )
1133 chi2_ref.append(0.0467056691507 )
1134 chi2_ref.append(0.0407175857557 )
1135 chi2_ref.append(0.0441514158832 )
1136 chi2_ref.append(0.042078718831 )
1137 chi2_ref.append(0.0403856796359 )
1138
1139
1140 for i in range(18):
1141 self.assertAlmostEqual(ds.chi2[i], chi2_ref[i])
1142
1143
1145 """Test the pseudo-ellipse target function."""
1146
1147
1148 self.script_exec(status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'frame_order'+sep+'pseudo_ellipse.py')
1149
1150
1151 chi2 = 0.015865464136741975
1152
1153
1154 self.space_probe(ref_chi2=chi2, params=['ave_pos_alpha', 'ave_pos_beta', 'ave_pos_gamma', 'eigen_alpha', 'eigen_beta', 'eigen_gamma', 'cone_theta_x', 'cone_theta_y', 'cone_sigma_max'])
1155
1156
1158 """Test the torsionless pseudo-ellipse target function."""
1159
1160
1161 self.script_exec(status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'frame_order'+sep+'pseudo_ellipse_torsionless.py')
1162
1163
1164 chi2 = 2.8393866813588198
1165
1166
1167 self.space_probe(ref_chi2=chi2, params=['ave_pos_alpha', 'ave_pos_beta', 'ave_pos_gamma', 'eigen_alpha', 'eigen_beta', 'eigen_gamma', 'cone_theta_x', 'cone_theta_y'])
1168
1169
1171 """Test the free rotor target function for the data from a rigid test molecule."""
1172
1173
1174 ds.model = 'free rotor'
1175
1176
1177 self.script_exec(status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'frame_order'+sep+'rigid_test.py')
1178
1179
1180 self.assertAlmostEqual(cdp.chi2, 94337.620142880114)
1181
1182
1184 """Test the iso cone target function for the data from a rigid test molecule."""
1185
1186
1187 ds.model = 'iso cone'
1188
1189
1190 self.script_exec(status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'frame_order'+sep+'rigid_test.py')
1191
1192
1193 self.assertAlmostEqual(cdp.chi2, 177.13243371265614)
1194
1195
1197 """Test the iso cone, free rotor target function for the data from a rigid test molecule."""
1198
1199
1200 ds.model = 'iso cone, free rotor'
1201
1202
1203 self.script_exec(status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'frame_order'+sep+'rigid_test.py')
1204
1205
1206 self.assertAlmostEqual(cdp.chi2, 101218.55718817962)
1207
1208
1210 """Test the iso cone, torsionless target function for the data from a rigid test molecule."""
1211
1212
1213 ds.model = 'iso cone, torsionless'
1214
1215
1216 self.script_exec(status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'frame_order'+sep+'rigid_test.py')
1217
1218
1219 self.assertAlmostEqual(cdp.chi2, 2.7993179077540402)
1220
1221
1223 """Test the rigid target function for the data from a rigid test molecule."""
1224
1225
1226 ds.model = 'rigid'
1227
1228
1229 self.script_exec(status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'frame_order'+sep+'rigid_test.py')
1230
1231
1232 self.assertAlmostEqual(cdp.chi2, 0.0113763520134, 5)
1233
1234
1236 """Test the rotor target function for the data from a rigid test molecule."""
1237
1238
1239 ds.model = 'rotor'
1240
1241
1242 self.script_exec(status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'frame_order'+sep+'rigid_test.py')
1243
1244
1245 self.assertAlmostEqual(cdp.chi2, 0.96883720077954039)
1246
1247
1249 """Test the pseudo-ellipse target function for the data from a rigid test molecule."""
1250
1251
1252 ds.model = 'pseudo-ellipse'
1253
1254
1255 self.script_exec(status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'frame_order'+sep+'rigid_test.py')
1256
1257
1258 self.assertAlmostEqual(cdp.chi2, 177.13243371265639)
1259
1260
1262 """Test the pseudo-ellipse, torsionless target function for the data from a rigid test molecule."""
1263
1264
1265 ds.model = 'pseudo-ellipse, torsionless'
1266
1267
1268 self.script_exec(status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'frame_order'+sep+'rigid_test.py')
1269
1270
1271 self.assertAlmostEqual(cdp.chi2, 2.7993179077540522)
1272