Author: tlinnet
Date: Wed Jun 11 15:25:32 2014
New Revision: 23839
URL: http://svn.gna.org/viewcvs/relax?rev=23839&view=rev
Log:
Replaced the temporary variable R2eff with back_calc, and used numpy
subtract to speed up.
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=23839&r1=23838&r2=23839&view=diff
==============================================================================
--- branches/disp_spin_speed/lib/dispersion/cr72.py (original)
+++ branches/disp_spin_speed/lib/dispersion/cr72.py Wed Jun 11 15:25:32
2014
@@ -92,7 +92,7 @@
"""
# Python module imports.
-from numpy import arccosh, array, cos, cosh, isfinite, fabs, min, max,
sqrt, sum
+from numpy import arccosh, array, cos, cosh, isfinite, fabs, min, max,
sqrt, subtract, sum
from numpy.ma import fix_invalid, masked_greater_equal, masked_less,
masked_where
# Repetitive calculations (to speed up calculations).
@@ -181,8 +181,8 @@
back_calc[:] = r20_kex
return
- # Calculate R2eff.
- R2eff = r20_kex - cpmg_frqs * arccosh( fact )
+ # Calculate R2eff. This uses the temporary buffer and fill directly to
back_calc.
+ subtract(r20_kex, cpmg_frqs * arccosh( fact ), out=back_calc)
# Replace data in array.
# If dw is zero.
@@ -191,7 +191,7 @@
back_calc[:] = array([r20a]*num_points)
return
else:
- R2eff[mask_dw_zero.mask] = r20a[mask_dw_zero.mask]
+ back_calc[mask_dw_zero.mask] = r20a[mask_dw_zero.mask]
# If eta_pos above 700.
if t_max_etapos:
@@ -199,12 +199,10 @@
back_calc[:] = array([r20a]*num_points)
return
else:
- R2eff[mask_max_etapos.mask] = r20a[mask_max_etapos.mask]
+ back_calc[mask_max_etapos.mask] = r20a[mask_max_etapos.mask]
# Catch errors, taking a sum over array is the fastest way to check for
# +/- inf (infinity) and nan (not a number).
- if not isfinite(sum(R2eff)):
+ if not isfinite(sum(back_calc)):
# Replaces nan, inf, etc. with fill value.
- fix_invalid(R2eff, copy=False, fill_value=1e100)
-
- back_calc[:] = R2eff
+ fix_invalid(back_calc, copy=False, fill_value=1e100)
_______________________________________________
relax (http://www.nmr-relax.com)
This is the relax-commits mailing list
relax-commits@xxxxxxx
To unsubscribe from this list, get a password
reminder, or change your subscription options,
visit the list information page at
https://mail.gna.org/listinfo/relax-commits