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