Author: tlinnet Date: Tue Apr 29 15:38:33 2014 New Revision: 22878 URL: http://svn.gna.org/viewcvs/relax?rev=22878&view=rev Log: Fix for systemtest Relax_disp.test_set_grid_r20_from_min_r2eff_cpmg. Feature request: #3151, (https://gna.org/support/index.php?3151) - User function to set the R20 parameters in the default grid search using the minimum R2eff value. Fixed values for testing was added. Modified: trunk/test_suite/system_tests/relax_disp.py Modified: trunk/test_suite/system_tests/relax_disp.py URL: http://svn.gna.org/viewcvs/relax/trunk/test_suite/system_tests/relax_disp.py?rev=22878&r1=22877&r2=22878&view=diff ============================================================================== --- trunk/test_suite/system_tests/relax_disp.py (original) +++ trunk/test_suite/system_tests/relax_disp.py Tue Apr 29 15:38:33 2014 @@ -3403,19 +3403,19 @@ select_spin_index = range(0,1) self.setup_sod1wt_t25(pipe_name=pipe_name, pipe_type=pipe_type, pipe_name_r2eff=pipe_name_r2eff, select_spin_index=select_spin_index) - # Generate r20 keu + # Generate r20 key. r20_key_600 = generate_r20_key(exp_type=EXP_TYPE_CPMG_SQ, frq=599.8908617*1E6) r20_key_500 = generate_r20_key(exp_type=EXP_TYPE_CPMG_SQ, frq=499.862139*1E6) - ## Now prepare for MODEL calculation + ## Now prepare for MODEL calculation. MODEL = "CR72" - # Change pipe + # Change pipe. pipe_name_MODEL = "%s_%s"%(pipe_name, MODEL) self.interpreter.pipe.copy(pipe_from=pipe_name_r2eff, pipe_to=pipe_name_MODEL) self.interpreter.pipe.switch(pipe_name=pipe_name_MODEL) - # Then select model + # Then select model. self.interpreter.relax_disp.select_model(model=MODEL) # Set the R20 parameters in the default grid search using the minimum R2eff value. @@ -3423,15 +3423,21 @@ # Test result, for normal run. for spin, mol_name, resi, resn, spin_id in spin_loop(full_info=True, return_id=True, skip_desel=True): - # Get the spin_params + # Get the spin_params. spin_params = spin.params - # Print out + + # Defined fixed values for testing. + if spin_id == ":10@N": + self.assertEqual(spin.r2[r20_key_600], 20.282732526087106) + self.assertEqual(spin.r2[r20_key_500], 18.475299724356649) + + # Print out. print("r2_600=%2.2f r2_500=%2.2f spin_id=%s resi=%i resn=%s"%(spin.r2[r20_key_600], spin.r2[r20_key_500], spin_id, resi, resn)) # Testing the r2 values for the different fields are not the same. self.assert_(spin.r2[r20_key_600] != spin.r2[r20_key_500]) - # Test values are larger than 0 + # Test values are larger than 0. self.assert_(spin.r2[r20_key_600] > 0.0) self.assert_(spin.r2[r20_key_500] > 0.0) @@ -3442,18 +3448,18 @@ # Create the data key. data_key = return_param_key_from_data(exp_type=exp_type, frq=frq, offset=offset, point=point) - # Extract the r2 eff data + # Extract the r2 eff data. r2eff = spin.r2eff[data_key] if frq == 599.8908617*1E6: r2eff_600.append(r2eff) elif frq == 499.862139*1E6: r2eff_500.append(r2eff) - # Sort values + # Sort values. r2eff_600.sort() r2eff_500.sort() - # Test values again + # Test values again. print("For r20 600MHz min r2eff=%3.3f."%(min(r2eff_600))) print(r2eff_600) self.assertEqual(spin.r2[r20_key_600], min(r2eff_600)) @@ -3467,31 +3473,31 @@ print("###########################################") print("Trying GRID SEARCH for minimum R2eff values") - ### Test just the Grid search + ### Test just the Grid search. GRID_INC = 5 self.interpreter.grid_search(lower=None, upper=None, inc=GRID_INC, constraints=True, verbosity=1) - ### Then test the value.set function - # Change pipe + ### Then test the value.set function. + # Change pipe. pipe_name_MODEL = "%s_%s_2"%(pipe_name, MODEL) self.interpreter.pipe.copy(pipe_from=pipe_name_r2eff, pipe_to=pipe_name_MODEL) self.interpreter.pipe.switch(pipe_name=pipe_name_MODEL) - # Then select model + # Then select model. self.interpreter.relax_disp.select_model(model=MODEL) - # Then set the standard parameter values + # Then set the standard parameter values. for param in spin_params: print("Setting standard parameter for param: %s"%param) self.interpreter.value.set(param=param, index=None) # Test result, for normal run. for spin, mol_name, resi, resn, spin_id in spin_loop(full_info=True, return_id=True, skip_desel=True): - # Print out + # Print out. print("r2_600=%2.2f r2_500=%2.2f pA=%2.2f, dw=%2.2f, kex=%2.2f, spin_id=%s resi=%i resn=%s"%(spin.r2[r20_key_600], spin.r2[r20_key_500], spin.pA, spin.dw, spin.kex, spin_id, resi, resn)) - # Testing the r2 values + # Testing the r2 values. self.assertEqual(spin.r2[r20_key_600], 10.00) self.assertEqual(spin.r2[r20_key_500], 10.00) self.assertEqual(spin.pA, 0.5) @@ -3501,12 +3507,12 @@ print("###########################################") print("Trying GRID SEARCH for standard R2eff values") - ### Test just the Grid search + ### Test just the Grid search. GRID_INC = 5 self.interpreter.grid_search(lower=None, upper=None, inc=GRID_INC, constraints=True, verbosity=1) - ### Run auto_analysis + ### Run auto_analysis. # The grid search size (the number of increments per dimension). GRID_INC = 5 @@ -3517,7 +3523,7 @@ MODSEL = 'AIC' # Execute the auto-analysis (fast). - # Standard parameters are: func_tol=1e-25, grad_tol=None, max_iter=10000000, + # Standard parameters are: func_tol=1e-25, grad_tol=None, max_iter=10000000. OPT_FUNC_TOL = 1e-1 relax_disp.Relax_disp.opt_func_tol = OPT_FUNC_TOL OPT_MAX_ITERATIONS = 1000