Author: bugman Date: Fri May 3 18:10:56 2013 New Revision: 19646 URL: http://svn.gna.org/viewcvs/relax?rev=19646&view=rev Log: Shifted all of the constant relaxation dispersion variables into the specific module. All of the dispersion code now uses the variables of specific_analyses.relax_disp.variables. Modified: branches/relax_disp/specific_analyses/relax_disp/__init__.py branches/relax_disp/specific_analyses/relax_disp/parameters.py branches/relax_disp/specific_analyses/relax_disp/variables.py branches/relax_disp/user_functions/relax_disp.py Modified: branches/relax_disp/specific_analyses/relax_disp/__init__.py URL: http://svn.gna.org/viewcvs/relax/branches/relax_disp/specific_analyses/relax_disp/__init__.py?rev=19646&r1=19645&r2=19646&view=diff ============================================================================== --- branches/relax_disp/specific_analyses/relax_disp/__init__.py (original) +++ branches/relax_disp/specific_analyses/relax_disp/__init__.py Fri May 3 18:10:56 2013 @@ -57,7 +57,7 @@ from specific_analyses.api_common import API_common from specific_analyses.relax_disp.disp_data import exp_curve_index_from_key, exp_curve_key_from_index, intensity_key, loop_all_data, loop_dispersion_point, loop_exp_curve, loop_spectrometer, relax_time, return_key from specific_analyses.relax_disp.parameters import assemble_param_vector, assemble_scaling_matrix, disassemble_param_vector, linear_constraints, param_index_to_param_info, param_num -from specific_analyses.relax_disp.variables import CPMG_EXP, FIXED_TIME_EXP, R1RHO_EXP, VAR_TIME_EXP +from specific_analyses.relax_disp.variables import CPMG_EXP, FIXED_TIME_EXP, MODEL_R2EFF, MODEL_LM63, MODEL_CR72, R1RHO_EXP, VAR_TIME_EXP from target_functions.relax_disp import Dispersion from user_functions.data import Uf_tables; uf_tables = Uf_tables() from user_functions.objects import Desc_container @@ -65,13 +65,6 @@ # C modules. if C_module_exp_fn: from target_functions.relax_fit import setup, func, dfunc, d2func, back_calc_I - - -# Some module variables. -FIXED_TIME_EXP = ['cpmg fixed'] -VAR_TIME_EXP = ['cpmg', 'r1rho'] -CPMG_EXP = ['cpmg', 'cpmg fixed'] -R1RHO_EXP = ['r1rho'] class Relax_disp(API_base, API_common): @@ -121,7 +114,7 @@ """ # The R2eff model. - if cdp.model == 'R2eff': + if cdp.model == MODEL_R2EFF: # Check. if cdp.exp_type in FIXED_TIME_EXP: raise RelaxError("Back-calculation is not allowed for the fixed time experiment types.") @@ -689,10 +682,10 @@ add_result_file(type='grace', label='Grace', file=file_path) - def _select_model(self, model='R2eff'): + def _select_model(self, model=MODEL_R2EFF): """Set up the model for the relaxation dispersion analysis. - @keyword model: The relaxation dispersion analysis type. This can be one of 'R2eff', 'fast 2-site', 'slow 2-site'. + @keyword model: The relaxation dispersion analysis type. This can be one of 'R2eff', 'LM63', 'CR72'. @type model: str """ @@ -713,21 +706,21 @@ raise RelaxError("The relaxation dispersion experiment type has not been set.") # Test for the C-modules. - if model == 'R2eff' and cdp.exp_type in VAR_TIME_EXP and not C_module_exp_fn: + if model == MODEL_R2EFF and cdp.exp_type in VAR_TIME_EXP and not C_module_exp_fn: raise RelaxError("The exponential curve-fitting C module cannot be found.") # R2eff/R1rho model. - if model == 'R2eff': + if model == MODEL_R2EFF: print("R2eff/R1rho value and error determination.") params = ['r2eff', 'i0'] # LM63 model. - elif model == 'LM63': + elif model == MODEL_LM63: print("The Luz and Meiboom (1963) 2-site fast exchange model.") params = ['r2', 'rex', 'kex'] # CR72 model. - elif model == 'CR72': + elif model == MODEL_CR72: print("The Carver and Richards (1972) 2-site model for all time scales.") params = ['r2', 'r2a', 'ka', 'dw'] @@ -953,7 +946,7 @@ cdp.spin_lock_nu1_list = [] # Special exponential curve-fitting for the 'R2eff' model. - if cdp.model == 'R2eff': + if cdp.model == MODEL_R2EFF: # Sanity checks. if cdp.exp_type in FIXED_TIME_EXP: raise RelaxError("The R2eff model with the fixed time period CPMG experiment cannot be optimised.") Modified: branches/relax_disp/specific_analyses/relax_disp/parameters.py URL: http://svn.gna.org/viewcvs/relax/branches/relax_disp/specific_analyses/relax_disp/parameters.py?rev=19646&r1=19645&r2=19646&view=diff ============================================================================== --- branches/relax_disp/specific_analyses/relax_disp/parameters.py (original) +++ branches/relax_disp/specific_analyses/relax_disp/parameters.py Fri May 3 18:10:56 2013 @@ -31,7 +31,7 @@ from lib.errors import RelaxError from lib.mathematics import round_to_next_order from specific_analyses.relax_disp.disp_data import loop_exp_curve -from specific_analyses.relax_disp.variables import VAR_TIME_EXP +from specific_analyses.relax_disp.variables import MODEL_R2EFF, VAR_TIME_EXP def assemble_param_vector(spins=None, key=None, sim_index=None): @@ -51,7 +51,7 @@ param_vector = [] # The R2eff model parameters. - if cdp.model == 'R2eff': + if cdp.model == MODEL_R2EFF: for spin_index in range(len(spins)): # Alias the spin. spin = spins[spin_index] @@ -188,7 +188,7 @@ return scaling_matrix # The R2eff model. - if cdp.model == 'R2eff': + if cdp.model == MODEL_R2EFF: for spin_index in range(len(spins)): # Alias the spin. spin = spins[spin_index] @@ -267,7 +267,7 @@ param_index = 0 # The R2eff model. - if cdp.model == 'R2eff': + if cdp.model == MODEL_R2EFF: for spin_index in range(len(spins)): # Alias the spin. spin = spins[spin_index] @@ -422,7 +422,7 @@ j = 0 # The R2eff model. - if cdp.model == 'R2eff': + if cdp.model == MODEL_R2EFF: for spin_index in range(len(spins)): # Alias the spin. spin = spins[spin_index] @@ -505,7 +505,7 @@ spin_index = 0 # The R2eff model. - if cdp.model == 'R2eff': + if cdp.model == MODEL_R2EFF: # The number of spin specific parameters (R2eff and I0 per spin). num = len(spins) * 2 @@ -538,7 +538,7 @@ """ # The R2eff model. - if cdp.model == 'R2eff': + if cdp.model == MODEL_R2EFF: # Exponential curves (with clustering). if cdp.exp_type in VAR_TIME_EXP: return 2 * len(spins) Modified: branches/relax_disp/specific_analyses/relax_disp/variables.py URL: http://svn.gna.org/viewcvs/relax/branches/relax_disp/specific_analyses/relax_disp/variables.py?rev=19646&r1=19645&r2=19646&view=diff ============================================================================== --- branches/relax_disp/specific_analyses/relax_disp/variables.py (original) +++ branches/relax_disp/specific_analyses/relax_disp/variables.py Fri May 3 18:10:56 2013 @@ -23,8 +23,26 @@ # Module docstring. """Variables for the relaxation dispersion specific analysis.""" -# Some variables for relaxation dispersion. +# The experiment type lists. FIXED_TIME_EXP = ['cpmg fixed'] +"""The list of fixed relaxation time period experiments.""" + VAR_TIME_EXP = ['cpmg', 'r1rho'] +"""The list of variable relaxation time period experiments.""" + CPMG_EXP = ['cpmg', 'cpmg fixed'] +"""The list of CPMG-type experiments.""" + R1RHO_EXP = ['r1rho'] +"""The list of R1rho-type experiments.""" + + +# The model names. +MODEL_R2EFF = 'R2eff' +"""The model for determining the R2eff/R1rho values from peak intensities.""" + +MODEL_LM63 = 'LM63' +"""The Luz and Meiboom (1963) 2-site fast exchange model.""" + +MODEL_CR72 = 'CR72' +"""The Carver and Richards (1972) 2-site model for all time scales.""" Modified: branches/relax_disp/user_functions/relax_disp.py URL: http://svn.gna.org/viewcvs/relax/branches/relax_disp/user_functions/relax_disp.py?rev=19646&r1=19645&r2=19646&view=diff ============================================================================== --- branches/relax_disp/user_functions/relax_disp.py (original) +++ branches/relax_disp/user_functions/relax_disp.py Fri May 3 18:10:56 2013 @@ -36,14 +36,10 @@ from pipe_control.mol_res_spin import get_spin_ids from graphics import ANALYSIS_IMAGE_PATH, WIZARD_IMAGE_PATH from specific_analyses.relax_disp.disp_data import cpmg_frq, relax_time, spin_lock_field +from specific_analyses.relax_disp.variables import MODEL_CR72, MODEL_LM63, MODEL_R2EFF from specific_analyses.setup import relax_disp_obj from user_functions.data import Uf_info; uf_info = Uf_info() from user_functions.objects import Desc_container - -# The model names. -MODEL_R2EFF = 'R2eff' -MODEL_LM63 = 'LM63' -MODEL_CR72 = 'CR72' # The user function class.