Author: bugman Date: Sat Nov 16 17:12:29 2013 New Revision: 21458 URL: http://svn.gna.org/viewcvs/relax?rev=21458&view=rev Log: Created the Relax_disp.test_tp02_data_to_mp05 system test. This was copied from the Relax_disp.test_tp02_data_to_tp02 system test. The r1rho_off_res_tp02.py system test script was modified to handle both tests by allowing the list of models to optimise to be set via the ds.models variable. 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 Modified: branches/relax_disp/test_suite/system_tests/relax_disp.py branches/relax_disp/test_suite/system_tests/scripts/relax_disp/r1rho_off_res_tp02.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=21458&r1=21457&r2=21458&view=diff ============================================================================== --- branches/relax_disp/test_suite/system_tests/relax_disp.py (original) +++ branches/relax_disp/test_suite/system_tests/relax_disp.py Sat Nov 16 17:12:29 2013 @@ -2146,6 +2146,39 @@ self.assertAlmostEqual(spin2.chi2, 0.000133191682505916, 4) + def test_tp02_data_to_mp05(self): + """Test the dispersion 'MP05' model fitting against the 'TP02' test data.""" + + # Fixed time variable and the models. + ds.fixed = True + ds.models = ['R2eff', 'MP05'] + + # 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 parameters. + r1rho_prime = [[10.0, 15.0], [12.0, 18.0]] + pA = 0.7654321 + kex = 1234.56789 + delta_omega = [7.0, 9.0] + + # Switch to the 'MP05' model data pipe, then check for each spin. + self.interpreter.pipe.switch('MP05') + 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.dw, delta_omega[spin_index], 3) + self.assertAlmostEqual(spin.kex/1000.0, kex/1000.0, 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.""" Modified: branches/relax_disp/test_suite/system_tests/scripts/relax_disp/r1rho_off_res_tp02.py URL: http://svn.gna.org/viewcvs/relax/branches/relax_disp/test_suite/system_tests/scripts/relax_disp/r1rho_off_res_tp02.py?rev=21458&r1=21457&r2=21458&view=diff ============================================================================== --- branches/relax_disp/test_suite/system_tests/scripts/relax_disp/r1rho_off_res_tp02.py (original) +++ branches/relax_disp/test_suite/system_tests/scripts/relax_disp/r1rho_off_res_tp02.py Sat Nov 16 17:12:29 2013 @@ -14,7 +14,8 @@ ##################### # The dispersion models. -MODELS = ['R2eff', 'TP02'] +if not hasattr(ds, 'models'): + ds.models = ['R2eff', 'TP02'] # The grid search size (the number of increments per dimension). GRID_INC = 4 @@ -112,7 +113,7 @@ Relax_disp.opt_max_iterations = 10000 # 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) +Relax_disp(pipe_name=pipe_name, pipe_bundle=pipe_bundle, results_dir=ds.tmpdir, models=ds.models, grid_inc=GRID_INC, mc_sim_num=MC_NUM) # Save the program state. state.save('devnull', force=True)