mailr23447 - /branches/disp_speed/lib/dispersion/tsmfk01.py


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

Header


Content

Posted by tlinnet on May 26, 2014 - 23:10:
Author: tlinnet
Date: Mon May 26 23:10:00 2014
New Revision: 23447

URL: http://svn.gna.org/viewcvs/relax?rev=23447&view=rev
Log:
Critical fix for the math domain catching of model TSMFK01.

This was discovered with the added 8 unit tests demonstrating edge case 'no 
Rex' failures.

This follows from the ideas in the post 
http://article.gmane.org/gmane.science.nmr.relax.devel/5858.
This is related to: task #7793: (https://gna.org/task/?7793) Speed-up of 
dispersion models.

This is to implement catching of math domain errors, before they occur.

The cathing of these occurences needed to be re-written.

Modified:
    branches/disp_speed/lib/dispersion/tsmfk01.py

Modified: branches/disp_speed/lib/dispersion/tsmfk01.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/disp_speed/lib/dispersion/tsmfk01.py?rev=23447&r1=23446&r2=23447&view=diff
==============================================================================
--- branches/disp_speed/lib/dispersion/tsmfk01.py       (original)
+++ branches/disp_speed/lib/dispersion/tsmfk01.py       Mon May 26 23:10:00 
2014
@@ -88,6 +88,10 @@
     @type num_points:       int
     """
 
+    # Catch parameter values that will result in no exchange, returning flat 
R2eff = R20 lines (when kex = 0.0, k_AB = 0.0).
+    if dw == 0.0 or k_AB == 0.0:
+        return array([r20a]*num_points)
+
     # Denominator.
     denom = dw * tcp
 
@@ -97,12 +101,7 @@
     # Catch zeros (to avoid pointless mathematical operations).
     # This will result in no exchange, returning flat lines.
     if min(numer) == 0.0:
-        return r20a + k_AB
-
-    # Catch math domain error of dividing with 0.
-    # This is when sin(denom) = 0.
-    if min(denom) == 0.0:
-        return array([1e100]*num_points)
+        return array([r20a + k_AB]*num_points) 
 
     # Calculate R2eff.
     R2eff = r20a + k_AB - k_AB * numer / denom
@@ -112,4 +111,4 @@
     if not isfinite(sum(R2eff)):
         R2eff = array([1e100]*num_points)
 
-    return R2eff
+    return R2eff




Related Messages


Powered by MHonArc, Updated Mon May 26 23:20:03 2014