mailr23827 - /branches/disp_spin_speed/target_functions/relax_disp.py


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by tlinnet on June 11, 2014 - 13:12:
Author: tlinnet
Date: Wed Jun 11 13:12:14 2014
New Revision: 23827

URL: http://svn.gna.org/viewcvs/relax?rev=23827&view=rev
Log:
Yet another try to implement a fast dw structure method.

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=23827&r1=23826&r2=23827&view=diff
==============================================================================
--- branches/disp_spin_speed/target_functions/relax_disp.py     (original)
+++ branches/disp_spin_speed/target_functions/relax_disp.py     Wed Jun 11 
13:12:14 2014
@@ -29,6 +29,7 @@
 from math import pi
 from numpy import add, array, asarray, complex64, dot, float64, int16, max, 
multiply, ones, sqrt, sum, tile, zeros
 from numpy.ma import masked_equal
+from numpy import multiply
 
 # relax module imports.
 from lib.dispersion.b14 import r2eff_B14
@@ -445,6 +446,9 @@
             # The structure for multiplication with dw to piecewise build up 
the full dw structure.
             self.dw_mask = zeros(tuple([self.NS] + self.numpy_array_shape), 
float64)
 
+            # Create the outer dw array structure.
+            self.dw_outer = ones([self.NM, self.NO, self.ND], float64)
+
             # Loop over the experiment types.
             for ei in range(self.NE):
                 # Loop over the spins.
@@ -576,7 +580,8 @@
             # Expand dw to number of axis for frequency, offset and 
dispersion points.
             # Tile dw according to dimensions.
             # Convert dw from ppm to rad/s.
-            self.dw_struct[:] = tile(asarray(dw).reshape(self.NE, 
self.NS)[:,:,None,None,None], (1, 1, self.NM, self.NO, self.ND)) * 
self.disp_struct * self.frqs_a
+            #self.dw_struct[:] = tile(asarray(dw).reshape(self.NE, 
self.NS)[:,:,None,None,None], (1, 1, self.NM, self.NO, self.ND)) * 
self.disp_struct * self.frqs_a
+            self.dw_struct = multiply.outer( asarray(dw).reshape(self.NE, 
self.NS), self.dw_outer ) * self.disp_struct * self.frqs_a
 
         # Reshape R20A and R20B to per experiment, spin and frequency.
         R20A_axis = R20A.reshape(self.NE, self.NS, self.NM)




Related Messages


Powered by MHonArc, Updated Wed Jun 11 13:20:03 2014