Package test_suite :: Package system_tests :: Module n_state_model
[hide private]
[frames] | no frames]

Source Code for Module test_suite.system_tests.n_state_model

  1  ############################################################################### 
  2  #                                                                             # 
  3  # Copyright (C) 2008-2013 Edward d'Auvergne                                   # 
  4  #                                                                             # 
  5  # This file is part of the program relax (http://www.nmr-relax.com).          # 
  6  #                                                                             # 
  7  # This program is free software: you can redistribute it and/or modify        # 
  8  # it under the terms of the GNU General Public License as published by        # 
  9  # the Free Software Foundation, either version 3 of the License, or           # 
 10  # (at your option) any later version.                                         # 
 11  #                                                                             # 
 12  # This program is distributed in the hope that it will be useful,             # 
 13  # but WITHOUT ANY WARRANTY; without even the implied warranty of              # 
 14  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               # 
 15  # GNU General Public License for more details.                                # 
 16  #                                                                             # 
 17  # You should have received a copy of the GNU General Public License           # 
 18  # along with this program.  If not, see <http://www.gnu.org/licenses/>.       # 
 19  #                                                                             # 
 20  ############################################################################### 
 21   
 22  # Python module imports. 
 23  from math import pi, sqrt 
 24  from numpy import array 
 25  from numpy.linalg import norm 
 26  from os import listdir, sep 
 27  from tempfile import mkdtemp 
 28   
 29  # relax module imports. 
 30  from data import Relax_data_store; ds = Relax_data_store() 
 31  from generic_fns.align_tensor import calc_chi_tensor 
 32  from generic_fns.interatomic import interatomic_loop, return_interatom 
 33  from generic_fns.mol_res_spin import return_spin, spin_index_loop, spin_loop 
 34  from generic_fns.pipes import get_pipe 
 35  from status import Status; status = Status() 
 36  from test_suite.system_tests.base_classes import SystemTestCase 
 37   
 38   
39 -class N_state_model(SystemTestCase):
40 """Class for testing various aspects specific to the N-state model.""" 41
42 - def check_vectors(self):
43 """Auxiliary method for checking the correct loading of bond vectors.""" 44 45 # The new order. 46 ds.order_new = array([ds.order_struct[ds.order_model[ds.order_model[0]]], 47 ds.order_struct[ds.order_model[ds.order_model[1]]], 48 ds.order_struct[ds.order_model[ds.order_model[2]]]]) 49 50 # The atom positions. 51 C_pos = [] 52 C_pos.append(array([6.250, 0.948, 1.968])) 53 C_pos.append(array([6.438, -0.139, 1.226])) 54 C_pos.append(array([6.108, -0.169, 0.378])) 55 56 H_pos = [] 57 H_pos.append(array([7.243, 0.580, 1.676])) 58 H_pos.append(array([7.271, -0.291, 0.525])) 59 H_pos.append(array([5.735, 0.003, -0.639])) 60 61 # The real vectors. 62 vect = [] 63 for i in range(3): 64 vect.append(H_pos[i] - C_pos[i]) 65 66 # Normalise. 67 for i in range(3): 68 vect[i] = vect[i] / norm(vect[i]) 69 70 # Print out. 71 print("Structure order: %s" % ds.order_struct) 72 print("Model order: %s" % ds.order_model) 73 print("New order: %s" % ds.order_new) 74 for i in range(3): 75 print("\ni = %i" % i) 76 print("The real vector: %s" % vect[i]) 77 print("The reordered vector: %s" % vect[ds.order_new[i]]) 78 print("The loaded vector: %s" % cdp.interatomic[0].vector[i]) 79 80 # Check. 81 for i in range(3): 82 self.assertAlmostEqual(norm(C_pos[ds.order_new[i]] - cdp.mol[0].res[0].spin[0].pos[i]), 0.0) 83 self.assertAlmostEqual(norm(H_pos[ds.order_new[i]] - cdp.mol[0].res[0].spin[1].pos[i]), 0.0) 84 for i in range(3): 85 self.assertAlmostEqual(norm(vect[ds.order_new[i]] - cdp.interatomic[0].vector[i]), 0.0)
86 87
88 - def test_5_state_xz(self):
89 """A 5-state model in the xz-plane (no pivotting of alpha). 90 91 The 5 states correspond to the Euler angles (z-y-z notation): 92 - State 1: {0, pi/4, 0} 93 - State 2: {0, pi/8, 0} 94 - State 3: {0, 0, 0} 95 - State 4: {0, -pi/8, 0} 96 - State 5: {0, -pi/4, 0} 97 """ 98 99 # Execute the script. 100 self.script_exec(status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'n_state_model'+sep+'5_state_xz.py') 101 102 # Test the optimised probabilities. 103 self.assertAlmostEqual(cdp.probs[0], 0.2) 104 self.assertAlmostEqual(cdp.probs[1], 0.2) 105 self.assertAlmostEqual(cdp.probs[2], 0.2) 106 self.assertAlmostEqual(cdp.probs[3], 0.2) 107 self.assertAlmostEqual(cdp.probs[4], 0.2) 108 109 # Test the optimised alpha Euler angles. 110 self.assertAlmostEqual(cdp.alpha[0], 0.0) 111 self.assertAlmostEqual(cdp.alpha[1], 0.0) 112 self.assertAlmostEqual(cdp.alpha[2], 0.0) 113 self.assertAlmostEqual(cdp.alpha[3], 0.0) 114 self.assertAlmostEqual(cdp.alpha[4], 0.0) 115 116 # Test the optimised beta Euler angles. 117 self.assertAlmostEqual(cdp.beta[0], pi/4) 118 self.assertAlmostEqual(cdp.beta[1], pi/8) 119 self.assertAlmostEqual(cdp.beta[2], 0.0) 120 self.assertAlmostEqual(cdp.beta[3], -pi/8) 121 self.assertAlmostEqual(cdp.beta[4], -pi/4) 122 123 # Test the optimised gamma Euler angles. 124 self.assertAlmostEqual(cdp.gamma[0], 0.0) 125 self.assertAlmostEqual(cdp.gamma[1], 0.0) 126 self.assertAlmostEqual(cdp.gamma[2], 0.0) 127 self.assertAlmostEqual(cdp.gamma[3], 0.0) 128 self.assertAlmostEqual(cdp.gamma[4], 0.0) 129 130 # Test the chi-squared. 131 self.assertAlmostEqual(cdp.chi2, 3.15009916529e-32)
132 133
134 - def test_A_to_chi(self):
135 """Test the conversion of the alignment tensor to the chi tensor.""" 136 137 # Execute the script. 138 self.script_exec(status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'n_state_model'+sep+'A_to_chi.py') 139 140 # Test the optimised values. 141 for i in range(3): 142 self.assertAlmostEqual(cdp.chi[i, i] * 1e32, cdp.chi_ref[i] * 1e32, 2)
143 144
145 - def test_absolute_rdc(self):
146 """Test the fitting of signless RDCs.""" 147 148 # Execute the script. 149 self.script_exec(status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'n_state_model'+sep+'absolute_rdcs.py') 150 151 # Test the optimised values. 152 self.assertAlmostEqual(cdp.align_tensors[0].Axx, -0.351261/2000) 153 self.assertAlmostEqual(cdp.align_tensors[0].Ayy, 0.556994/2000) 154 self.assertAlmostEqual(cdp.align_tensors[0].Axy, -0.506392/2000) 155 self.assertAlmostEqual(cdp.align_tensors[0].Axz, 0.560544/2000) 156 self.assertAlmostEqual(cdp.align_tensors[0].Ayz, -0.286367/2000) 157 self.assertAlmostEqual(cdp.chi2, 0.0) 158 self.assertAlmostEqual(cdp.q_rdc, 0.0) 159 160 # The signless RDC data. 161 rdcs = [5.59633342475, 13.31357940769, 7.03826972130, 3.39286328073, 2.09118060289, 11.44314950665, 9.06351706695, 2.33713806872, 5.81432510092, 13.10212128419, 2.52845064335, 4.70528375938, 4.07965480340, 6.28030444828, 4.69179757106, 2.34216201798, 3.89567105101, 5.51427513007, 0.72184322202, 3.81502890358, 10.88354253947, 1.66151988717, 4.29930397984, 4.46950447650, 6.99742077188, 2.27879506276, 3.64303288709, 6.83945430255, 3.19585334782] 162 163 # Back calc. 164 self.interpreter.rdc.back_calc('abs') 165 166 # Check the spin data. 167 i = 0 168 for spin in spin_loop(): 169 # No PCS. 170 if not hasattr(spin, 'rdc'): 171 continue 172 173 # Check the loaded and back-calculated absolute values. 174 self.assertAlmostEqual(spin.rdc['abs'], abs(rdcs[i])) 175 self.assertAlmostEqual(spin.rdc_bc['abs'], abs(rdcs[i])) 176 177 # Increment the spin index. 178 i += 1
179 180
182 """Test the fitting of signless RDCs for menthol.""" 183 184 # Execute the script. 185 self.script_exec(status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'n_state_model'+sep+'absolute_rdcs_menthol.py') 186 187 # Test the optimised values. 188 self.assertAlmostEqual(cdp.align_tensors[0].Axx, -9.784232367053e-05) 189 self.assertAlmostEqual(cdp.align_tensors[0].Ayy, -7.158933725824e-05) 190 self.assertAlmostEqual(cdp.align_tensors[0].Axy, 4.467570786770e-06) 191 self.assertAlmostEqual(cdp.align_tensors[0].Axz, 5.153319781627e-06) 192 self.assertAlmostEqual(cdp.align_tensors[0].Ayz, 1.801211682780e-04) 193 self.assertAlmostEqual(cdp.chi2, 1044.9572886805781) 194 self.assertAlmostEqual(cdp.q_rdc, 0.0) 195 self.assertAlmostEqual(cdp.q_rdc_norm2, 0.81262759306400001)
196 197
198 - def test_align_fit(self):
199 """Test the use of RDCs and PCSs to find the alignment tensor.""" 200 201 # Set the mode to use both RDCs and PCSs. 202 ds.mode = 'all' 203 tag = 'synth' 204 205 # Execute the script. 206 self.script_exec(status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'n_state_model'+sep+'align_fit.py') 207 208 # Test the optimised values. 209 self.assertAlmostEqual(cdp.align_tensors[0].Axx, -0.351261/2000) 210 self.assertAlmostEqual(cdp.align_tensors[0].Ayy, 0.556994/2000) 211 self.assertAlmostEqual(cdp.align_tensors[0].Axy, -0.506392/2000) 212 self.assertAlmostEqual(cdp.align_tensors[0].Axz, 0.560544/2000) 213 self.assertAlmostEqual(cdp.align_tensors[0].Ayz, -0.286367/2000) 214 self.assertAlmostEqual(cdp.chi2, 0.0) 215 self.assertAlmostEqual(cdp.q_rdc, 0.0) 216 self.assertAlmostEqual(cdp.q_pcs, 0.0) 217 218 # The spin data. 219 pcs = [1.0261275236, 0.75832284646, 0.65377417467, 0.88410306916, 0.83665620282, 1.887881182, 1.6564530832, 1.8489841033, -1.1143070855, -0.52863087918, -0.67600660991, -0.36996952054, -0.50720205688, -0.39889489474, -0.41237130008, -0.71313422816, -0.58642013802, -1.2160818959, -1.3990341569, -1.4084215541, -1.2007391713, -2.1392542193, -2.0165726596, -1.7623442985, -1.6437792517, -1.2415832517, -1.3008765368, -1.5872391105, -1.8060331465, -1.9063640494, -1.9817787999, -0.85264936663, -0.98332177588, -0.13370651687, -0.41762890604, -0.038212181921, -0.37986098085, 0.63582157322, 0.48346482178, 1.7566240094, 1.5694652222, 1.9914499872, 2.5316890107, 1.4559940851, 1.8661428328, 0.65003087965, 0.91690449156, 3.2096229388, 3.5547526651, 3.0579308183, 3.5933428117, 2.9062016872, 3.3750576279, 2.1848555929, 2.4769802024, 1.6466129291, 1.7719619979, 1.1373876736, 1.2182451528] 220 i = 0 221 for spin in spin_loop(): 222 # No PCS. 223 if not hasattr(spin, 'pcs'): 224 continue 225 226 # Check the value. 227 self.assertAlmostEqual(spin.pcs[tag], pcs[i]) 228 229 # Check the back-calculated value. 230 self.assertAlmostEqual(spin.pcs_bc[tag], pcs[i]) 231 232 # Check the simulation values. 233 for sim_index in range(cdp.sim_number): 234 self.assert_(abs(spin.pcs_sim[tag][sim_index] - spin.pcs[tag]) < 6.0*spin.pcs_err[tag]) 235 236 # Increment the spin index. 237 i += 1 238 239 # Back calc. 240 self.interpreter.pcs.back_calc(tag) 241 242 # Check the spin data. 243 i = 0 244 for spin in spin_loop(): 245 # No PCS. 246 if not hasattr(spin, 'pcs'): 247 continue 248 249 # Check the back-calculated value. 250 self.assertAlmostEqual(spin.pcs_bc[tag], pcs[i]) 251 252 # Increment the spin index. 253 i += 1
254 255
256 - def test_align_fit_rand(self):
257 """Test the use of randomised RDCs and PCSs to find the alignment tensor.""" 258 259 # Set the mode to use both RDCs and PCSs. 260 ds.mode = 'all' 261 262 # Select the randomised data. 263 ds.rand = True 264 265 # Execute the script. 266 self.script_exec(status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'n_state_model'+sep+'align_fit.py') 267 268 # The tag. 269 tag = 'synth' 270 271 # Loop a few times. 272 for i in range(4): 273 # Test the optimised values (these values are from relax, so are not 100% reliable as a check). 274 self.assertAlmostEqual(cdp.align_tensors[0].Axx, -0.000189412096996) 275 self.assertAlmostEqual(cdp.align_tensors[0].Ayy, 0.000271130087923) 276 self.assertAlmostEqual(cdp.align_tensors[0].Axy, -0.000264898401302) 277 self.assertAlmostEqual(cdp.align_tensors[0].Axz, 0.000284115871058) 278 self.assertAlmostEqual(cdp.align_tensors[0].Ayz, -0.000152207413184) 279 self.assertAlmostEqual(cdp.chi2, 783.530808266) 280 self.assertAlmostEqual(cdp.q_pcs, 0.063345784112045375) 281 self.assertAlmostEqual(cdp.q_rdc, 0.084926009099013003) 282 283 # Get a spin to check. 284 spin = return_spin(':114@N') 285 interatom = return_interatom(':114@N', ':114@H') 286 287 # Check the RDC and PCS values. 288 self.assertAlmostEqual(interatom.rdc[tag], -8.9193269604999994) 289 self.assertAlmostEqual(interatom.rdc_bc[tag], -9.1030018792821394) 290 self.assertAlmostEqual(spin.pcs[tag], -0.41430390310999998) 291 self.assertAlmostEqual(spin.pcs_bc[tag], -0.39723010845807194) 292 293 # MC sims so next round can check if values change. 294 if i == 0: 295 # Set some errors. 296 for interatom in interatomic_loop(): 297 interatom.rdc_err = {tag: 1.0} 298 for spin in spin_loop(): 299 spin.pcs_err = {tag: 0.1} 300 301 # MC sims. 302 self.interpreter.monte_carlo.setup(number=3) 303 self.interpreter.monte_carlo.create_data() 304 self.interpreter.monte_carlo.initial_values() 305 self.interpreter.minimise('simplex', constraints=False, max_iter=5) 306 self.interpreter.monte_carlo.error_analysis() 307 308 # Back-calc so next round can check if values change. 309 if i == 2: 310 self.interpreter.rdc.back_calc(tag) 311 self.interpreter.pcs.back_calc(tag) 312 313 # Calc Q factors so next round can check if values change. 314 if i == 1: 315 self.interpreter.rdc.calc_q_factors() 316 self.interpreter.pcs.calc_q_factors()
317 318
319 - def test_align_fit_pcs(self):
320 """Test the use of PCSs to find the alignment tensor.""" 321 322 # Set the mode to use PCSs. 323 ds.mode = 'pcs' 324 325 # Execute the script. 326 self.script_exec(status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'n_state_model'+sep+'align_fit.py') 327 328 # Test the optimised values. 329 self.assertAlmostEqual(cdp.align_tensors[0].Axx, -0.351261/2000) 330 self.assertAlmostEqual(cdp.align_tensors[0].Ayy, 0.556994/2000) 331 self.assertAlmostEqual(cdp.align_tensors[0].Axy, -0.506392/2000) 332 self.assertAlmostEqual(cdp.align_tensors[0].Axz, 0.560544/2000) 333 self.assertAlmostEqual(cdp.align_tensors[0].Ayz, -0.286367/2000) 334 self.assertAlmostEqual(cdp.chi2, 0.0) 335 self.assertAlmostEqual(cdp.q_pcs, 0.0)
336 337
338 - def test_align_fit_pcs_rand(self):
339 """Test the use of randomised PCSs to find the alignment tensor.""" 340 341 # Set the mode to use PCSs. 342 ds.mode = 'pcs' 343 344 # Select the randomised data. 345 ds.rand = True 346 347 # Execute the script. 348 self.script_exec(status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'n_state_model'+sep+'align_fit.py') 349 350 # Test the optimised values (these values are from relax, so are not 100% reliable as a check). 351 self.assertAlmostEqual(cdp.align_tensors[0].Axx, -0.000189165581069) 352 self.assertAlmostEqual(cdp.align_tensors[0].Ayy, 0.000271897288335) 353 self.assertAlmostEqual(cdp.align_tensors[0].Axy, -0.000264627388896) 354 self.assertAlmostEqual(cdp.align_tensors[0].Axz, 0.000284180080857) 355 self.assertAlmostEqual(cdp.align_tensors[0].Ayz, -0.00015165641132) 356 self.assertAlmostEqual(cdp.chi2, 756.268087443) 357 self.assertAlmostEqual(cdp.q_pcs, 0.063341567973121266)
358 359
360 - def test_align_fit_rdc(self):
361 """Test the use of RDCs to find the alignment tensor.""" 362 363 # Set the mode to use RDCs. 364 ds.mode = 'rdc' 365 366 # Execute the script. 367 self.script_exec(status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'n_state_model'+sep+'align_fit.py') 368 369 # Test the optimised values. 370 self.assertAlmostEqual(cdp.align_tensors[0].Axx, -0.351261/2000) 371 self.assertAlmostEqual(cdp.align_tensors[0].Ayy, 0.556994/2000) 372 self.assertAlmostEqual(cdp.align_tensors[0].Axy, -0.506392/2000) 373 self.assertAlmostEqual(cdp.align_tensors[0].Axz, 0.560544/2000) 374 self.assertAlmostEqual(cdp.align_tensors[0].Ayz, -0.286367/2000) 375 self.assertAlmostEqual(cdp.chi2, 0.0) 376 self.assertAlmostEqual(cdp.q_rdc, 0.0)
377 378
379 - def test_align_fit_rdc_rand(self):
380 """Test the use of randomised RDCs to find the alignment tensor.""" 381 382 # Set the mode to use RDCs. 383 ds.mode = 'rdc' 384 385 # Select the randomised data. 386 ds.rand = True 387 388 # Execute the script. 389 self.script_exec(status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'n_state_model'+sep+'align_fit.py') 390 391 # Test the optimised values (these are about ~10% different from Pales). 392 # Pales: S(zz) S(xx-yy) S(xy) S(xz) S(yz) 393 # Pales: -9.8124e-05 -5.2533e-04 -3.4446e-04 3.7369e-04 -1.8949e-04 394 self.assertAlmostEqual(cdp.align_tensors[0].Axx, -0.00017045) 395 self.assertAlmostEqual(cdp.align_tensors[0].Ayy, 0.00024905) 396 self.assertAlmostEqual(cdp.align_tensors[0].Axy, -0.00027502) 397 self.assertAlmostEqual(cdp.align_tensors[0].Axz, 0.00029833) 398 self.assertAlmostEqual(cdp.align_tensors[0].Ayz, -0.00015125) 399 self.assertAlmostEqual(cdp.chi2, 23.5877482365) # Pales: 23.709 400 self.assertAlmostEqual(cdp.q_rdc, 0.078460000413257444) # Pales (Q Saupe): 0.079 401 self.assertAlmostEqual(cdp.q_rdc_norm2, 0.14049691097282743) # Pales (Q RDC_RMS): 0.141
402 403
404 - def test_data_copying(self):
405 """The copying of RDC and PCS data from one pipe to another.""" 406 407 # Execute the script. 408 self.script_exec(status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'n_state_model'+sep+'data_copying.py') 409 410 # Get the data pipes. 411 orig = get_pipe('orig') 412 new = get_pipe('new') 413 414 # Check the data. 415 self.assertEqual(orig.rdc_ids, new.rdc_ids) 416 self.assertEqual(orig.pcs_ids, new.pcs_ids) 417 self.assertEqual(orig.align_ids, new.align_ids) 418 419 # Check the spin data. 420 for mol_index, res_index, spin_index in spin_index_loop(): 421 # Alias the spin containers. 422 spin_orig = orig.mol[mol_index].res[res_index].spin[spin_index] 423 spin_new = new.mol[mol_index].res[res_index].spin[spin_index] 424 425 # Loop over the alignments. 426 for id in orig.align_ids: 427 # RDC checks. 428 if hasattr(spin_orig, 'rdc'): 429 # Check the keys. 430 self.assertEqual(spin_orig.rdc.keys(), spin_new.rdc.keys()) 431 432 # Check the values. 433 if id in spin_orig.rdc: 434 self.assertEqual(spin_orig.rdc[id], spin_new.rdc[id]) 435 436 # PCS checks. 437 if hasattr(spin_orig, 'pcs'): 438 # Check the keys. 439 self.assertEqual(spin_orig.pcs.keys(), spin_new.pcs.keys()) 440 441 # Check the values. 442 if id in spin_orig.pcs: 443 self.assertEqual(spin_orig.pcs[id], spin_new.pcs[id])
444 445
447 """The 4-state model analysis of lactose using RDCs and PCSs.""" 448 449 # The model. 450 ds.model = 'fixed' 451 452 # Execute the script. 453 self.script_exec(status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'n_state_model'+sep+'lactose_n_state.py')
454 455
457 """The 4-state model analysis of lactose using RDCs and PCSs.""" 458 459 # The model. 460 ds.model = 'population' 461 462 # Execute the script. 463 self.script_exec(status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'n_state_model'+sep+'lactose_n_state.py')
464 465
466 - def test_mc_sim_failure(self):
467 """Test the setup of the Monte Carlo simulations 468 469 This failed when this test was added, and is probably due to missing data. 470 """ 471 472 # Reset and load the state. 473 path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'saved_states'+sep+'n_state_model_mc_fail.bz2' 474 self.interpreter.reset() 475 self.interpreter.state.load(path) 476 477 # Monte Carlo simulations. 478 self.interpreter.monte_carlo.setup(number=3) 479 self.interpreter.monte_carlo.create_data() 480 self.interpreter.monte_carlo.initial_values() 481 self.interpreter.minimise('newton', constraints=False) 482 self.interpreter.monte_carlo.error_analysis() 483 484 # Activate the optimisation of the paramagnetic centre position and try again. 485 self.interpreter.paramag.centre(fix=False) 486 self.interpreter.monte_carlo.setup(number=3) 487 self.interpreter.monte_carlo.create_data() 488 self.interpreter.monte_carlo.initial_values() 489 self.interpreter.minimise('bfgs', constraints=False, max_iter=100) 490 self.interpreter.monte_carlo.error_analysis()
491 492
493 - def test_metal_pos_opt(self):
494 """Test a certain algorithm for the optimisation of the lanthanide position using RDCs and PCSs (with missing data).""" 495 496 # Execute the script. 497 self.script_exec(status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'n_state_model'+sep+'metal_pos_opt.py') 498 499 # Check the metal position. 500 self.assertAlmostEqual(cdp.paramagnetic_centre[0], -14.845) 501 self.assertAlmostEqual(cdp.paramagnetic_centre[1], 0.969) 502 self.assertAlmostEqual(cdp.paramagnetic_centre[2], 0.265) 503 504 # The actual tensors. 505 A_5D = [] 506 A_5D.append([1.42219822168827662867e-04, -1.44543001566521341940e-04, -7.07796211648713973798e-04, -6.01619494082773244303e-04, 2.02008007072950861996e-04]) 507 A_5D.append([3.56720663040924505435e-04, -2.68385787902088840916e-04, -1.69361406642305853832e-04, 1.71873715515064501074e-04, -3.05790155096090983822e-04]) 508 A_5D.append([2.32088908680377300801e-07, 2.08076808579168379617e-06, -2.21735465435989729223e-06, -3.74311563209448033818e-06, -2.40784858070560310370e-06]) 509 A_5D.append([-2.62495279588228071048e-04, 7.35617367964106275147e-04, 6.39754192258981332648e-05, 6.27880171180572523460e-05, 2.01197582457700226708e-04]) 510 511 # Check the tensors. 512 for i in range(len(A_5D)): 513 self.assertAlmostEqual(cdp.align_tensors[i].Axx, A_5D[i][0]) 514 self.assertAlmostEqual(cdp.align_tensors[i].Ayy, A_5D[i][1]) 515 self.assertAlmostEqual(cdp.align_tensors[i].Axy, A_5D[i][2]) 516 self.assertAlmostEqual(cdp.align_tensors[i].Axz, A_5D[i][3]) 517 self.assertAlmostEqual(cdp.align_tensors[i].Ayz, A_5D[i][4]) 518 519 # Test the optimised values. 520 self.assertAlmostEqual(cdp.chi2, 0.0) 521 self.assertAlmostEqual(cdp.q_rdc, 0.0) 522 self.assertAlmostEqual(cdp.q_pcs, 0.0) 523 524 # The spin data. 525 pcs = { 526 'Dy': [ 0.257602207272000, 0.068336164014900, 0.110603133551000, 0.283488541078000, 0.339904760907000, 0.987042929223000, 0.442512226783000, 0.369383947069000, 0.576421001305000, 0.414840770458000, 0.332707187464000, -0.029503579631700, 0.134647155776000, 0.112481223655000, 0.355198596515000, -0.046913037723100, -0.118710220626000, 0.029273074820300, 0.302949891871000, 1.312854817740000, 0.040875625448800, 0.608281919748000, 0.023360076276000, 0.811293913028000, 0.258701382871000, 0.056025797668300, 0.609547727298000, 0.906885191563000], 527 'Tb': [0.644225239812000, 0.677797993460000, 0.492912191403000, 0.524119985177000, 0.600493382214000, 0.501470795483000, 0.516761193931000, 0.702967176951000, 0.914836321239000, 1.318114995620000, 1.350055099220000, 0.893477362442000, 0.999911636071000, 1.065232203160000, 0.996395971540000, 0.720982749003000, 1.374318729640000, 2.106902457600000], 528 'Tm': [ 0.000125066528687, -0.000564062193363, -0.000607973317902, 0.000090266635200, 0.000174865797403, 0.002488010156480, 0.000830246873289, 0.000762523870219, -0.000096933008248, 0.000742665143642, -0.000215152849719], 529 'Er': [-0.481445160767000, -0.361046693640000, -0.370098680342000, -0.413514467402000, -0.410802287329000, -1.081011578870000, -0.963176128222000, -0.745366702244000, -0.674570724880000, -0.751320872646000, -0.684906087274000, -0.461253969271000, -0.443680922437000, -0.344056233315000, -0.328118573270000, -0.395048353548000, -0.356220572284000, -0.324533952261000, -0.411777498713000, -0.511811581196000, -1.018565433020000, -0.959481602761000, -0.734022165690000, -0.660034918889000, -0.709085634512000, -0.878775632044000, -0.553464480425000, -0.765371835675000, -1.548006987460000] 530 } 531 spin_deselect_blacklist = ['pcs_bc', 'pcs_sim'] 532 533 # Loop over the align IDs. 534 for tag in ['Dy', 'Tb', 'Tm', 'Er']: 535 i = 0 536 for spin, spin_id in spin_loop(return_id=True): 537 # Deselected spin. 538 if not spin.select: 539 print("Checking the deselected spin '%s'" % spin_id) 540 541 # Check that the container is clean. 542 for name in spin_deselect_blacklist: 543 print(" Checking the blacklisted object %s." % name) 544 self.assert_(not hasattr(spin, name)) 545 546 # Skip the rest of the checks. 547 continue 548 549 # No PCS. 550 if not hasattr(spin, 'pcs'): 551 print("No PCS for spin '%s'." % spin_id) 552 continue 553 if not tag in spin.pcs: 554 print("No PCS for the '%s' alignment ID for spin '%s'." % (tag, spin_id)) 555 continue 556 print("Checking '%s' PCS data for spin '%s'" % (tag, spin_id)) 557 558 # Check the value. 559 self.assertAlmostEqual(spin.pcs[tag], pcs[tag][i]) 560 561 # Check the back-calculated value. 562 self.assertAlmostEqual(spin.pcs_bc[tag], pcs[tag][i]) 563 564 # Check the simulation values. 565 for sim_index in range(cdp.sim_number): 566 self.assert_(abs(spin.pcs_sim[tag][sim_index] - spin.pcs[tag]) < 6.0*spin.pcs_err[tag]) 567 568 # Increment the spin index. 569 i += 1 570 571 # The interatomic data. 572 rdc = { 573 'Dy': [-30.671893754700001, -31.307246147099999, -29.358121961700000, -7.235977742280000, -45.562589405399997, -42.816624411200003, -41.019354747700000, -25.361318450599999, -44.1129977796], 574 'Tm': [-0.057386340972700, -0.045650398398700, -0.074873514450400, 0.099056143214600, 0.021275817005300, 0.037132036464200, 0.047340390362400, 0.128745838536000, 0.010906407989400], 575 'Er': [ 22.944150028900001, 23.363231565100001, 25.948323446000000, 6.955380304960000, 1.784067087050000, 7.228324193240000, 8.271072502000001, -7.403618580470000] 576 } 577 interatom_deselect_blacklist = ['rdc_bc', 'rdc_sim'] 578 579 # Loop over the align IDs. 580 for tag in ['Dy', 'Tm', 'Er']: 581 i = 0 582 for interatom in interatomic_loop(): 583 # Deselected interatomic container. 584 if not interatom.select: 585 print("Checking the deselected interatom '%s-%s'" % (interatom.spin_id1, interatom.spin_id2)) 586 587 # Check that the container is clean. 588 for name in interatom_deselect_blacklist: 589 print(" Checking the blacklisted object %s." % name) 590 self.assert_(not hasattr(interatom, name)) 591 592 # Skip the rest of the checks. 593 continue 594 595 # No RDC. 596 if not hasattr(interatom, 'rdc'): 597 print("No RDC for interatom '%s-%s'." % (interatom.spin_id1, interatom.spin_id2)) 598 continue 599 if not tag in interatom.rdc: 600 print("No RDC for the '%s' alignment ID for interatom '%s-%s'." % (tag, interatom.spin_id1, interatom.spin_id2)) 601 continue 602 print("Checking '%s' RDC data for interatom '%s-%s'" % (tag, interatom.spin_id1, interatom.spin_id2)) 603 604 # Check the value. 605 self.assertAlmostEqual(interatom.rdc[tag], rdc[tag][i]) 606 607 # Check the back-calculated value. 608 self.assertAlmostEqual(interatom.rdc_bc[tag], rdc[tag][i]) 609 610 # Check the simulation values. 611 for sim_index in range(cdp.sim_number): 612 self.assert_(abs(interatom.rdc_sim[tag][sim_index] - interatom.rdc[tag]) < 6.0*interatom.rdc_err[tag]) 613 614 # Increment the interatom index. 615 i += 1
616 617
618 - def test_missing_data(self):
619 """Test the use of RDCs and PCSs to find the alignment tensor with missing data.""" 620 621 # Execute the script. 622 self.script_exec(status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'n_state_model'+sep+'missing_data_test.py') 623 624 # The actual tensors. 625 A_5D = [] 626 A_5D.append([1.42219822168827662867e-04, -1.44543001566521341940e-04, -7.07796211648713973798e-04, -6.01619494082773244303e-04, 2.02008007072950861996e-04]) 627 A_5D.append([3.56720663040924505435e-04, -2.68385787902088840916e-04, -1.69361406642305853832e-04, 1.71873715515064501074e-04, -3.05790155096090983822e-04]) 628 A_5D.append([2.32088908680377300801e-07, 2.08076808579168379617e-06, -2.21735465435989729223e-06, -3.74311563209448033818e-06, -2.40784858070560310370e-06]) 629 A_5D.append([-2.62495279588228071048e-04, 7.35617367964106275147e-04, 6.39754192258981332648e-05, 6.27880171180572523460e-05, 2.01197582457700226708e-04]) 630 631 # Check the tensors. 632 for i in range(len(A_5D)): 633 self.assertAlmostEqual(cdp.align_tensors[i].Axx, A_5D[i][0]) 634 self.assertAlmostEqual(cdp.align_tensors[i].Ayy, A_5D[i][1]) 635 self.assertAlmostEqual(cdp.align_tensors[i].Axy, A_5D[i][2]) 636 self.assertAlmostEqual(cdp.align_tensors[i].Axz, A_5D[i][3]) 637 self.assertAlmostEqual(cdp.align_tensors[i].Ayz, A_5D[i][4]) 638 639 # Test the optimised values. 640 self.assertAlmostEqual(cdp.chi2, 0.0) 641 self.assertAlmostEqual(cdp.q_rdc, 0.0) 642 self.assertAlmostEqual(cdp.q_pcs, 0.0)
643 644
645 - def test_monte_carlo_sims(self):
646 """Test the Monte Carlo simulation data of fitting RDCs and PCSs.""" 647 648 # Execute the script. 649 self.script_exec(status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'n_state_model'+sep+'monte_carlo_testing.py') 650 651 # Test the optimised values. 652 self.assertAlmostEqual(cdp.align_tensors[0].Axx, -0.351261/2000) 653 self.assertAlmostEqual(cdp.align_tensors[0].Ayy, 0.556994/2000) 654 self.assertAlmostEqual(cdp.align_tensors[0].Axy, -0.506392/2000) 655 self.assertAlmostEqual(cdp.align_tensors[0].Axz, 0.560544/2000) 656 self.assertAlmostEqual(cdp.align_tensors[0].Ayz, -0.286367/2000) 657 self.assertAlmostEqual(cdp.chi2 / 1e6, 1745860.0485368515 / 1e6, 6) 658 self.assertAlmostEqual(cdp.q_rdc, 0.0) 659 self.assertAlmostEqual(cdp.q_pcs, 0.0) 660 661 # The tensor key. 662 key = 'synth' 663 664 # The spin data. 665 for spin in spin_loop(): 666 # Print out. 667 print(spin) 668 669 # Check for simulation data. 670 self.assert_(hasattr(spin, 'pcs_sim')) 671 self.assert_(key in spin.pcs_sim) 672 673 # Check the values of the simulated data. 674 for i in range(cdp.sim_number): 675 self.assertAlmostEqual(spin.pcs[key], spin.pcs_sim[key][i]) 676 677 # The interatomic data. 678 for interatom in interatomic_loop(): 679 # Print out. 680 print(interatom) 681 682 # Check for simulation data. 683 self.assert_(hasattr(interatom, 'rdc_sim')) 684 self.assert_(key in interatom.rdc_sim) 685 686 # Check the values of the simulated data. 687 for i in range(cdp.sim_number): 688 self.assertAlmostEqual(interatom.rdc[key], interatom.rdc_sim[key][i], 5) 689 690 # Test the optimised simluation values. 691 for i in range(cdp.sim_number): 692 self.assertAlmostEqual(cdp.align_tensors[0].Axx, -0.351261/2000) 693 self.assertAlmostEqual(cdp.align_tensors[0].Ayy, 0.556994/2000) 694 self.assertAlmostEqual(cdp.align_tensors[0].Axy, -0.506392/2000) 695 self.assertAlmostEqual(cdp.align_tensors[0].Axz, 0.560544/2000) 696 self.assertAlmostEqual(cdp.align_tensors[0].Ayz, -0.286367/2000) 697 self.assertAlmostEqual(cdp.chi2 / 1e6, 1745860.0485368515 / 1e6, 5) 698 699 # Test the tensor error values. 700 self.assertAlmostEqual(cdp.align_tensors[0].Axx_err, 0.0) 701 self.assertAlmostEqual(cdp.align_tensors[0].Ayy_err, 0.0) 702 self.assertAlmostEqual(cdp.align_tensors[0].Axy_err, 0.0) 703 self.assertAlmostEqual(cdp.align_tensors[0].Axz_err, 0.0) 704 self.assertAlmostEqual(cdp.align_tensors[0].Ayz_err, 0.0)
705 706
707 - def test_paramag_align_fit(self):
708 """Test the use of RDCs and PCSs to find the alignment tensor.""" 709 710 # Execute the script. 711 self.script_exec(status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'n_state_model'+sep+'paramag_align_fit.py') 712 713 # Test the optimised values. 714 self.assertAlmostEqual(cdp.align_tensors[1].Axx, 0.001414718232784) 715 self.assertAlmostEqual(cdp.align_tensors[1].Ayy, 0.001530457843766) 716 self.assertAlmostEqual(cdp.align_tensors[1].Axy, 0.001689957281873) 717 self.assertAlmostEqual(cdp.align_tensors[1].Axz, 0.000838692329704) 718 self.assertAlmostEqual(cdp.align_tensors[1].Ayz, -0.000984302159683) 719 self.assertAlmostEqual(cdp.q_factors_rdc['Er'], 0.0, 7) 720 self.assertAlmostEqual(cdp.q_factors_rdc_norm2['Er'], 0.0, 7) 721 self.assertAlmostEqual(cdp.q_factors_pcs['Er'], 0.0, 7) 722 self.assertAlmostEqual(cdp.q_rdc, 0.0, 7) 723 self.assertAlmostEqual(cdp.q_pcs, 0.0, 7)
724 725
726 - def test_paramag_centre_fit(self):
727 """Test the use of RDCs and PCSs to find the alignment tensor.""" 728 729 # Set the mode to use both RDCs and PCSs. 730 ds.mode = 'all' 731 732 # Execute the script. 733 self.script_exec(status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'n_state_model'+sep+'paramag_centre_fit.py') 734 735 # Check the paramagnetic centre position. 736 self.assertAlmostEqual(cdp.paramagnetic_centre[0], 32.555, 1) 737 self.assertAlmostEqual(cdp.paramagnetic_centre[1], -19.130, 1) 738 self.assertAlmostEqual(cdp.paramagnetic_centre[2], 27.775, 1) 739 740 # Test the optimised values. 741 self.assertAlmostEqual(cdp.align_tensors[0].Axx, -0.351261/2000, 5) 742 self.assertAlmostEqual(cdp.align_tensors[0].Ayy, 0.556994/2000, 5) 743 self.assertAlmostEqual(cdp.align_tensors[0].Axy, -0.506392/2000, 5) 744 self.assertAlmostEqual(cdp.align_tensors[0].Axz, 0.560544/2000, 5) 745 self.assertAlmostEqual(cdp.align_tensors[0].Ayz, -0.286367/2000, 5) 746 self.assertAlmostEqual(cdp.chi2, 0.0, 2) 747 self.assertAlmostEqual(cdp.q_rdc, 0.0, 2) 748 self.assertAlmostEqual(cdp.q_pcs, 0.0, 2)
749 750
751 - def test_pcs_back_calc(self):
752 """Test the back-calculation of PCSs for ubiquitin.""" 753 754 # Execute the script. 755 self.script_exec(status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'n_state_model'+sep+'pcs_back_calc.py') 756 757 # Test the optimised values. 758 self.assertAlmostEqual(cdp.mol[0].res[0].spin[0].pcs_bc['A'], 0.061941887563792014) 759 self.assertAlmostEqual(cdp.mol[0].res[1].spin[0].pcs_bc['A'], -0.077886567972081502) 760 self.assertAlmostEqual(cdp.mol[0].res[2].spin[0].pcs_bc['A'], -0.13928519099517916)
761 762
763 - def test_pcs_fit_true_pos(self):
764 """Test the fit of DNA PCSs at the true Ln3+ position.""" 765 766 # Set the Ln3+ position. 767 ds.para_centre = 'true' 768 769 # Execute the script. 770 self.script_exec(status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'n_state_model'+sep+'dna_pcs_fit.py') 771 772 # Test the optimised values. 773 self.assertAlmostEqual(cdp.align_tensors[0].Axx, 1.42219822168827662867e-04) 774 self.assertAlmostEqual(cdp.align_tensors[0].Ayy, -1.44543001566521341940e-04) 775 self.assertAlmostEqual(cdp.align_tensors[0].Axy, -7.07796211648713973798e-04) 776 self.assertAlmostEqual(cdp.align_tensors[0].Axz, -6.01619494082773244303e-04) 777 self.assertAlmostEqual(cdp.align_tensors[0].Ayz, 2.02008007072950861996e-04) 778 self.assertAlmostEqual(cdp.chi2, 0.0) 779 self.assertAlmostEqual(cdp.q_pcs, 0.0)
780 781
782 - def test_pcs_fit_zero_pos(self):
783 """Test the fit of DNA PCSs at a Ln3+ position of [0, 0, 0].""" 784 785 # Set the Ln3+ position. 786 ds.para_centre = 'zero' 787 788 # Execute the script. 789 self.script_exec(status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'n_state_model'+sep+'dna_pcs_fit.py') 790 791 # Test the optimised values. 792 self.assertAlmostEqual(cdp.align_tensors[0].Axx, 9.739588118243e-07) 793 self.assertAlmostEqual(cdp.align_tensors[0].Ayy, -1.077401299806e-05) 794 self.assertAlmostEqual(cdp.align_tensors[0].Axy, -2.321033328910e-06) 795 self.assertAlmostEqual(cdp.align_tensors[0].Axz, 5.105903556692e-07) 796 self.assertAlmostEqual(cdp.align_tensors[0].Ayz, 1.676638764825e-05) 797 self.assertAlmostEqual(cdp.chi2, 2125.9562247877066) 798 self.assertAlmostEqual(cdp.q_pcs, 0.76065986767333704) 799 800 # The chi tensor. 801 chi_diag = calc_chi_tensor(cdp.align_tensors[0].A_diag, 799.75376122 * 1e6, 298) 802 chi_diag = chi_diag * 1e33 803 self.assertAlmostEqual((chi_diag[2, 2] - (chi_diag[0, 0] + chi_diag[1, 1])/2.0), -6.726159808496, 5) 804 self.assertAlmostEqual((chi_diag[0, 0] - chi_diag[1, 1]), -3.960936794864, 6)
805 806
807 - def test_pcs_to_rdc(self):
808 """Test the back-calculation of RDCs from a PCS derived tensor.""" 809 810 # Execute the script. 811 self.script_exec(status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'n_state_model'+sep+'pcs_to_rdc.py') 812 813 # Test the values. 814 self.assertAlmostEqual(cdp.interatomic[0].rdc_bc['A'], 4.1319413321530014) 815 self.assertAlmostEqual(cdp.interatomic[1].rdc_bc['A'], -9.5802642470087989) 816 self.assertAlmostEqual(cdp.interatomic[2].rdc_bc['A'], -16.244078605100817)
817 818
819 - def test_rdc_tensor(self):
820 """Test the calculation of an alignment tensor from RDC data.""" 821 822 # Execute the script. 823 self.script_exec(status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'n_state_model'+sep+'rdc_tensor.py')
824 825
826 - def test_stereochem_analysis(self):
827 """The full relative stereochemistry analysis.""" 828 829 # Create a temporary directory for all result files. 830 ds.tmpdir = mkdtemp() 831 832 # Execute the script. 833 self.script_exec(status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'n_state_model'+sep+'stereochem_analysis.py') 834 835 # Check the base directory files. 836 files = listdir(ds.tmpdir) 837 for file in files: 838 print("Checking file %s." % file) 839 self.assert_(file in ['NOE_viol_S_sorted', 'ensembles_superimposed', 'RDC_PAN_dist.agr', 'Q_factors_S', 'NOE_viol_curve.agr', 'NOE_viol_dist.agr', 'RDC_PAN_curve.agr', 'NOE_viol_S', 'Q_factors_R_sorted', 'NOE_results', 'Q_factors_R', 'NOE_viol_R_sorted', 'logs', 'NOE_viol_R', 'Q_factors_S_sorted', 'RDC_PAN_results', 'correlation_plot.agr', 'correlation_plot_scaled.agr']) 840 841 # Check the sub-directory files. 842 subdirs = ['ensembles_superimposed', 'logs', 'NOE_results', 'RDC_PAN_results'] 843 files = [['S0.pdb', 'S2.pdb', 'R0.pdb', 'R1.pdb', 'S1.pdb', 'R2.pdb'], 844 ['RDC_PAN_analysis.log', 'NOE_viol.log'], 845 ['S_results_0.bz2', 'S_results_1.bz2', 'R_results_2.bz2', 'R_results_0.bz2', 'S_results_2.bz2', 'R_results_1.bz2'], 846 ['S_results_0.bz2', 'S_results_1.bz2', 'R_results_2.bz2', 'R_results_0.bz2', 'S_results_2.bz2', 'R_results_1.bz2']] 847 for i in range(len(subdirs)): 848 for file in listdir(ds.tmpdir + sep + subdirs[i]): 849 print("Checking file %s." % file) 850 self.assert_(file in files[i])
851 852
853 - def test_populations(self):
854 """Test the 'population' N-state model optimisation using RDCs and PCSs (with missing data).""" 855 856 # Execute the script. 857 self.script_exec(status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'n_state_model'+sep+'populations.py') 858 859 # The actual tensors. 860 A_5D = [] 861 A_5D.append([1.42219822168827662867e-04, -1.44543001566521341940e-04, -7.07796211648713973798e-04, -6.01619494082773244303e-04, 2.02008007072950861996e-04]) 862 A_5D.append([3.56720663040924505435e-04, -2.68385787902088840916e-04, -1.69361406642305853832e-04, 1.71873715515064501074e-04, -3.05790155096090983822e-04]) 863 A_5D.append([2.32088908680377300801e-07, 2.08076808579168379617e-06, -2.21735465435989729223e-06, -3.74311563209448033818e-06, -2.40784858070560310370e-06]) 864 A_5D.append([-2.62495279588228071048e-04, 7.35617367964106275147e-04, 6.39754192258981332648e-05, 6.27880171180572523460e-05, 2.01197582457700226708e-04]) 865 866 # Check the tensors. 867 for i in range(len(A_5D)): 868 self.assertAlmostEqual(cdp.align_tensors[i].Axx, A_5D[i][0]) 869 self.assertAlmostEqual(cdp.align_tensors[i].Ayy, A_5D[i][1]) 870 self.assertAlmostEqual(cdp.align_tensors[i].Axy, A_5D[i][2]) 871 self.assertAlmostEqual(cdp.align_tensors[i].Axz, A_5D[i][3]) 872 self.assertAlmostEqual(cdp.align_tensors[i].Ayz, A_5D[i][4]) 873 874 # Check the populations. 875 self.assertEqual(len(cdp.probs), 3) 876 self.assertAlmostEqual(cdp.probs[0], 0.3, 5) 877 self.assertAlmostEqual(cdp.probs[1], 0.6, 5) 878 self.assertAlmostEqual(cdp.probs[2], 0.1, 5) 879 880 # Test the optimised values. 881 self.assertAlmostEqual(cdp.chi2, 0.0, 5) 882 self.assertAlmostEqual(cdp.q_rdc, 0.0, 5) 883 self.assertAlmostEqual(cdp.q_pcs, 0.0, 5)
884 885
886 - def test_vector_loading1(self):
887 """Test the loading of inter-atomic vectors in the 'population' N-state model.""" 888 889 # Order. 890 ds.order_struct = [1, 2, 0] 891 ds.order_model = [0, 1, 2] 892 893 # Execute the script. 894 self.script_exec(status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'n_state_model'+sep+'vector_loading.py') 895 896 # Check the vectors. 897 self.check_vectors()
898 899
900 - def test_vector_loading2(self):
901 """Test the loading of inter-atomic vectors in the 'population' N-state model.""" 902 903 # Order. 904 ds.order_struct = [0, 1, 2] 905 ds.order_model = [2, 0, 1] 906 907 # Execute the script. 908 self.script_exec(status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'n_state_model'+sep+'vector_loading.py') 909 910 # Check the vectors. 911 self.check_vectors()
912 913
914 - def test_vector_loading3(self):
915 """Test the loading of inter-atomic vectors in the 'population' N-state model.""" 916 917 # Order. 918 ds.order_struct = [1, 0, 2] 919 ds.order_model = [2, 0, 1] 920 921 # Execute the script. 922 self.script_exec(status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'n_state_model'+sep+'vector_loading.py') 923 924 # Check the vectors. 925 self.check_vectors()
926