Author: tlinnet Date: Mon Jun 9 00:49:15 2014 New Revision: 23751 URL: http://svn.gna.org/viewcvs/relax?rev=23751&view=rev Log: Changed all calls to numpy np.X functions to just the numpy function in lib/dispersion/cr72.py. Task #7807 (https://gna.org/task/index.php?7807): Speed-up of dispersion models for Clustered analysis. Modified: branches/disp_spin_speed/lib/dispersion/cr72.py Modified: branches/disp_spin_speed/lib/dispersion/cr72.py URL: http://svn.gna.org/viewcvs/relax/branches/disp_spin_speed/lib/dispersion/cr72.py?rev=23751&r1=23750&r2=23751&view=diff ============================================================================== --- branches/disp_spin_speed/lib/dispersion/cr72.py (original) +++ branches/disp_spin_speed/lib/dispersion/cr72.py Mon Jun 9 00:49:15 2014 @@ -93,7 +93,7 @@ # Python module imports. import numpy as np -from numpy import arccosh, array, cos, cosh, isfinite, min, max, sqrt, sum +from numpy import allclose, arccosh, array, cos, cosh, isfinite, min, max, ndarray, ones, sqrt, sum, zeros # Repetitive calculations (to speed up calculations). eta_scale = 2.0**(-3.0/2.0) @@ -124,7 +124,7 @@ # Determine if calculating in numpy rank-1 float array, of higher dimensions. rank_1 = True - if isinstance(num_points, np.ndarray): + if isinstance(num_points, ndarray): rank_1 = False # Catch parameter values that will result in no exchange, returning flat R2eff = R20 lines (when kex = 0.0, k_AB = 0.0). @@ -135,7 +135,7 @@ return # For higher dimensions, return same structure. else: - if np.allclose(dw, np.zeros(dw.shape)) or np.allclose(pA, np.ones(dw.shape)) or np.allclose(kex, np.zeros(dw.shape)): + if allclose(dw, zeros(dw.shape)) or allclose(pA, ones(dw.shape)) or allclose(kex, zeros(dw.shape)): back_calc[:] = r20a return @@ -149,7 +149,7 @@ k_AB = pB * kex # The Psi and zeta values. - if not np.allclose(r20a, r20b): + if not allclose(r20a, r20b): fact = r20a - r20b - k_BA + k_AB Psi = fact**2 - dw2 + 4.0*pA*pB*kex**2 zeta = 2.0*dw * fact @@ -199,6 +199,6 @@ if rank_1: R2eff = array([1e100]*num_points) else: - R2eff = np.ones(R2eff.shape) * 1e100 + R2eff = ones(R2eff.shape) * 1e100 back_calc[:] = R2eff