Author: tlinnet Date: Wed Jun 18 17:39:08 2014 New Revision: 24113 URL: http://svn.gna.org/viewcvs/relax?rev=24113&view=rev Log: Moved the parameter conversion of MMQ CR72 into lib 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/mmq_cr72.py branches/disp_spin_speed/target_functions/relax_disp.py Modified: branches/disp_spin_speed/lib/dispersion/mmq_cr72.py URL: http://svn.gna.org/viewcvs/relax/branches/disp_spin_speed/lib/dispersion/mmq_cr72.py?rev=24113&r1=24112&r2=24113&view=diff ============================================================================== --- branches/disp_spin_speed/lib/dispersion/mmq_cr72.py (original) +++ branches/disp_spin_speed/lib/dispersion/mmq_cr72.py Wed Jun 18 17:39:08 2014 @@ -52,7 +52,7 @@ from numpy.ma import fix_invalid, masked_greater_equal, masked_where -def r2eff_mmq_cr72(r20=None, pA=None, pB=None, dw=None, dwH=None, kex=None, k_AB=None, k_BA=None, cpmg_frqs=None, inv_tcpmg=None, tcp=None, back_calc=None): +def r2eff_mmq_cr72(r20=None, pA=None, dw=None, dwH=None, kex=None, cpmg_frqs=None, inv_tcpmg=None, tcp=None, back_calc=None): """The CR72 model extended to MMQ CPMG data. This function calculates and stores the R2eff values. @@ -62,18 +62,12 @@ @type r20: numpy float array of rank [NS][NM][NO][ND] @keyword pA: The population of state A. @type pA: float - @keyword pB: The population of state B. - @type pB: float @keyword dw: The chemical exchange difference between states A and B in rad/s. @type dw: numpy float array of rank [NS][NM][NO][ND] @keyword dwH: The proton chemical exchange difference between states A and B in rad/s. @type dwH: numpy float array of rank [NS][NM][NO][ND] @keyword kex: The kex parameter value (the exchange rate in rad/s). @type kex: float - @keyword k_AB: The rate of exchange from site A to B (rad/s). - @type k_AB: float - @keyword k_BA: The rate of exchange from site B to A (rad/s). - @type k_BA: float @keyword cpmg_frqs: The CPMG nu1 frequencies. @type cpmg_frqs: numpy float array of rank [NS][NM][NO][ND] @keyword inv_tcpmg: The inverse of the total duration of the CPMG element (in inverse seconds). @@ -83,6 +77,11 @@ @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 [NS][NM][NO][ND] """ + + # Once off parameter conversions. + pB = 1.0 - pA + k_BA = pA * kex + k_AB = pB * kex # Flag to tell if values should be replaced if max_etapos in cosh function is violated. t_dw_dw_H_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=24113&r1=24112&r2=24113&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:39:08 2014 @@ -1261,11 +1261,6 @@ pA = params[self.end_index[2]] kex = params[self.end_index[2]+1] - # Once off parameter conversions. - pB = 1.0 - pA - k_BA = pA * kex - k_AB = pB * kex - # Convert dw and dwH from ppm to rad/s. Use the out argument, to pass directly to structure. multiply( multiply.outer( dw.reshape(1, self.NS), self.nm_no_nd_ones ), self.frqs, out=self.dw_struct ) multiply( multiply.outer( dwH.reshape(1, self.NS), self.nm_no_nd_ones ), self.frqs_H, out=self.dwH_struct ) @@ -1298,7 +1293,7 @@ aliased_dwH = dw_frq # Back calculate the R2eff values. - r2eff_mmq_cr72(r20=r20, pA=pA, pB=pB, dw=aliased_dw, dwH=aliased_dwH, kex=kex, k_AB=k_AB, k_BA=k_BA, cpmg_frqs=self.cpmg_frqs[ei], inv_tcpmg=self.inv_relax_times[ei], tcp=self.tau_cpmg[ei], back_calc=self.back_calc[ei]) + r2eff_mmq_cr72(r20=r20, pA=pA, dw=aliased_dw, dwH=aliased_dwH, kex=kex, cpmg_frqs=self.cpmg_frqs[ei], inv_tcpmg=self.inv_relax_times[ei], tcp=self.tau_cpmg[ei], back_calc=self.back_calc[ei]) # Clean the data for all values, which is left over at the end of arrays. self.back_calc = self.back_calc*self.disp_struct