Author: tlinnet Date: Tue May 20 22:29:50 2014 New Revision: 23276 URL: http://svn.gna.org/viewcvs/relax?rev=23276&view=rev Log: Removed class object "back_calc" being updated per time point for model LM63. task #7793: (https://gna.org/task/?7793) Speed-up of dispersion models. To make the code look clean, the class object "back_calc" is no longer being updated per time point, but is updated in the relax_disp target function in one go. Modified: branches/disp_speed/lib/dispersion/lm63.py branches/disp_speed/target_functions/relax_disp.py Modified: branches/disp_speed/lib/dispersion/lm63.py URL: http://svn.gna.org/viewcvs/relax/branches/disp_speed/lib/dispersion/lm63.py?rev=23276&r1=23275&r2=23276&view=diff ============================================================================== --- branches/disp_speed/lib/dispersion/lm63.py (original) +++ branches/disp_speed/lib/dispersion/lm63.py Tue May 20 22:29:50 2014 @@ -67,7 +67,7 @@ from numpy import array, isfinite, sum, tanh -def r2eff_LM63(r20=None, phi_ex=None, kex=None, cpmg_frqs=None, back_calc=None, num_points=None): +def r2eff_LM63(r20=None, phi_ex=None, kex=None, cpmg_frqs=None, num_points=None): """Calculate the R2eff values for the LM63 model. See the module docstring for details. @@ -81,9 +81,7 @@ @type kex: float @keyword cpmg_frqs: The CPMG nu1 frequencies. @type cpmg_frqs: numpy rank-1 float array - @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 rank-1 float array - @keyword num_points: The number of points on the dispersion curve, equal to the length of the cpmg_frqs and back_calc arguments. + @keyword num_points: The number of points on the dispersion curve, equal to the length of the cpmg_frqs. @type num_points: int """ @@ -99,6 +97,4 @@ if not isfinite(sum(R2eff)): R2eff = array([1e100]*num_points) - # Parse back the value to update the back_calc class object. - for i in range(num_points): - back_calc[i] = R2eff[i] + return R2eff Modified: branches/disp_speed/target_functions/relax_disp.py URL: http://svn.gna.org/viewcvs/relax/branches/disp_speed/target_functions/relax_disp.py?rev=23276&r1=23275&r2=23276&view=diff ============================================================================== --- branches/disp_speed/target_functions/relax_disp.py (original) +++ branches/disp_speed/target_functions/relax_disp.py Tue May 20 22:29:50 2014 @@ -1117,7 +1117,7 @@ phi_ex_scaled = phi_ex[si] * self.frqs[0][si][mi]**2 # Back calculate the R2eff values. - r2eff_LM63(r20=R20[r20_index], phi_ex=phi_ex_scaled, kex=kex, cpmg_frqs=self.cpmg_frqs[0][mi][0], back_calc=self.back_calc[0][si][mi][0], num_points=self.num_disp_points[0][si][mi][0]) + self.back_calc[0][si][mi][0] = r2eff_LM63(r20=R20[r20_index], phi_ex=phi_ex_scaled, kex=kex, cpmg_frqs=self.cpmg_frqs[0][mi][0], num_points=self.num_disp_points[0][si][mi][0]) # For all missing data points, set the back-calculated value to the measured values so that it has no effect on the chi-squared value. for di in range(self.num_disp_points[0][si][mi][0]):