mailr20303 - /branches/relax_disp/lib/dispersion/ns_2site_star.py


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

Header


Content

Posted by edward on July 15, 2013 - 18:16:
Author: bugman
Date: Mon Jul 15 18:16:46 2013
New Revision: 20303

URL: http://svn.gna.org/viewcvs/relax?rev=20303&view=rev
Log:
Shifted to using the faster numpy.linalg.matrix_power() function in 
lib.dispersion.ns_2site_star.

This was originally using the 
lib.linear_algebra.matrix_power.square_matrix_power() function,
however the numpy equivalent is faster.


Modified:
    branches/relax_disp/lib/dispersion/ns_2site_star.py

Modified: branches/relax_disp/lib/dispersion/ns_2site_star.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/relax_disp/lib/dispersion/ns_2site_star.py?rev=20303&r1=20302&r2=20303&view=diff
==============================================================================
--- branches/relax_disp/lib/dispersion/ns_2site_star.py (original)
+++ branches/relax_disp/lib/dispersion/ns_2site_star.py Mon Jul 15 18:16:46 
2013
@@ -34,11 +34,9 @@
 # Python module imports.
 from math import log
 from numpy import add, complex, conj, dot
+from numpy.linalg import matrix_power
 if dep_check.scipy_module:
     from scipy.linalg import expm
-
-# relax module imports.
-from lib.linear_algebra.matrix_power import square_matrix_power
 
 
 def r2eff_ns_2site_star(Rr=None, Rex=None, RCS=None, R=None, M0=None, 
r20a=None, r20b=None, fA=None, pB=None, tcpmg=None, cpmg_frqs=None, 
back_calc=None, num_points=None):
@@ -101,7 +99,8 @@
         prop_2 = dot(dot(expm_R_tcp, expm(cR2*tcp)), expm_R_tcp)
 
         # Now create the total propagator that will evolve the magnetization 
under the CPMG train, i.e. it applies the above tau-180-tau-tau-180-tau so 
many times as required for the CPMG frequency under consideration.
-        prop_total = square_matrix_power(prop_2, cpmg_frqs[i]*tcpmg)
+        power = int(round(cpmg_frqs[i]*tcpmg))
+        prop_total = matrix_power(prop_2, power)
 
         # Now we apply the above propagator to the initial magnetization 
vector - resulting in the magnetization that remains after the full CPMG 
pulse train.  It is called M of t (t is the time after the CPMG train).
         Moft = dot(prop_total, M0)




Related Messages


Powered by MHonArc, Updated Mon Jul 15 18:40:01 2013