Author: tlinnet Date: Wed Jun 18 17:11:24 2014 New Revision: 24103 URL: http://svn.gna.org/viewcvs/relax?rev=24103&view=rev Log: Moved the Ãparter conversion in LM63 3site into the lib function. This cleans up the target api function. Task #7807 (https://gna.org/task/index.php?7807): Speed-up of dispersion models for Clustered analysis. Modified: branches/disp_spin_speed/lib/dispersion/lm63_3site.py branches/disp_spin_speed/target_functions/relax_disp.py Modified: branches/disp_spin_speed/lib/dispersion/lm63_3site.py URL: http://svn.gna.org/viewcvs/relax/branches/disp_spin_speed/lib/dispersion/lm63_3site.py?rev=24103&r1=24102&r2=24103&view=diff ============================================================================== --- branches/disp_spin_speed/lib/dispersion/lm63_3site.py (original) +++ branches/disp_spin_speed/lib/dispersion/lm63_3site.py Wed Jun 18 17:11:24 2014 @@ -69,7 +69,7 @@ from numpy.ma import fix_invalid, masked_where -def r2eff_LM63_3site(r20=None, rex_B=None, rex_C=None, quart_kB=None, quart_kC=None, cpmg_frqs=None, back_calc=None): +def r2eff_LM63_3site(r20=None, phi_ex_B=None, phi_ex_C=None, kB=None, kC=None, cpmg_frqs=None, back_calc=None): """Calculate the R2eff values for the LM63 3-site model. See the module docstring for details. @@ -77,19 +77,29 @@ @keyword r20: The R20 parameter value (R2 with no exchange). @type r20: numpy float array of rank [NS][NM][NO][ND] - @keyword rex_B: The phi_ex_B / kB parameter value. - @type rex_B: numpy float array of rank [NS][NM][NO][ND] - @keyword rex_C: The phi_ex_C / kC parameter value. - @type rex_C: numpy float array of rank [NE][NS][NM][NO][ND] - @keyword quart_kB: Approximate chemical exchange rate constant between sites A and B (the exchange rate in rad/s) divided by 4. - @type quart_kB: float - @keyword quart_kC: Approximate chemical exchange rate constant between sites A and C (the exchange rate in rad/s) divided by 4. - @type quart_kC: float + @keyword phi_ex_B: The fast exchange factor between sites A and B (ppm^2) + @type phi_ex_B: numpy float array of rank [NS][NM][NO][ND] + @keyword phi_ex_C: The fast exchange factor between sites A and C (ppm^2) + @type phi_ex_C: numpy float array of rank [NE][NS][NM][NO][ND] + @keyword kB: Approximate chemical exchange rate constant between sites A and B (the exchange rate in rad/s). + @type kB: float + @keyword kC: Approximate chemical exchange rate constant between sites A and C (the exchange rate in rad/s). + @type kC: float @keyword cpmg_frqs: The CPMG nu1 frequencies. @type cpmg_frqs: numpy float array of rank [NE][NS][NM][NO][ND] @keyword back_calc: The array for holding the back calculated R2eff values. Each element corresponds to one of the CPMG nu1 frequencies. @type back_calc: numpy float array of rank [NE][NS][NM][NO][ND] """ + + # Once off parameter conversions. + # The phi_ex_B / kB parameter value. + rex_B = phi_ex_B / kB + # The phi_ex_C / kC parameter value. + rex_C = phi_ex_C / kC + # Approximate chemical exchange rate constant between sites A and B (the exchange rate in rad/s) divided by 4. + quart_kB = kB / 4.0 + # Approximate chemical exchange rate constant between sites A and C (the exchange rate in rad/s) divided by 4. + quart_kC = kC / 4.0 # Flag to tell if values should be replaced. t_rex_zero = False Modified: branches/disp_spin_speed/target_functions/relax_disp.py URL: http://svn.gna.org/viewcvs/relax/branches/disp_spin_speed/target_functions/relax_disp.py?rev=24103&r1=24102&r2=24103&view=diff ============================================================================== --- branches/disp_spin_speed/target_functions/relax_disp.py (original) +++ branches/disp_spin_speed/target_functions/relax_disp.py Wed Jun 18 17:11:24 2014 @@ -1062,21 +1062,15 @@ kB = params[self.end_index[2]] kC = params[self.end_index[2]+1] - # Once off parameter conversions. - rex_B = phi_ex_B / kB - rex_C = phi_ex_C / kC - quart_kB = kB / 4.0 - quart_kC = kC / 4.0 - # Convert phi_ex (or rex) from ppm^2 to (rad/s)^2. - multiply( multiply.outer( rex_B.reshape(1, self.NS), self.nm_no_nd_ones ), self.frqs_squared, out=self.phi_ex_B_struct ) - multiply( multiply.outer( rex_C.reshape(1, self.NS), self.nm_no_nd_ones ), self.frqs_squared, out=self.phi_ex_C_struct ) + multiply( multiply.outer( phi_ex_B.reshape(1, self.NS), self.nm_no_nd_ones ), self.frqs_squared, out=self.phi_ex_B_struct ) + multiply( multiply.outer( phi_ex_C.reshape(1, self.NS), self.nm_no_nd_ones ), self.frqs_squared, out=self.phi_ex_C_struct ) # Reshape R20 to per experiment, spin and frequency. self.r20_struct[:] = multiply.outer( R20.reshape(self.NE, self.NS, self.NM), self.no_nd_ones ) # Back calculate the R2eff values. - r2eff_LM63_3site(r20=self.r20_struct, rex_B=self.phi_ex_B_struct, rex_C=self.phi_ex_C_struct, quart_kB=quart_kB, quart_kC=quart_kC, cpmg_frqs=self.cpmg_frqs, back_calc=self.back_calc) + r2eff_LM63_3site(r20=self.r20_struct, phi_ex_B=self.phi_ex_B_struct, phi_ex_C=self.phi_ex_C_struct, kB=kB, kC=kC, cpmg_frqs=self.cpmg_frqs, back_calc=self.back_calc) # Clean the data for all values, which is left over at the end of arrays. self.back_calc = self.back_calc*self.disp_struct