Author: bugman Date: Thu Jun 6 19:47:57 2013 New Revision: 19906 URL: http://svn.gna.org/viewcvs/relax?rev=19906&view=rev Log: Created the Relax_disp.test_r1rho_on_res_fixed_time_m61 system test. This checks the R1rho-type experiment with a fixed relaxation time period using the 'R2eff' and 'M61' models. It uses the auto-analysis for this, and the 'r1rho_on_res' synthetic relaxation data. Added: 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=19906&r1=19905&r2=19906&view=diff ============================================================================== --- branches/relax_disp/test_suite/system_tests/relax_disp.py (original) +++ branches/relax_disp/test_suite/system_tests/relax_disp.py Thu Jun 6 19:47:57 2013 @@ -28,6 +28,7 @@ # relax module imports. 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 status import Status; status = Status() from test_suite.system_tests.base_classes import SystemTestCase @@ -460,3 +461,51 @@ self.assertEqual(cdp.mol[0].res[0].spin[0].ri_data['R2eff.600'], 15.000) self.assertEqual(cdp.mol[0].res[1].spin[0].ri_data['R2eff.600'], 4.2003) self.assertEqual(cdp.mol[0].res[2].spin[0].ri_data['R2eff.600'], 7.2385) + + + def test_r1rho_on_res_fixed_time_m61(self): + """Test the relaxation dispersion 'M61' 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_m61.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] + keys = ['1000.0', '1500.0', '2000.0', '2500.0', '3000.0', '3500.0', '4000.0', '4500.0', '5000.0', '5500.0', '6000.0'] + + # Switch to the 'R2eff' model data pipe, then check for each spin. + self.interpreter.pipe.switch('R2eff') + spin_index = 0 + for spin, spin_id in spin_loop(return_id=True): + # Printout. + print("\nSpin %s." % spin_id) + print spin + + # Check the fitted parameters. + for key in keys: + self.assertAlmostEqual(spin.r2eff[key], r1rho_prime[spin_index]) + + # Increment the spin index. + spin_index += 1 + + # Switch to the 'M61' model data pipe, then check for each spin. + self.interpreter.pipe.switch('M61') + 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.pA, pA) + self.assertAlmostEqual(spin.kex, kex) + self.assertAlmostEqual(spin.delta_omega, delta_omega[spin_index]) + + # Increment the spin index. + spin_index += 1 Added: 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_m61.py?rev=19906&view=auto ============================================================================== --- branches/relax_disp/test_suite/system_tests/scripts/relax_disp/r1rho_on_res_m61.py (added) +++ branches/relax_disp/test_suite/system_tests/scripts/relax_disp/r1rho_on_res_m61.py Thu Jun 6 19:47:57 2013 @@ -1,0 +1,105 @@ +# Optimise the R1rho on-resonance synthetic data using the M61 model. + + +# Python module imports. +from os import sep + +# relax module imports. +from auto_analyses.relax_disp import Relax_disp +from data_store import Relax_data_store; ds = Relax_data_store() +from status import Status; status = Status() + + +# Analysis variables. +##################### + +# The dispersion models. +MODELS = ['R2eff', 'No Rex', 'M61'] + +# 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. +####################### + +# The results directory. +if not hasattr(ds, 'tmpdir'): + ds.tmpdir = None + +# Create the data pipe. +pipe_name = 'base pipe' +pipe_bundle = 'relax_disp' +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' + +# Create the sequence data. +spin.create(res_name='Trp', res_num=1, spin_name='N') +spin.create(res_name='Trp', res_num=1, spin_name='NE1') + +# Set the isotope information. +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') + +# 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], 200.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]) + + # Set as the reference. + relax_disp.spin_lock_field(spectrum_id='ref', field=None) + +# Loop over the spectral data, loading it and setting the metadata. +for i in range(len(data)): + # Load the peak intensities and set the errors. + spectrum.read_intensities(file=data[i][1], dir=data_path, spectrum_id=data[i][0], int_method='height', heteronuc='N', proton='HN') + spectrum.read_intensities(file=data[i][1], dir=data_path, spectrum_id=data[i][0], int_method='height', heteronuc='NE1', proton='HE1') + spectrum.baseplane_rmsd(spectrum_id=data[i][0], error=data[i][4]) + + # Set the relaxation dispersion spin-lock field strength (nu1). + relax_disp.spin_lock_field(spectrum_id=data[i][0], field=data[i][2]) + + # Set the relaxation times. + relax_disp.relax_time(spectrum_id=data[i][0], time=data[i][3]) + +# Clustering. +relax_disp.cluster(cluster_id='cluster', spin_id='@N,NE1') + + + +# Auto-analysis execution. +########################## + +# Do not change! +Relax_disp(pipe_name=pipe_name, pipe_bundle=pipe_bundle, results_dir=ds.tmpdir, models=MODELS, grid_inc=GRID_INC, mc_sim_num=MC_NUM) + +# Save the program state. +state.save('devnull', force=True)