mailr24186 - /branches/disp_spin_speed/lib/dispersion/ns_cpmg_2site_3d.py


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

Header


Content

Posted by tlinnet on June 20, 2014 - 08:37:
Author: tlinnet
Date: Fri Jun 20 08:37:29 2014
New Revision: 24186

URL: http://svn.gna.org/viewcvs/relax?rev=24186&view=rev
Log:
Simplified model CPMG 2site 3D.

The expansion of matrixes to higher dimensionality is not neccessary.

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

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=24186&r1=24185&r2=24186&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 Fri Jun 20 
08:37:29 2014
@@ -134,16 +134,11 @@
     # This matrix is a propagator that will evolve the magnetization with 
the matrix R for a delay tcp.
     Rexpo_mat = matrix_exponential_rankN(R_mat)
 
-    # Initial magnetisation.
-    # Expand axis, and tile up to dimensions.
-    Mint_mat =  tile(M0[newaxis, newaxis, newaxis, newaxis, newaxis, :, 
newaxis], (NE, NS, NM, NO, ND, 1, 1) )
-    r180x_mat = tile(r180x[newaxis, newaxis, newaxis, newaxis, newaxis, 
...], (NE, NS, NM, NO, ND, 1, 1) )
-
     # The the essential evolution matrix.
-    # This is a dot product of the outer [7][7] matrix of the Rexpo_mat and 
r180x_mat matrixes, which
-    # have the shape [NE][NS][NM][NO][ND][7][7].
+    # This is a dot product of the outer [7][7] matrix of the Rexpo_mat and 
r180x matrixes, which
+    # have the shape [NE][NS][NM][NO][ND][7][7] and [7][7].
     # This can be achieved by using numpy einsum, and where ellipsis 
notation will use the last axis.
-    evolution_matrix_mat = einsum('...ij,...jk', Rexpo_mat, r180x_mat)
+    evolution_matrix_mat = einsum('...ij,...jk', Rexpo_mat, r180x)
     evolution_matrix_mat = einsum('...ij,...jk', evolution_matrix_mat, 
Rexpo_mat)
     evolution_matrix_mat = einsum('...ij,...jk', evolution_matrix_mat, 
evolution_matrix_mat)
 
@@ -162,7 +157,7 @@
                 r20a_si_mi_di = r20a[0, si, mi, 0, di]
 
                 # Initial magnetisation.
-                Mint_i = Mint_mat[0, si, mi, 0, di]
+                Mint_i = M0
 
                 # 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]
@@ -172,7 +167,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][0] / pA
+                Mx = Mint_i[1] / pA
                 if Mx <= 0.0 or isNaN(Mx):
                     back_calc[0, si, mi, 0, di] = r20a_si_mi_di
                 else:




Related Messages


Powered by MHonArc, Updated Fri Jun 20 09:00:03 2014