mailr23445 - /branches/disp_speed/lib/dispersion/tp02.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:09:
Author: tlinnet
Date: Mon May 26 23:09:56 2014
New Revision: 23445

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

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.

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

Modified: branches/disp_speed/lib/dispersion/tp02.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/disp_speed/lib/dispersion/tp02.py?rev=23445&r1=23444&r2=23445&view=diff
==============================================================================
--- branches/disp_speed/lib/dispersion/tp02.py  (original)
+++ branches/disp_speed/lib/dispersion/tp02.py  Mon May 26 23:09:56 2014
@@ -123,18 +123,13 @@
 
     # Catch zeros (to avoid pointless mathematical operations).
     # This will result in no exchange, returning flat lines.
-    if min(numer) == 0.0:
-        return R1_cos_theta2 + R1rho_prime_sin_theta2
+    if numer == 0.0:
+        return array([r1rho_prime]*num_points)
 
     # Denominator.
     denom = waeff2 * wbeff2 / weff2 + kex2
     #denom_extended = waeff2*wbeff2/weff2+kex2-2*sin_theta2*pA*pB*dw**2
  
-    # Catch math domain error of dividing with 0.
-    # This is when denom=0.
-    if min(abs(denom)) == 0:
-        return array([1e100]*num_points)
-
     # R1rho calculation.
     R1rho = R1_cos_theta2 + R1rho_prime_sin_theta2 + sin_theta2 * numer / 
denom
 




Related Messages


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