Author: bugman Date: Tue Oct 29 12:20:19 2013 New Revision: 21305 URL: http://svn.gna.org/viewcvs/relax?rev=21305&view=rev Log: Created the Relax_disp.test_hansen_cpmg_data_auto_analysis_r2eff system test. This is to test the full dispersion auto-analysis on Flemming Hansen's CPMG data using the original R2eff data rather than the derived peak heights. Added: branches/relax_disp/test_suite/system_tests/scripts/relax_disp/hansen_r2eff_data.py - copied, changed from r21304, branches/relax_disp/test_suite/system_tests/scripts/relax_disp/hansen_data.py 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=21305&r1=21304&r2=21305&view=diff ============================================================================== --- branches/relax_disp/test_suite/system_tests/relax_disp.py (original) +++ branches/relax_disp/test_suite/system_tests/relax_disp.py Tue Oct 29 12:20:19 2013 @@ -554,6 +554,84 @@ spin71 = return_spin(":71") self.assertEqual(spin70.model, 'NS CPMG 2-site expanded') self.assertEqual(spin71.model, 'No Rex') + + + def test_hansen_cpmg_data_auto_analysis_r2eff(self): + """Test of the dispersion auto-analysis using Dr. Flemming Hansen's CPMG data (using the original R2eff data). + + This uses the data from Dr. Flemming Hansen's paper at http://dx.doi.org/10.1021/jp074793o. This is CPMG data with a fixed relaxation time period. + """ + + # Set the model. + ds.models = [ + MODEL_NOREX, + MODEL_LM63, + MODEL_CR72, + MODEL_IT99 + ] + + # Execute the script. + self.interpreter.run(script_file=status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'relax_disp'+sep+'hansen_r2eff_data.py') + + # The 'No Rex' model checks. + self.interpreter.pipe.switch(pipe_name='No Rex') + spin70 = return_spin(":70") + spin71 = return_spin(":71") + print("\n\nOptimised parameters:\n") + print("%-20s %-20s %-20s" % ("Parameter", "Value (:70)", "Value (:71)")) + print("%-20s %20.15g %20.15g" % ("R2 (500 MHz)", spin70.r2[0], spin71.r2[0])) + print("%-20s %20.15g %20.15g" % ("R2 (800 MHz)", spin70.r2[1], spin71.r2[1])) + print("%-20s %20.15g %20.15g\n" % ("chi2", spin70.chi2, spin71.chi2)) + self.assertAlmostEqual(spin70.r2[0], 10.5340573632181, 4) + self.assertAlmostEqual(spin70.r2[1], 16.1113049920324, 4) + self.assertAlmostEqual(spin70.chi2, 2832.28562307, 4) + self.assertAlmostEqual(spin71.r2[0], 5.83137814994754, 4) + self.assertAlmostEqual(spin71.chi2, 73.6219146835821, 4) + + # The 'LM63' model checks. + self.interpreter.pipe.switch(pipe_name='LM63') + spin70 = return_spin(":70") + spin71 = return_spin(":71") + print("\n\nOptimised parameters:\n") + print("%-20s %-20s %-20s" % ("Parameter", "Value (:70)", "Value (:71)")) + print("%-20s %20.15g %20.15g" % ("R2 (500 MHz)", spin70.r2[0], spin71.r2[0])) + print("%-20s %20.15g %20.15g" % ("R2 (800 MHz)", spin70.r2[1], spin71.r2[1])) + print("%-20s %20.15g %20.15g" % ("phi_ex", spin70.phi_ex, spin71.phi_ex)) + print("%-20s %20.15g %20.15g" % ("kex", spin70.kex, spin71.kex)) + print("%-20s %20.15g %20.15g\n" % ("chi2", spin70.chi2, spin71.chi2)) + self.assertAlmostEqual(spin70.r2[0], 6.7725779040626, 4) + self.assertAlmostEqual(spin70.r2[1], 6.6495102881274, 4) + self.assertAlmostEqual(spin70.phi_ex, 0.308228782539112, 4) + self.assertAlmostEqual(spin70.kex/10000, 4644.35027966526/10000, 4) + self.assertAlmostEqual(spin70.chi2, 137.64638621224, 4) + self.assertAlmostEqual(spin71.r2[0], 4.92986568906445, 4) + self.assertAlmostEqual(spin71.phi_ex, 0.0595701347673553, 4) + self.assertAlmostEqual(spin71.kex/10000, 2566.66176813506/10000, 4) + self.assertAlmostEqual(spin71.chi2, 2.31424715490254, 4) + + # The 'CR72' model checks. These models have not reached the minima due to the low quality optimisation! + self.interpreter.pipe.switch(pipe_name='CR72') + spin70 = return_spin(":70") + spin71 = return_spin(":71") + print("\n\nOptimised parameters:\n") + print("%-20s %-20s %-20s" % ("Parameter", "Value (:70)", "Value (:71)")) + print("%-20s %20.15g %20.15g" % ("R2 (500 MHz)", spin70.r2[0], spin71.r2[0])) + print("%-20s %20.15g %20.15g" % ("R2 (800 MHz)", spin70.r2[1], spin71.r2[1])) + print("%-20s %20.15g %20.15g" % ("pA", spin70.pA, spin71.pA)) + print("%-20s %20.15g %20.15g" % ("dw", spin70.dw, spin71.dw)) + print("%-20s %20.15g %20.15g" % ("kex", spin70.kex, spin71.kex)) + print("%-20s %20.15g %20.15g\n" % ("chi2", spin70.chi2, spin71.chi2)) + self.assertAlmostEqual(spin70.r2[0], 6.97532271825192, 4) + self.assertAlmostEqual(spin70.r2[1], 9.45051817816538, 4) + self.assertAlmostEqual(spin70.pA, 0.989800346795472, 4) + self.assertAlmostEqual(spin70.dw, 5.61326926915313, 4) + self.assertAlmostEqual(spin70.kex/10000, 1713.02295468519/10000, 4) + self.assertAlmostEqual(spin70.chi2, 17.3955972313639, 4) + self.assertAlmostEqual(spin71.r2[0], 0.589453313816438, 2) + self.assertAlmostEqual(spin71.pA, 0.500005674625128, 2) + self.assertAlmostEqual(spin71.dw, 199.873875627265, 2) + self.assertAlmostEqual(spin71.kex, 10.7154862578618, 2) + self.assertAlmostEqual(spin71.chi2, 57.9468501661789, 2) def test_hansen_cpmg_data_to_cr72(self): Copied: branches/relax_disp/test_suite/system_tests/scripts/relax_disp/hansen_r2eff_data.py (from r21304, branches/relax_disp/test_suite/system_tests/scripts/relax_disp/hansen_data.py) URL: http://svn.gna.org/viewcvs/relax/branches/relax_disp/test_suite/system_tests/scripts/relax_disp/hansen_r2eff_data.py?p2=branches/relax_disp/test_suite/system_tests/scripts/relax_disp/hansen_r2eff_data.py&p1=branches/relax_disp/test_suite/system_tests/scripts/relax_disp/hansen_data.py&r1=21304&r2=21305&rev=21305&view=diff ============================================================================== --- branches/relax_disp/test_suite/system_tests/scripts/relax_disp/hansen_data.py (original) +++ branches/relax_disp/test_suite/system_tests/scripts/relax_disp/hansen_r2eff_data.py Tue Oct 29 12:20:19 2013 @@ -8,6 +8,9 @@ from data_store import Relax_data_store; ds = Relax_data_store() from status import Status; status = Status() + +# Analysis variables. +##################### # The dispersion models. MODELS = ['LM63'] @@ -30,6 +33,9 @@ +# Set up the data pipe. +####################### + # Create the data pipe. pipe_name = 'base pipe' pipe_bundle = 'relax_disp' @@ -38,18 +44,63 @@ # The path to the data files. data_path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'dispersion'+sep+'Hansen' -# Load the saved base pipe -results.read(data_path+sep+'base_pipe') -deselect.spin(":4") +# Load the sequence. +sequence.read('fake_sequence.in', dir=status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'dispersion'+sep+'Hansen', res_num_col=1, res_name_col=2) -# Set the nuclear isotope data. -spin.isotope('15N') +# Name the spins so they can be matched to the assignments, and the isotope for field strength scaling. +spin.name(name='N') +spin.isotope(isotope='15N') -# Create the R2eff data pipe and load the results. -pipe.create(pipe_name='R2eff', bundle=pipe_bundle, pipe_type='relax_disp') -pipe.switch(pipe_name='R2eff') -results.read(data_path+sep+'r2eff_pipe') -deselect.spin(":4") +# The spectral data - peak list file name, CPMG frequency (Hz), spectrometer frequency in Hertz. +data = [ + ['500_MHz'+sep+'reference.in', None, 500e6], + ['500_MHz'+sep+'66.667.in', 66.6666, 500e6], + ['500_MHz'+sep+'133.33.in', 133.3333, 500e6], + ['500_MHz'+sep+'133.33.in.bis', 133.3333, 500e6], + ['500_MHz'+sep+'200.in', 200.0000, 500e6], + ['500_MHz'+sep+'266.67.in', 266.6666, 500e6], + ['500_MHz'+sep+'333.33.in', 333.3333, 500e6], + ['500_MHz'+sep+'400.in', 400.0000, 500e6], + ['500_MHz'+sep+'466.67.in', 466.6666, 500e6], + ['500_MHz'+sep+'533.33.in', 533.3333, 500e6], + ['500_MHz'+sep+'533.33.in.bis', 533.3333, 500e6], + ['500_MHz'+sep+'600.in', 600.0000, 500e6], + ['500_MHz'+sep+'666.67.in', 666.6666, 500e6], + ['500_MHz'+sep+'733.33.in', 733.3333, 500e6], + ['500_MHz'+sep+'800.in', 800.0000, 500e6], + ['500_MHz'+sep+'866.67.in', 866.6666, 500e6], + ['500_MHz'+sep+'933.33.in', 933.3333, 500e6], + ['500_MHz'+sep+'933.33.in.bis', 933.3333, 500e6], + ['500_MHz'+sep+'1000.in', 1000.0000, 500e6], + ['800_MHz'+sep+'reference.in', None, 800e6], + ['800_MHz'+sep+'66.667.in', 66.6666, 800e6], + ['800_MHz'+sep+'133.33.in', 133.3333, 800e6], + ['800_MHz'+sep+'133.33.in.bis', 133.3333, 800e6], + ['800_MHz'+sep+'200.in', 200.0000, 800e6], + ['800_MHz'+sep+'266.67.in', 266.6666, 800e6], + ['800_MHz'+sep+'333.33.in', 333.3333, 800e6], + ['800_MHz'+sep+'400.in', 400.0000, 800e6], + ['800_MHz'+sep+'466.67.in', 466.6666, 800e6], + ['800_MHz'+sep+'533.33.in', 533.3333, 800e6], + ['800_MHz'+sep+'533.33.in.bis', 533.3333, 800e6], + ['800_MHz'+sep+'600.in', 600.0000, 800e6], + ['800_MHz'+sep+'666.67.in', 666.6666, 800e6], + ['800_MHz'+sep+'733.33.in', 733.3333, 800e6], + ['800_MHz'+sep+'800.in', 800.0000, 800e6], + ['800_MHz'+sep+'866.67.in', 866.6666, 800e6], + ['800_MHz'+sep+'933.33.in', 933.3333, 800e6], + ['800_MHz'+sep+'933.33.in.bis', 933.3333, 800e6], + ['800_MHz'+sep+'1000.in', 1000.0000, 800e6] +] + +# Loop over the spectra. +for file, cpmg_frq, H_frq in data: + relax_disp.r2eff_read(file=file, dir=data_path, exp_type='CPMG', frq=H_frq, disp_frq=cpmg_frq, res_num_col=1, data_col=2, error_col=3) + +# Deselect unresolved spins. +deselect.read(file='unresolved', dir=data_path+sep+'500_MHz', res_num_col=1) +deselect.read(file='unresolved', dir=data_path+sep+'800_MHz', res_num_col=1) + # Auto-analysis execution.