Author: tlinnet
Date: Wed Jun 11 08:28:27 2014
New Revision: 23814
URL: http://svn.gna.org/viewcvs/relax?rev=23814&view=rev
Log:
Initial try to reshape dw faster.
Task #7807 (https://gna.org/task/index.php?7807): Speed-up of dispersion
models for Clustered analysis.
Modified:
branches/disp_spin_speed/target_functions/relax_disp.py
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=23814&r1=23813&r2=23814&view=diff
==============================================================================
--- branches/disp_spin_speed/target_functions/relax_disp.py (original)
+++ branches/disp_spin_speed/target_functions/relax_disp.py Wed Jun 11
08:28:27 2014
@@ -27,7 +27,7 @@
# Python module imports.
from copy import deepcopy
from math import pi
-from numpy import array, asarray, complex64, dot, float64, int16, max,
ones, sqrt, sum, tile, zeros
+from numpy import add, array, asarray, complex64, dot, float64, int16,
max, multiply, ones, sqrt, sum, tile, zeros
from numpy.ma import masked_equal
# relax module imports.
@@ -557,6 +557,14 @@
@rtype: float
"""
+ # Loop over the dw elements (one per spin).
+ for si in range(self.si):
+ # First multiply the spin specific dw with the spin specific
frequency mask, using temporary storage.
+ multiply(dw[si], self.dw_mask[si], self.dw_temp[si])
+
+ # Then add to the total, using temporary storage.
+ add(self.dw_struct, self.dw_temp[si], self.dw_struct)
+
# Reshape dw to per experiment and nr spins.
dw_axis = asarray(dw).reshape(self.numpy_array_shape[0],
self.numpy_array_shape[1])
@@ -568,6 +576,13 @@
# Convert dw from ppm to rad/s.
dw_frq_a = dw_axis*self.disp_struct*self.frqs_a
+
+ ## Show that the structure is reproduced perfectly.
+ diff = sum(self.dw_struct - dw_frq_a)
+ if diff != 0.0:
+ print "WOOOPS", diff
+ import sys
+ sys.exit()
# Reshape R20A and R20B to per experiment, spin and frequency.
R20A_axis = R20A.reshape(self.numpy_array_shape[0],
self.numpy_array_shape[1], self.numpy_array_shape[2])
_______________________________________________
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