mailr20301 - /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 - 17:08:
Author: bugman
Date: Mon Jul 15 17:08:50 2013
New Revision: 20301

URL: http://svn.gna.org/viewcvs/relax?rev=20301&view=rev
Log:
The 'NS 2-site star' model is now more robust against math domain failures.

This includes the failure of the logarithmic of zero matrices.


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=20301&r1=20300&r2=20301&view=diff
==============================================================================
--- branches/relax_disp/lib/dispersion/ns_2site_star.py (original)
+++ branches/relax_disp/lib/dispersion/ns_2site_star.py Mon Jul 15 17:08:50 
2013
@@ -96,6 +96,11 @@
 
     # Loop over the time points, back calculating the R2eff values.
     for i in range(num_points):
+        # Catch zeros (to avoid matrix log failures).
+        if fA == 0.0 and pB == 0.0:
+            back_calc[i] = 0.0
+            continue
+
         # Replicated calculations for faster operation.
         tcp = 0.25 / cpmg_frqs[i]
 
@@ -111,6 +116,6 @@
         # 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 = prop_total * M0
 
-        # This and the next line calculate the R2eff using a two-point 
approximation, i.e. assuming that the decay is mono-exponential.
+        # The next lines calculate the R2eff using a two-point 
approximation, i.e. assuming that the decay is mono-exponential.
         Mgx = Moft[0].real / M0[0]
         back_calc[i]= -inv_tcpmg * log(Mgx)




Related Messages


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