1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24 from os import sep
25
26
27 from base_classes import SystemTestCase
28 from generic_fns.mol_res_spin import spin_loop
29 from status import Status; status = Status()
30
31
33 """Class for testing various aspects specific to relaxation data back calculation."""
34
36 """Test the back calculation of relaxation data from model-free results."""
37
38
39 self.interpreter.state.load(state='sphere_trunc', dir=status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'model_free'+sep+'bug_14941_local_tm_global_selection')
40
41
42 self.interpreter.relax_data.back_calc()
43
44
45 ri_data_bc = [{'R2_600': 4.7159538829340821, 'R1_500': 2.4779663389365068, 'NOE_500': 0.51989421750722165, 'R2_500': 4.3440970032224548, 'R1_600': 2.2831801922968129, 'NOE_600': 0.63592506242171432},
46 {'R2_600': 4.7211287713315739, 'R1_500': 2.5267468751446214, 'NOE_500': 0.57703969243842634, 'R2_500': 4.6185111669453738, 'R1_600': 2.2320234021052801, 'NOE_600': 0.66505178335932991}]
47
48
49 index = 0
50 for spin in spin_loop():
51
52 self.assertEqual(spin.ri_data_bc, ri_data_bc[index])
53
54
55 index += 1
56
57
59 """Test the back calculation of specific relaxation data from model-free results."""
60
61
62 self.interpreter.state.load(state='sphere_trunc', dir=status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'model_free'+sep+'bug_14941_local_tm_global_selection')
63
64
65 self.interpreter.relax_data.back_calc('NOE_500')
66
67
68 ri_data_bc = [{'NOE_500': 0.51989421750722165},
69 {'NOE_500': 0.57703969243842634}]
70
71
72 index = 0
73 for spin in spin_loop():
74
75 self.assertEqual(spin.ri_data_bc, ri_data_bc[index])
76
77
78 index += 1
79
80
82 """Test the back calculation of new relaxation data from model-free results."""
83
84
85 self.interpreter.state.load(state='sphere_trunc', dir=status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'model_free'+sep+'bug_14941_local_tm_global_selection')
86
87
88 self.interpreter.relax_data.back_calc('NOE_500.001', ri_type='NOE', frq=500.001e6)
89
90
91 ri_data_bc = [{'NOE_500.001': 0.52064607759431081},
92 {'NOE_500.001': 0.57759452179767434}]
93
94
95 index = 0
96 for spin in spin_loop():
97
98 self.assertEqual(spin.ri_data_bc, ri_data_bc[index])
99
100
101 index += 1
102
103
105 """Test the relax_data.delete user function, replicating bug #19785."""
106
107
108 self.interpreter.run(script_file=status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'bug_19785_relax_data_delete.py')
109
110
111 self.interpreter.pipe.switch('delete 1')
112
113
114 self.assertEqual(cdp.ri_ids, ['R1_900', 'NOE_900', 'R1_500', 'R2_500', 'NOE_500'])
115 self.assert_(not cdp.frq.has_key('R2_900'))
116 self.assert_(not cdp.ri_type.has_key('R2_900'))
117 for spin in spin_loop():
118 self.assert_(not spin.ri_data.has_key('R2_900'))
119 self.assert_(not spin.ri_data_err.has_key('R2_900'))
120
121
122 self.interpreter.pipe.switch('delete 2')
123
124
125 self.assert_(not hasattr(cdp, 'ri_ids'))
126 self.assert_(not hasattr(cdp, 'frq'))
127 self.assert_(not hasattr(cdp, 'ri_type'))
128 for spin in spin_loop():
129 self.assert_(not hasattr(spin, 'ri_data'))
130 self.assert_(not hasattr(spin, 'ri_data_err'))
131
132
134 """Test the relax_data.frq and relax_data.type user functions to reset the data."""
135
136
137 self.interpreter.run(script_file=status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'relax_data_reset.py')
138
139
140 ids = ['R1_900', 'R2_900', 'NOE_900', 'R1_500', 'R2_500', 'NOE_500']
141 frqs = [900100000, 900100000, 900100000, 400100000, 500*1e6, 500*1e6]
142 types = ['R1', 'R2', 'R2', 'R1', 'R2', 'R2']
143
144
145 for i in range(len(ids)):
146 self.assertEqual(cdp.ri_ids[i], ids[i])
147 self.assertAlmostEqual(cdp.frq[ids[i]], frqs[i])
148 self.assertEqual(cdp.ri_type[ids[i]], types[i])
149