Author: bugman Date: Fri Jul 12 12:31:02 2013 New Revision: 20283 URL: http://svn.gna.org/viewcvs/relax?rev=20283&view=rev Log: Better support for the R2A and R2B relaxation rate parameters in the relaxation dispersion analysis. This includes a number of fixes to allow these two parameters to be handled correctly. Modified: branches/relax_disp/specific_analyses/relax_disp/api.py branches/relax_disp/specific_analyses/relax_disp/parameters.py branches/relax_disp/target_functions/relax_disp.py Modified: branches/relax_disp/specific_analyses/relax_disp/api.py URL: http://svn.gna.org/viewcvs/relax/branches/relax_disp/specific_analyses/relax_disp/api.py?rev=20283&r1=20282&r2=20283&view=diff ============================================================================== --- branches/relax_disp/specific_analyses/relax_disp/api.py (original) +++ branches/relax_disp/specific_analyses/relax_disp/api.py Fri Jul 12 12:31:02 2013 @@ -82,6 +82,8 @@ self.PARAMS.add('r2eff', scope='spin', default=15.0, desc='The effective transversal relaxation rate', set='params', py_type=dict, grace_string='\\qR\\s2,eff\\N\\Q (rad.s\\S-1\\N)', err=True, sim=True) self.PARAMS.add('i0', scope='spin', default=10000.0, desc='The initial intensity', py_type=dict, set='params', grace_string='\\qI\\s0\\Q', err=True, sim=True) self.PARAMS.add('r2', scope='spin', default=15.0, desc='The transversal relaxation rate', set='params', py_type=list, grace_string='\\qR\\s2\\N\\Q (rad.s\\S-1\\N)', err=True, sim=True) + self.PARAMS.add('r2a', scope='spin', default=15.0, desc='The transversal relaxation rate for state A in the absence of exchange', set='params', py_type=list, grace_string='\\qR\\s2,A\\N\\Q (rad.s\\S-1\\N)', err=True, sim=True) + self.PARAMS.add('r2b', scope='spin', default=15.0, desc='The transversal relaxation rate for state B in the absence of exchange', set='params', py_type=list, grace_string='\\qR\\s2,B\\N\\Q (rad.s\\S-1\\N)', err=True, sim=True) self.PARAMS.add('pA', scope='spin', default=0.5, desc='The population for state A', set='params', py_type=float, grace_string='\\qp\\sA\\N\\Q', err=True, sim=True) self.PARAMS.add('pB', scope='spin', default=0.5, desc='The population for state B', set='params', py_type=float, grace_string='\\qp\\sB\\N\\Q', err=True, sim=True) self.PARAMS.add('phi_ex', scope='spin', default=5.0, desc='The phi_ex = pA.pB.dw**2 value (ppm^2)', set='params', py_type=float, grace_string='\\xF\\B\\sex\\N = \\q p\\sA\\N.p\\sB\\N.\\xDw\\B\\S2\\N\\Q (ppm\\S2\\N)', err=True, sim=True) @@ -89,8 +91,6 @@ self.PARAMS.add('dw', scope='spin', default=0.0, desc='The chemical shift difference between states A and B (in ppm)', set='params', py_type=float, grace_string='\\q\\xDw\f{}\\Q (ppm)', err=True, sim=True) self.PARAMS.add('kex', scope='spin', default=10000.0, desc='The exchange rate', set='params', py_type=float, grace_string='\\qk\\sex\\N\\Q (rad.s\\S-1\\N)', err=True, sim=True) self.PARAMS.add('tex', scope='spin', default=1.0/20000.0, desc='The time of exchange (tex = 1/(2kex))', set='params', py_type=float, grace_string='\\q\\xt\\B\\sex\\N\\Q (s.rad\\S-1\\N)', err=True, sim=True) - self.PARAMS.add('r2a', scope='spin', default=15.0, desc='The transversal relaxation rate for state A in the absence of exchange', set='params', py_type=float, grace_string='\\qR\\s2,A\\N\\Q (rad.s\\S-1\\N)', err=True, sim=True) - self.PARAMS.add('r2b', scope='spin', default=15.0, desc='The transversal relaxation rate for state B in the absence of exchange', set='params', py_type=float, grace_string='\\qR\\s2,B\\N\\Q (rad.s\\S-1\\N)', err=True, sim=True) self.PARAMS.add('ka', scope='spin', default=10000.0, desc='The exchange rate from state A to state B', set='params', py_type=float, grace_string='\\qk\\sA\\N\\Q (rad.s\\S-1\\N)', err=True, sim=True) self.PARAMS.add('params', scope='spin', desc='The model parameters', py_type=list) 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=20283&r1=20282&r2=20283&view=diff ============================================================================== --- branches/relax_disp/specific_analyses/relax_disp/parameters.py (original) +++ branches/relax_disp/specific_analyses/relax_disp/parameters.py Fri Jul 12 12:31:02 2013 @@ -134,6 +134,7 @@ # Initialise parameters if needed. for spin in spins: + # The R2 parameter. if 'r2' in spin.params: if sim_index != None: spin.r2_sim[sim_index] = [] @@ -143,6 +144,28 @@ spin.r2 = [] for frq in loop_frq(): spin.r2.append(None) + + # The R2A parameter. + if 'r2a' in spin.params: + if sim_index != None: + spin.r2a_sim[sim_index] = [] + for frq in loop_frq(): + spin.r2a_sim[sim_index].append(None) + else: + spin.r2a = [] + for frq in loop_frq(): + spin.r2a.append(None) + + # The R2B parameter. + if 'r2b' in spin.params: + if sim_index != None: + spin.r2b_sim[sim_index] = [] + for frq in loop_frq(): + spin.r2b_sim[sim_index].append(None) + else: + spin.r2b = [] + for frq in loop_frq(): + spin.r2b.append(None) # Loop over the parameters of the cluster, setting the values. for param_name, param_index, spin_index, frq_index in loop_parameters(spins=spins): @@ -398,14 +421,38 @@ # Reset the frequency index. frq_index = -1 - # Loop over the spectrometer frequencies. - for frq in loop_frq(): - # First increment the indices. - frq_index += 1 - param_index += 1 - - # Yield the data. - yield 'r2', param_index, spin_index, frq_index + # The R2 parameter. + if 'r2' in spins[0].params: + # Loop over the spectrometer frequencies. + for frq in loop_frq(): + # First increment the indices. + frq_index += 1 + param_index += 1 + + # Yield the data. + yield 'r2', param_index, spin_index, frq_index + + # The R2A parameter. + if 'r2a' in spins[0].params: + # Loop over the spectrometer frequencies. + for frq in loop_frq(): + # First increment the indices. + frq_index += 1 + param_index += 1 + + # Yield the data. + yield 'r2a', param_index, spin_index, frq_index + + # The R2B parameter. + if 'r2b' in spins[0].params: + # Loop over the spectrometer frequencies. + for frq in loop_frq(): + # First increment the indices. + frq_index += 1 + param_index += 1 + + # Yield the data. + yield 'r2b', param_index, spin_index, frq_index # Then the chemical shift difference parameters 'phi_ex', 'padw2' and 'dw' (one per spin). for spin_index in range(len(spins)): @@ -422,7 +469,7 @@ # All other parameters (one per spin cluster). for param in spins[0].params: - if not param in ['r2', 'phi_ex', 'padw2', 'dw']: + if not param in ['r2', 'r2a', 'r2b', 'phi_ex', 'padw2', 'dw']: param_index += 1 yield param, param_index, None, None @@ -508,7 +555,7 @@ raise RelaxError("The number of parameters for each spin in the cluster are not the same.") # Count the number of spin specific parameters for all spins. - spin_params = ['r2', 'phi_ex', 'padw2', 'dw'] + spin_params = ['r2', 'r2a', 'r2b', 'phi_ex', 'padw2', 'dw'] num = 0 for spin in spins: for i in range(len(spin.params)): Modified: branches/relax_disp/target_functions/relax_disp.py URL: http://svn.gna.org/viewcvs/relax/branches/relax_disp/target_functions/relax_disp.py?rev=20283&r1=20282&r2=20283&view=diff ============================================================================== --- branches/relax_disp/target_functions/relax_disp.py (original) +++ branches/relax_disp/target_functions/relax_disp.py Fri Jul 12 12:31:02 2013 @@ -118,11 +118,15 @@ # Create the structure for holding the back-calculated R2eff values (matching the dimensions of the values structure). self.back_calc = zeros((num_spins, num_frq, num_disp_points), float64) - # The post spin parameter indices. + # Initialise the post spin parameter indices. self.end_index = [] + + # The spin and frequency dependent R2 parameters. self.end_index.append(self.num_spins * self.num_frq) if model == MODEL_NS_2SITE_STAR: - self.end_index.append(self.num_spins * self.num_frq) + self.end_index.append(2 * self.num_spins * self.num_frq) + + # The spin and dependent parameters (phi_ex, dw, padw2). self.end_index.append(self.end_index[-1] + self.num_spins) if model == MODEL_IT99: self.end_index.append(self.end_index[-1] + self.num_spins)