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