1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 from os import sep
24
25
26 from pipe_control.mol_res_spin import spin_loop
27 from status import Status; status = Status()
28 from test_suite.system_tests.base_classes import SystemTestCase
29
30
32 """Class for testing various aspects specific to relaxation data back calculation."""
33
35 """Test the back calculation of relaxation data from model-free results (U{bug #14941<https://web.archive.org/web/https://gna.org/bugs/?14941>})."""
36
37
38 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')
39
40
41 self.interpreter.relax_data.back_calc()
42
43
44 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},
45 {'R2_600': 4.7211287713315739, 'R1_500': 2.5267468751446214, 'NOE_500': 0.57703969243842634, 'R2_500': 4.6185111669453738, 'R1_600': 2.2320234021052801, 'NOE_600': 0.66505178335932991}]
46
47
48 index = 0
49 for spin in spin_loop():
50
51 if not spin.select:
52 continue
53
54
55 self.assertEqual(spin.ri_data_bc, ri_data_bc[index])
56
57
58 index += 1
59
60
62 """Test the back calculation of specific relaxation data from model-free results (U{bug #14941<https://web.archive.org/web/https://gna.org/bugs/?14941>})."""
63
64
65 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')
66
67
68 self.interpreter.relax_data.back_calc('NOE_500')
69
70
71 ri_data_bc = [{'NOE_500': 0.51989421750722165},
72 {'NOE_500': 0.57703969243842634}]
73
74
75 index = 0
76 for spin in spin_loop():
77
78 if not spin.select:
79 continue
80
81
82 self.assertEqual(spin.ri_data_bc, ri_data_bc[index])
83
84
85 index += 1
86
87
89 """Test the back calculation of new relaxation data from model-free results (U{bug #14941<https://web.archive.org/web/https://gna.org/bugs/?14941>})."""
90
91
92 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')
93
94
95 self.interpreter.relax_data.back_calc('NOE_500.001', ri_type='NOE', frq=500.001e6)
96
97
98 ri_data_bc = [{'NOE_500.001': 0.52064607759431081},
99 {'NOE_500.001': 0.57759452179767434}]
100
101
102 index = 0
103 for spin in spin_loop():
104
105 if not spin.select:
106 continue
107
108
109 self.assertEqual(spin.ri_data_bc, ri_data_bc[index])
110
111
112 index += 1
113
114
116 """Test the relax_data.delete user function, replicating U{bug #19785<https://web.archive.org/web/https://gna.org/bugs/?19785>}."""
117
118
119 self.interpreter.run(script_file=status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'bug_19785_relax_data_delete.py')
120
121
122 self.interpreter.pipe.switch('delete 1')
123
124
125 self.assertEqual(cdp.ri_ids, ['R1_900', 'NOE_900', 'R1_500', 'R2_500', 'NOE_500'])
126 self.assertTrue(not 'R2_900' in cdp.spectrometer_frq)
127 self.assertTrue(not 'R2_900' in cdp.ri_type)
128 for spin in spin_loop():
129
130 if spin.name in ['H', 'HE1']:
131 self.assertTrue(not hasattr(spin, 'ri_data'))
132
133
134 else:
135 self.assertTrue(not 'R2_900' in spin.ri_data)
136 self.assertTrue(not 'R2_900' in spin.ri_data_err)
137
138
139 self.interpreter.pipe.switch('delete 2')
140
141
142 self.assertTrue(not hasattr(cdp, 'ri_ids'))
143 self.assertTrue(not hasattr(cdp, 'spectrometer_frq'))
144 self.assertTrue(not hasattr(cdp, 'ri_type'))
145 for spin in spin_loop():
146 self.assertTrue(not hasattr(spin, 'ri_data'))
147 self.assertTrue(not hasattr(spin, 'ri_data_err'))
148
149
151 """Test the relax_data.frq and relax_data.type user functions to reset the data."""
152
153
154 self.interpreter.run(script_file=status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'relax_data_reset.py')
155
156
157 ids = ['R1_900', 'R2_900', 'NOE_900', 'R1_500', 'R2_500', 'NOE_500']
158 frqs = [900100000, 900100000, 900100000, 400100000, 500*1e6, 500*1e6]
159 types = ['R1', 'R2', 'R2', 'R1', 'R2', 'R2']
160
161
162 for i in range(len(ids)):
163 self.assertEqual(cdp.ri_ids[i], ids[i])
164 self.assertAlmostEqual(cdp.spectrometer_frq[ids[i]], frqs[i])
165 self.assertEqual(cdp.ri_type[ids[i]], types[i])
166