mailRe: r24297 - in /branches/disp_spin_speed: lib/dispersion/ns_cpmg_2site_3d.py target_functions/relax_disp.py


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

Header


Content

Posted by Edward d'Auvergne on June 25, 2014 - 08:51:
Hi,

For this change, you don't need to put M0_0 into 'self'.  This
structure is no longer used and can be removed from the lib.dispersion
code.  It is best to minimise the number of objects placed into the
class instance namespace (self).

Regards,

Edward



On 25 June 2014 02:14,  <tlinnet@xxxxxxxxxxxxx> wrote:
Author: tlinnet
Date: Wed Jun 25 02:14:42 2014
New Revision: 24297

URL: http://svn.gna.org/viewcvs/relax?rev=24297&view=rev
Log:
For model NS CPMG 2site 3d, the M0 matrix was preformed for higher 
dimensionality in init of target function.

The transposes/rolled axis versions was also initiated.

Task #7807 (https://gna.org/task/index.php?7807): Speed-up of dispersion 
models for Clustered analysis.

Modified:
    branches/disp_spin_speed/lib/dispersion/ns_cpmg_2site_3d.py
    branches/disp_spin_speed/target_functions/relax_disp.py

Modified: branches/disp_spin_speed/lib/dispersion/ns_cpmg_2site_3d.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/disp_spin_speed/lib/dispersion/ns_cpmg_2site_3d.py?rev=24297&r1=24296&r2=24297&view=diff
==============================================================================
--- branches/disp_spin_speed/lib/dispersion/ns_cpmg_2site_3d.py (original)
+++ branches/disp_spin_speed/lib/dispersion/ns_cpmg_2site_3d.py Wed Jun 25 
02:14:42 2014
@@ -224,7 +224,7 @@
     return c_mat


-def r2eff_ns_cpmg_2site_3D(r180x=None, M0=None, r10a=0.0, r10b=0.0, 
r20a=None, r20b=None, pA=None, dw=None, dw_orig=None, kex=None, 
inv_tcpmg=None, tcp=None, back_calc=None, num_points=None, power=None):
+def r2eff_ns_cpmg_2site_3D(r180x=None, M0=None, M0_T=None, r10a=0.0, 
r10b=0.0, r20a=None, r20b=None, pA=None, dw=None, dw_orig=None, kex=None, 
inv_tcpmg=None, tcp=None, back_calc=None, num_points=None, power=None):
     """The 2-site numerical solution to the Bloch-McConnell equation.

     This function calculates and stores the R2eff values.
@@ -233,7 +233,9 @@
     @keyword r180x:         The X-axis pi-pulse propagator.
     @type r180x:            numpy float64, rank-2, 7D array
     @keyword M0:            This is a vector that contains the initial 
magnetizations corresponding to the A and B state transverse magnetizations.
-    @type M0:               numpy float64, rank-1, 7D array
+    @type M0:               numpy float array of rank 
[NE][NS][NM][NO][ND][7][1]
+    @keyword M0_T:          This is a vector that contains the initial 
magnetizations corresponding to the A and B state transverse 
magnetizations, where the outer two axis has been swapped for efficient dot 
operations.
+    @type M0_T:             numpy float array of rank 
[NE][NS][NM][NO][ND][1][7]
     @keyword r10a:          The R1 value for state A.
     @type r10a:             float
     @keyword r10b:          The R1 value for state B.
@@ -281,8 +283,10 @@
     k_AB = pB * kex

     # This is a vector that contains the initial magnetizations 
corresponding to the A and B state transverse magnetizations.
-    M0[1] = pA
-    M0[4] = pB
+    M0_T[:, :, :, :, :, 0, 1] = pA
+    M0_T[:, :, :, :, :, 0, 4] = pB
+    M0[:, :, :, :, :, 1, 0] = pA
+    M0[:, :, :, :, :, 4, 0] = pB

     # Extract the total numbers of experiments, number of spins, number of 
magnetic field strength, number of offsets, maximum number of dispersion 
point.
     NE, NS, NM, NO, ND = back_calc.shape
@@ -316,7 +320,7 @@
                 r20a_si_mi_di = r20a[0, si, mi, 0, di]

                 # Initial magnetisation.
-                Mint_i = M0
+                Mint_i = M0[0, si, mi, 0, di]

                 # This matrix is a propagator that will evolve the 
magnetization with the matrix R for a delay tcp.
                 evolution_matrix_i = evolution_matrix_mat[0, si, mi, 0, di]
@@ -326,7 +330,7 @@
                     Mint_i = dot(evolution_matrix_i, Mint_i)

                 # The next lines calculate the R2eff using a two-point 
approximation, i.e. assuming that the decay is mono-exponential.
-                Mx = Mint_i[1] / pA
+                Mx = Mint_i[1][0] / pA
                 if Mx <= 0.0 or isNaN(Mx):
                     back_calc[0, si, mi, 0, di] = r20a_si_mi_di
                 else:

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=24297&r1=24296&r2=24297&view=diff
==============================================================================
--- branches/disp_spin_speed/target_functions/relax_disp.py     (original)
+++ branches/disp_spin_speed/target_functions/relax_disp.py     Wed Jun 25 
02:14:42 2014
@@ -400,8 +400,11 @@
         if model in [MODEL_NS_MMQ_3SITE, MODEL_NS_MMQ_3SITE_LINEAR]:
             self.M0 = zeros(3, float64)
         if model in [MODEL_NS_CPMG_2SITE_3D, MODEL_NS_CPMG_2SITE_3D_FULL]:
-            self.M0 = zeros(7, float64)
-            self.M0[0] = 0.5
+            M0_0 = zeros( [self.NE, self.NS, self.NM, self.NO, self.ND,7, 
1], float64)
+            M0_0[:, :, :, :, :, 0, 0] = 0.5
+            self.M0 = M0_0
+            # Transpose M0, to prepare for dot operation. Roll the last 
axis one back, corresponds to a transpose for the outer two axis.
+            self.M0_T = rollaxis(self.M0, 6, 5)
         if model in [MODEL_NS_R1RHO_2SITE]:
             # Offset of spin-lock from A.
             da_mat = self.chemical_shifts - self.offset
@@ -596,7 +599,7 @@
         self.r20b_struct[:] = multiply.outer( R20B.reshape(self.NE, 
self.NS, self.NM), self.no_nd_ones )

         # Back calculate the R2eff values.
-        r2eff_ns_cpmg_2site_3D(r180x=self.r180x, M0=self.M0, 
r20a=self.r20a_struct, r20b=self.r20b_struct, pA=pA, dw=self.dw_struct, 
dw_orig=dw, kex=kex, inv_tcpmg=self.inv_relax_times, tcp=self.tau_cpmg, 
back_calc=self.back_calc, num_points=self.num_disp_points, power=self.power)
+        r2eff_ns_cpmg_2site_3D(r180x=self.r180x, M0=self.M0, 
M0_T=self.M0_T, r20a=self.r20a_struct, r20b=self.r20b_struct, pA=pA, 
dw=self.dw_struct, dw_orig=dw, kex=kex, inv_tcpmg=self.inv_relax_times, 
tcp=self.tau_cpmg, back_calc=self.back_calc, 
num_points=self.num_disp_points, power=self.power)

         # Clean the data for all values, which is left over at the end of 
arrays.
         self.back_calc = self.back_calc*self.disp_struct


_______________________________________________
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



Related Messages


Powered by MHonArc, Updated Wed Jun 25 09:20:18 2014