Author: bugman Date: Sun Nov 17 13:06:17 2013 New Revision: 21475 URL: http://svn.gna.org/viewcvs/relax?rev=21475&view=rev Log: Created the Relax_disp.test_tp02_data_to_tap03 system test. This is the Trott et al, 2003 R1rho analytic model for 2-site off-resonance exchange. This follows the tutorial for adding relaxation dispersion models at: http://wiki.nmr-relax.com/Tutorial_for_adding_relaxation_dispersion_models_to_relax#The_test_suite This was copied from the Relax_disp.test_tp02_data_to_mp05 system test. Modified: branches/relax_disp/test_suite/system_tests/relax_disp.py Modified: branches/relax_disp/test_suite/system_tests/relax_disp.py URL: http://svn.gna.org/viewcvs/relax/branches/relax_disp/test_suite/system_tests/relax_disp.py?rev=21475&r1=21474&r2=21475&view=diff ============================================================================== --- branches/relax_disp/test_suite/system_tests/relax_disp.py (original) +++ branches/relax_disp/test_suite/system_tests/relax_disp.py Sun Nov 17 13:06:17 2013 @@ -2202,6 +2202,62 @@ spin_index += 1 + def test_tp02_data_to_tap03(self): + """Test the dispersion 'TAP03' model fitting against the 'TP02' test data.""" + + # Fixed time variable and the models. + ds.fixed = True + ds.models = ['R2eff', 'TAP03'] + + # Execute the script. + self.interpreter.run(script_file=status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'relax_disp'+sep+'r1rho_off_res_tp02.py') + + # The original TP02 parameters. + #r1rho_prime = [[10.0, 15.0], [12.0, 18.0]] + #pA = 0.7654321 + #kex = 1234.56789 + #delta_omega = [7.0, 9.0] + + # The equivalent TAP03 parameters. + r1rho_prime = [[10.0058087306952, 15.0058071785643], [11.9997883441526, 17.9972824143268]] + pA = [0.775054986621315, 0.806128964050712] + kex = [1235.20228577117, 1220.23684410068] + delta_omega = [7.08193971314044, 9.69856821121164] + chi2 = [0.0370400968687155, 8.28321387676908e-06] + + # Alias the spins. + spin1 = cdp.mol[0].res[0].spin[0] + spin2 = cdp.mol[0].res[1].spin[0] + + # Printout. + print("\n\nOptimised parameters:\n") + print("%-20s %-20s %-20s" % ("Parameter", "Value (:1)", "Value (:2)")) + print("%-20s %20.15g %20.15g" % ("R2 (500 MHz)", spin1.r2[0], spin2.r2[0])) + print("%-20s %20.15g %20.15g" % ("R2 (800 MHz)", spin1.r2[1], spin2.r2[1])) + print("%-20s %20.15g %20.15g" % ("pA", spin1.pA, spin2.pA)) + print("%-20s %20.15g %20.15g" % ("dw", spin1.dw, spin2.dw)) + print("%-20s %20.15g %20.15g" % ("kex", spin1.kex, spin2.kex)) + print("%-20s %20.15g %20.15g\n" % ("chi2", spin1.chi2, spin2.chi2)) + + # Switch to the 'MP05' model data pipe, then check for each spin. + self.interpreter.pipe.switch('TAP03') + spin_index = 0 + for spin, spin_id in spin_loop(return_id=True): + # Printout. + print("\nSpin %s." % spin_id) + + # Check the fitted parameters. + self.assertAlmostEqual(spin.r2[0]/10, r1rho_prime[spin_index][0]/10, 4) + self.assertAlmostEqual(spin.r2[1]/10, r1rho_prime[spin_index][1]/10, 4) + self.assertAlmostEqual(spin.pA, pA[spin_index], 3) + self.assertAlmostEqual(spin.dw, delta_omega[spin_index], 3) + self.assertAlmostEqual(spin.kex/1000.0, kex[spin_index]/1000.0, 3) + self.assertAlmostEqual(spin.chi2, chi2[spin_index], 3) + + # Increment the spin index. + spin_index += 1 + + def test_tp02_data_to_tp02(self): """Test the relaxation dispersion 'TP02' model curve fitting to fixed time synthetic data."""