mailr23830 - /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:20 2014
New Revision: 23830

URL: http://svn.gna.org/viewcvs/relax?rev=23830&view=rev
Log:
Restructured the calculation of R20A and R20B to the most efficient way.

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=23830&r1=23829&r2=23830&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:20 2014
@@ -441,6 +441,11 @@
             self.dw_struct = deepcopy(zeros_a)
             self.nm_no_nd_struct = ones([self.NM, self.NO, self.ND], float64)
 
+            # Structure of r20a and r20b. The full and outer dimensions 
structures.
+            self.r20a_struct = deepcopy(zeros_a)
+            self.r20b_struct = deepcopy(zeros_a)
+            self.no_nd_struct = ones([self.NO, self.ND], float64)
+
             # Loop over the experiment types.
             for ei in range(self.NE):
                 # Loop over the spins.
@@ -558,19 +563,11 @@
         multiply( multiply.outer( asarray(dw).reshape(self.NE, self.NS), 
self.nm_no_nd_struct ), self.frqs_struct, out=self.dw_struct )
 
         # Reshape R20A and R20B to per experiment, spin and frequency.
-        R20A_axis = R20A.reshape(self.NE, self.NS, self.NM)
-        R20B_axis = R20B.reshape(self.NE, self.NS, self.NM)
-
-        # Expand R20A and R20B axis to offset and dispersion points.
-        R20A_axis = R20A_axis[:,:,:,None,None]
-        R20B_axis = R20B_axis[:,:,:,None,None]
-
-        # Tile R20A and R20B according to maximum of dispersion points. 
Multiply with spin structure array.
-        R20A_axis = tile(R20A_axis, (1, 1, 1, self.NO, self.ND)) * 
self.disp_struct
-        R20B_axis = tile(R20B_axis, (1, 1, 1, self.NO, self.ND)) * 
self.disp_struct
+        self.r20a_struct[:] = multiply.outer( asarray(R20A).reshape(self.NE, 
self.NS, self.NM), self.no_nd_struct )
+        self.r20b_struct[:] = multiply.outer( asarray(R20B).reshape(self.NE, 
self.NS, self.NM), self.no_nd_struct )
 
         ## Back calculate the R2eff values.
-        r2eff_CR72(r20a=R20A_axis, r20b=R20B_axis, pA=pA, dw=self.dw_struct, 
kex=kex, cpmg_frqs=self.cpmg_frqs_a, back_calc=self.back_calc_a, 
num_points=self.num_disp_points_a)
+        r2eff_CR72(r20a=self.r20a_struct, r20b=self.r20b_struct, pA=pA, 
dw=self.dw_struct, kex=kex, cpmg_frqs=self.cpmg_frqs_a, 
back_calc=self.back_calc_a, num_points=self.num_disp_points_a)
 
         # Clean the data for all values, which is left over at the end of 
arrays.
         self.back_calc_a = self.back_calc_a*self.disp_struct




Related Messages


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