Author: tlinnet Date: Wed May 21 18:11:52 2014 New Revision: 23313 URL: http://svn.gna.org/viewcvs/relax?rev=23313&view=rev Log: Merged revisions 23310-23312 via svnmerge from svn+ssh://tlinnet@xxxxxxxxxxx/svn/relax/trunk ........ r23310 | tlinnet | 2014-05-21 17:43:47 +0200 (Wed, 21 May 2014) | 6 lines Modified system test Relax_disp.test_cpmg_synthetic_ns3d_to_cr72 to catch bug. bug #22017: (https://gna.org/bugs/index.php?22017) LinAlgError, for all numerical CPMG models. Systemtest was renamed from test_cpmg_synthetic_cr72 to test_cpmg_synthetic_ns3d_to_cr72, to reflect which model create the data and which model fits the data. ........ r23311 | tlinnet | 2014-05-21 17:43:49 +0200 (Wed, 21 May 2014) | 6 lines Modified cpmg_synthetic script to first create all time structures before doing back-calculation. bug #22017: (https://gna.org/bugs/index.php?22017) LinAlgError, for all numerical CPMG models. The numerical models need all time points which are defined in setup, to be present when calculating. ........ r23312 | tlinnet | 2014-05-21 18:00:19 +0200 (Wed, 21 May 2014) | 5 lines Renamed systemtest to test_cpmg_synthetic_ns3d_to_cr72_noise_cluster. The model that creates the data has been changed to numerical model. bug #22017: (https://gna.org/bugs/index.php?22017) LinAlgError, for all numerical CPMG models. ........ Modified: branches/disp_speed/ (props changed) branches/disp_speed/test_suite/system_tests/relax_disp.py branches/disp_speed/test_suite/system_tests/scripts/relax_disp/cpmg_synthetic.py Propchange: branches/disp_speed/ ------------------------------------------------------------------------------ --- svnmerge-integrated (original) +++ svnmerge-integrated Wed May 21 18:11:52 2014 @@ -1 +1 @@ -/trunk:1-23304 +/trunk:1-23312 Modified: branches/disp_speed/test_suite/system_tests/relax_disp.py URL: http://svn.gna.org/viewcvs/relax/branches/disp_speed/test_suite/system_tests/relax_disp.py?rev=23313&r1=23312&r2=23313&view=diff ============================================================================== --- branches/disp_speed/test_suite/system_tests/relax_disp.py (original) +++ branches/disp_speed/test_suite/system_tests/relax_disp.py Wed May 21 18:11:52 2014 @@ -955,17 +955,18 @@ relax_disp.Relax_disp(pipe_name='origin - relax_disp (Sun Feb 23 19:36:51 2014)', pipe_bundle='relax_disp (Sun Feb 23 19:36:51 2014)', results_dir=self.tmpdir, models=['R2eff', 'No Rex'], grid_inc=11, mc_sim_num=2, modsel='AIC', pre_run_dir=pre_run_dir, insignificance=1.0, numeric_only=True, mc_sim_all_models=False, eliminate=True) - def test_cpmg_synthetic_cr72(self): + def test_cpmg_synthetic_ns3d_to_cr72(self): """Test synthetic cpmg data. - This script will produce synthetic CPMG R2eff values according to the selected model, and the fit the selected model. + This script will produce synthetic CPMG R2eff values according to the NS CPMG 2-site 3D model, and the fit the data with CR72. """ # Reset. #self.interpreter.reset() ## Set Experiments. - model_create = 'CR72' + model_create = 'NS CPMG 2-site 3D' + #model_create = 'NS CPMG 2-site expanded' model_analyse = 'CR72' # Exp 1 sfrq_1 = 599.8908617*1E6 @@ -986,7 +987,7 @@ exps = [exp_1, exp_2] spins = [ - ['Ala', 1, 'N', {'r2': {r20_key_1:2, r20_key_2:2}, 'r2a': {r20_key_1:2, r20_key_2:2}, 'r2b': {r20_key_1:2, r20_key_2:2}, 'kex': 1000, 'pA': 0.99, 'dw': 2} ] + ['Ala', 1, 'N', {'r2': {r20_key_1:10., r20_key_2:10.}, 'r2a': {r20_key_1:10., r20_key_2:10.}, 'r2b': {r20_key_1:10., r20_key_2:10.}, 'kex': 1000., 'pA': 0.99, 'dw': 2.} ] ] # Collect the data to be used. @@ -1072,7 +1073,7 @@ print("###################################") ## Make test on R2. - self.assertAlmostEqual(set_r2_frq, min_r2_frq, 6) + self.assertAlmostEqual(set_r2_frq, min_r2_frq, 2) else: grid_val = grid_params[mo_param] min_val = min_params[mo_param] @@ -1084,10 +1085,15 @@ print("###################################") ## Make test on parameters. - self.assertAlmostEqual(set_val, min_val, 2) - - - def test_cpmg_synthetic_cr72_full_noise_cluster(self): + if mo_param == 'dw': + self.assertAlmostEqual(set_val/10, min_val/10, 1) + elif mo_param == 'kex': + self.assertAlmostEqual(set_val/1000, min_val/1000, 1) + elif mo_param == 'pA': + self.assertAlmostEqual(set_val, min_val, 3) + + + def test_cpmg_synthetic_ns3d_to_cr72_noise_cluster(self): """Test synthetic cpmg data. For CR72 with small noise and cluster. This script will produce synthetic CPMG R2eff values according to the selected model, and the fit the selected model. @@ -1097,7 +1103,8 @@ #self.interpreter.reset() ## Set Experiments. - model_create = 'CR72' + model_create = 'NS CPMG 2-site 3D' + #model_create = 'NS CPMG 2-site expanded' model_analyse = 'CR72' # Exp 1 @@ -1121,8 +1128,8 @@ exps = [exp_1, exp_2] spins = [ - ['Ala', 1, 'N', {'r2': {r20_key_1:10, r20_key_2:11.5}, 'r2a': {r20_key_1:10, r20_key_2:11.5}, 'r2b': {r20_key_1:10, r20_key_2:11.5}, 'kex': 1000, 'pA': 0.99, 'dw': 2} ], - ['Ala', 2, 'N', {'r2': {r20_key_1:13, r20_key_2:14.5}, 'r2a': {r20_key_1:13, r20_key_2:14.5}, 'r2b': {r20_key_1:13, r20_key_2:14.5}, 'kex': 1000, 'pA': 0.99, 'dw': 1} ] + ['Ala', 1, 'N', {'r2': {r20_key_1:10., r20_key_2:11.5}, 'r2a': {r20_key_1:10., r20_key_2:11.5}, 'r2b': {r20_key_1:10., r20_key_2:11.5}, 'kex': 1000., 'pA': 0.99, 'dw': 2.} ], + ['Ala', 2, 'N', {'r2': {r20_key_1:13., r20_key_2:14.5}, 'r2a': {r20_key_1:13., r20_key_2:14.5}, 'r2b': {r20_key_1:13., r20_key_2:14.5}, 'kex': 1000., 'pA': 0.99, 'dw': 1.} ] ] # Collect the data to be used. @@ -1221,8 +1228,13 @@ print("WARNING: rel change level is above %.2f, and is %.4f."%(ds.rel_change, rel_change)) print("###################################") - ## Make test on parameters. Only if breaking the relative change. - self.assertAlmostEqual(set_val, min_val, 1) + ## Make test on parameters. + if mo_param == 'dw': + self.assertAlmostEqual(set_val/10, min_val/10, 1) + elif mo_param == 'kex': + self.assertAlmostEqual(set_val/1000, min_val/1000, 1) + elif mo_param == 'pA': + self.assertAlmostEqual(set_val, min_val, 2) def test_cpmg_synthetic_dx_map_points(self): Modified: branches/disp_speed/test_suite/system_tests/scripts/relax_disp/cpmg_synthetic.py URL: http://svn.gna.org/viewcvs/relax/branches/disp_speed/test_suite/system_tests/scripts/relax_disp/cpmg_synthetic.py?rev=23313&r1=23312&r2=23313&view=diff ============================================================================== --- branches/disp_speed/test_suite/system_tests/scripts/relax_disp/cpmg_synthetic.py (original) +++ branches/disp_speed/test_suite/system_tests/scripts/relax_disp/cpmg_synthetic.py Wed May 21 18:11:52 2014 @@ -380,8 +380,8 @@ after = getattr(cur_spin, mo_param) print(cur_spin.model, res_name, cur_spin_id, mo_param, before) -## Now doing the back calculation of R2eff values. -# First loop over the frequencies. +####### Now doing the back calculation of R2eff values. +# First create fake data and read it in. for exp_type, frq, ei, mi in loop_exp_frq(return_indices=True): exp_id = exp_ids[mi] exp = exps[mi] @@ -409,10 +409,24 @@ # This is a trick, or else relax complains. relax_disp.r2eff_read_spin(id=exp_id, spin_id=cur_spin_id, file=file_name, dir=ds.tmpdir, disp_point_col=1, data_col=2, error_col=3) + +# Now back-calculate. +for exp_type, frq, ei, mi in loop_exp_frq(return_indices=True): + exp_id = exp_ids[mi] + exp = exps[mi] + sfrq, time_T2, ncycs, r2eff_errs = exp + + # Then loop over the spins. + for res_name, res_num, spin_name, params in cur_spins: + cur_spin_id = ":%i@%s"%(res_num, spin_name) + cur_spin = return_spin(cur_spin_id) + ### Now back calculate values from parameters, and stuff R2eff it back. print("Generating data with MODEL:%s, for spin id:%s"%(model_create, cur_spin_id)) r2effs = optimisation.back_calc_r2eff(spin=cur_spin, spin_id=cur_spin_id) + # Define file name + file_name = "%s%s.txt" % (exp_id, cur_spin_id .replace('#', '_').replace(':', '_').replace('@', '_')) file = open_write_file(file_name=file_name, dir=ds.resdir, force=True) ## Loop over the R2eff structure # Loop over the points.