Author: bugman Date: Tue Sep 10 14:21:26 2013 New Revision: 20962 URL: http://svn.gna.org/viewcvs/relax?rev=20962&view=rev Log: Some small speed ups for the TP02 R1rho dispersion model optimisation. Some unneeded calculations and aliases were removed. Modified: branches/relax_disp/lib/dispersion/tp02.py Modified: branches/relax_disp/lib/dispersion/tp02.py URL: http://svn.gna.org/viewcvs/relax/branches/relax_disp/lib/dispersion/tp02.py?rev=20962&r1=20961&r2=20962&view=diff ============================================================================== --- branches/relax_disp/lib/dispersion/tp02.py (original) +++ branches/relax_disp/lib/dispersion/tp02.py Tue Sep 10 14:21:26 2013 @@ -77,11 +77,10 @@ # Loop over the dispersion points, back calculating the R1rho values. for i in range(num_points): # We assume that A resonates at 0 [s^-1], without loss of generality. - Wsl = offset[i] # Larmor frequency of spin lock [s^-1]. W = pA*Wa + pB*Wb # Pop-averaged Larmor frequency [s^-1]. - da = Wa - Wsl # Offset of spin-lock from A. - db = Wb - Wsl # Offset of spin-lock from B. - d = W - Wsl # Offset of spin-lock from pop-average. + da = Wa - offset[i] # Offset of spin-lock from A. + db = Wb - offset[i] # Offset of spin-lock from B. + d = W - offset[i] # Offset of spin-lock from pop-average. waeff2 = spin_lock_fields[i]**2 + da**2 # Effective field at A. wbeff2 = spin_lock_fields[i]**2 + db**2 # Effective field at B. weff2 = spin_lock_fields[i]**2 + d**2 # Effective field at pop-average. @@ -91,7 +90,7 @@ # Repetitive calculations (to speed up calculations). sin_theta2 = sin(theta)**2 - R1_cos_theta2 = R1 * cos(theta)**2 + R1_cos_theta2 = R1 * (1.0 - sin_theta2) R1rho_prime_sin_theta2 = r1rho_prime * sin_theta2 # Catch zeros (to avoid pointless mathematical operations).