Author: bugman Date: Sun Jun 9 10:52:44 2013 New Revision: 19985 URL: http://svn.gna.org/viewcvs/relax?rev=19985&view=rev Log: Created the Relax_disp.test_r1rho_on_res_fixed_time_m61b system test. This is for the Meiboom 1961 on-resonance 2-site model for skewed populations (pA >> pB). This commit follows step 7 of the relaxation dispersion model addition tutorial (http://thread.gmane.org/gmane.science.nmr.relax.devel/3907). Added: branches/relax_disp/test_suite/system_tests/scripts/relax_disp/r1rho_on_res_m61b.py - copied, changed from r19979, branches/relax_disp/test_suite/system_tests/scripts/relax_disp/r1rho_on_res_m61.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=19985&r1=19984&r2=19985&view=diff ============================================================================== --- branches/relax_disp/test_suite/system_tests/relax_disp.py (original) +++ branches/relax_disp/test_suite/system_tests/relax_disp.py Sun Jun 9 10:52:44 2013 @@ -29,7 +29,7 @@ from auto_analyses import relax_disp from data_store import Relax_data_store; ds = Relax_data_store() from pipe_control.mol_res_spin import spin_loop -from specific_analyses.relax_disp.variables import MODEL_LIST_CPMG +from specific_analyses.relax_disp.variables import MODEL_LIST_CPMG, MODEL_M61B, MODEL_R2EFF from status import Status; status = Status() from test_suite.system_tests.base_classes import SystemTestCase @@ -562,3 +562,49 @@ # Increment the spin index. spin_index += 1 + + + def test_r1rho_on_res_fixed_time_m61b(self): + """Test the relaxation dispersion 'M61 skew' model curve fitting to fixed time synthetic data.""" + + # Execute the script. + self.interpreter.run(script_file=status.install_path + sep+'test_suite'+sep+'system_tests'+sep+'scripts'+sep+'relax_disp'+sep+'r1rho_on_res_m61b.py') + + # The original parameters. + i0 = [100000.0, 20000.0] + r1rho_prime = [2.25, 24.0] + pA = 0.95 + kex = 2000.0 + delta_omega = [1.0, 2.0] + keys = ['800.0_1000.0', '800.0_1500.0', '800.0_2000.0', '800.0_2500.0', '800.0_3000.0', '800.0_3500.0', '800.0_4000.0', '800.0_4500.0', '800.0_5000.0', '800.0_5500.0', '800.0_6000.0'] + rates = [[3.59768160399, 2.85730469783, 2.59328084312, 2.47019857325, 2.40310451058, 2.36256876552, 2.33622716364, 2.31815271355, 2.30521680479, 2.29564174079, 2.28835686631], [29.390726416, 26.4292187913, 25.3731233725, 24.880794293, 24.6124180423, 24.4502750621, 24.3449086546, 24.2726108542, 24.2208672192, 24.1825669632, 24.1534274652]] + + # Switch to the 'R2eff' model data pipe, then check for each spin. + self.interpreter.pipe.switch(MODEL_R2EFF) + spin_index = 0 + for spin, spin_id in spin_loop(return_id=True): + # Printout. + print("\nSpin %s." % spin_id) + + # Check the fitted parameters. + for i in range(len(keys)): + self.assertAlmostEqual(spin.r2eff[keys[i]]/10.0, rates[spin_index][i]/10.0, 2) + + # Increment the spin index. + spin_index += 1 + + # Switch to the 'M61 skew' model data pipe, then check for each spin. + self.interpreter.pipe.switch(MODEL_M61B) + 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]/10, 2) + self.assertAlmostEqual(spin.pA, pA, 2) + self.assertAlmostEqual(spin.dw, dw[spin_index], 2) + self.assertAlmostEqual(spin.kex/1000.0, kex/1000.0, 2) + + # Increment the spin index. + spin_index += 1 Copied: branches/relax_disp/test_suite/system_tests/scripts/relax_disp/r1rho_on_res_m61b.py (from r19979, branches/relax_disp/test_suite/system_tests/scripts/relax_disp/r1rho_on_res_m61.py) URL: http://svn.gna.org/viewcvs/relax/branches/relax_disp/test_suite/system_tests/scripts/relax_disp/r1rho_on_res_m61b.py?p2=branches/relax_disp/test_suite/system_tests/scripts/relax_disp/r1rho_on_res_m61b.py&p1=branches/relax_disp/test_suite/system_tests/scripts/relax_disp/r1rho_on_res_m61.py&r1=19979&r2=19985&rev=19985&view=diff ============================================================================== --- branches/relax_disp/test_suite/system_tests/scripts/relax_disp/r1rho_on_res_m61.py (original) +++ branches/relax_disp/test_suite/system_tests/scripts/relax_disp/r1rho_on_res_m61b.py Sun Jun 9 10:52:44 2013 @@ -14,7 +14,7 @@ ##################### # The dispersion models. -MODELS = ['R2eff', 'No Rex', 'M61'] +MODELS = ['R2eff', 'No Rex', 'M61 skew'] # The grid search size (the number of increments per dimension). GRID_INC = 3 @@ -22,9 +22,6 @@ # The number of Monte Carlo simulations to be used for error analysis at the end of the analysis. MC_NUM = 3 -# Fixed relaxation time period flag. -if not hasattr(ds, 'fixed'): - ds.fixed = True # Set up the data pipe. @@ -40,7 +37,7 @@ pipe.create(pipe_name=pipe_name, bundle=pipe_bundle, pipe_type='relax_disp') # The path to the data files. -data_path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'dispersion'+sep+'r1rho_on_res_m61' +data_path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'dispersion'+sep+'r1rho_on_res_m61b' # Create the sequence data. spin.create(res_name='Trp', res_num=1, spin_name='N') @@ -50,35 +47,24 @@ spin.isotope(isotope='15N') # Set the relaxation dispersion experiment type. -if ds.fixed: - relax_disp.exp_type('r1rho fixed') -else: - relax_disp.exp_type('r1rho exponential') +relax_disp.exp_type('r1rho fixed') # The spectral data - spectrum ID, peak lists, offset frequency (Hz), relaxation time period (s), baseplane RMSD estimate. data = [] -times = [0.00, 0.01, 0.02, 0.04, 0.06, 0.08, 0.1, 0.12, 0.15] -ncyc = [1, 2, 3, 4, 5, 6, 7, 8, 9] -if ds.fixed: - times = [0.15] - ncyc = [9] spin_lock = [1000, 1500, 2000, 2500, 3000, 3500, 4000, 4500, 5000, 5500, 6000] for spin_lock_index in range(len(spin_lock)): - for time_index in range(len(times)): - data.append(["nu_%s_ncyc%s" % (spin_lock[spin_lock_index], ncyc[time_index]), "nu_%s_ncyc%s.list" % (spin_lock[spin_lock_index], ncyc[time_index]), spin_lock[spin_lock_index], times[time_index], 200000.0]) + data.append(["nu_%s_time_0.1" % spin_lock[spin_lock_index], "nu_%s_time_0.1.list" % spin_lock[spin_lock_index], spin_lock[spin_lock_index], 0.1, 200000.0]) # Load the reference spectrum. -if ds.fixed: - # Load the peak intensities and set the errors. - spectrum.read_intensities(file="nu_%s_ncyc1.list" % spin_lock[0], dir=data_path, spectrum_id='ref', int_method='height', heteronuc='N', proton='HN') - spectrum.read_intensities(file="nu_%s_ncyc1.list" % spin_lock[0], dir=data_path, spectrum_id='ref', int_method='height', heteronuc='NE1', proton='HE1') - spectrum.baseplane_rmsd(spectrum_id='ref', error=data[0][4]) +spectrum.read_intensities(file="nu_%s_ref.list" % spin_lock[0], dir=data_path, spectrum_id='ref', int_method='height', heteronuc='N', proton='HN') +spectrum.read_intensities(file="nu_%s_ref.list" % spin_lock[0], dir=data_path, spectrum_id='ref', int_method='height', heteronuc='NE1', proton='HE1') +spectrum.baseplane_rmsd(spectrum_id='ref', error=data[0][4]) - # Set as the reference. - relax_disp.spin_lock_field(spectrum_id='ref', field=None) +# Set as the reference. +relax_disp.spin_lock_field(spectrum_id='ref', field=None) - # Set the spectrometer frequency. - spectrometer.frequency(id='ref', frq=800, units='MHz') +# Set the spectrometer frequency. +spectrometer.frequency(id='ref', frq=800, units='MHz') # Loop over the spectral data, loading it and setting the metadata. for i in range(len(data)):