Author: bugman Date: Sun Jun 9 22:46:15 2013 New Revision: 20003 URL: http://svn.gna.org/viewcvs/relax?rev=20003&view=rev Log: Created the Relax_disp.test_r1rho_on_res_fixed_time_dpl94 system test. This is the David, Perlman and London 1994 R1rho 2-site fast exchange model. 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_dpl94.py - copied, changed from r20001, 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=20003&r1=20002&r2=20003&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 22:46:15 2013 @@ -513,6 +513,41 @@ spin_index += 1 + def test_r1rho_on_res_fixed_time_dpl94(self): + """Test the relaxation dispersion 'DPL94' model curve fitting to fixed time synthetic data.""" + + # Fixed time variable. + ds.fixed = True + + # 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_dpl94.py') + + # The original parameters. + i0 = [100000.0, 20000.0] + r1rho_prime = [2.25, 24.0] + pA = 0.7 + kex = 1000.0 + delta_omega = [1.0, 2.0] + phi_ex = [] + for i in range(2): + phi_ex.append(pA * (1.0 - pA) * delta_omega[i]**2) + + # Switch to the 'DPL94' model data pipe, then check for each spin. + self.interpreter.pipe.switch('DPL94') + 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.phi_ex, phi_ex[spin_index], 2) + self.assertAlmostEqual(spin.kex/1000.0, kex/1000.0, 2) + + # Increment the spin index. + spin_index += 1 + + def test_r1rho_on_res_fixed_time_m61(self): """Test the relaxation dispersion 'M61' model curve fitting to fixed time synthetic data.""" Copied: branches/relax_disp/test_suite/system_tests/scripts/relax_disp/r1rho_on_res_dpl94.py (from r20001, 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_dpl94.py?p2=branches/relax_disp/test_suite/system_tests/scripts/relax_disp/r1rho_on_res_dpl94.py&p1=branches/relax_disp/test_suite/system_tests/scripts/relax_disp/r1rho_on_res_m61.py&r1=20001&r2=20003&rev=20003&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_dpl94.py Sun Jun 9 22:46:15 2013 @@ -1,4 +1,4 @@ -# Optimise the R1rho on-resonance synthetic data using the M61 model. +# Optimise the R1rho on-resonance synthetic data using the DPL94 model. # Python module imports. @@ -14,17 +14,13 @@ ##################### # The dispersion models. -MODELS = ['R2eff', 'No Rex', 'M61'] +MODELS = ['R2eff', 'DPL94'] # The grid search size (the number of increments per dimension). GRID_INC = 3 # 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. @@ -39,7 +35,7 @@ pipe_bundle = 'relax_disp' pipe.create(pipe_name=pipe_name, bundle=pipe_bundle, pipe_type='relax_disp') -# The path to the data files. +# The path to the data files (use the M61 model data for now). data_path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'dispersion'+sep+'r1rho_on_res_m61' # Create the sequence data. @@ -50,35 +46,27 @@ 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] +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]) # 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_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]) - # 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)):