mailr23298 - /branches/disp_speed/lib/dispersion/lm63.py


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

Header


Content

Posted by tlinnet on May 21, 2014 - 13:03:
Author: tlinnet
Date: Wed May 21 13:02:59 2014
New Revision: 23298

URL: http://svn.gna.org/viewcvs/relax?rev=23298&view=rev
Log:
Align math-domain catching for model LM63 with trunk implementation.

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 catching of errors have to be more careful.

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

Modified: branches/disp_speed/lib/dispersion/lm63.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/disp_speed/lib/dispersion/lm63.py?rev=23298&r1=23297&r2=23298&view=diff
==============================================================================
--- branches/disp_speed/lib/dispersion/lm63.py  (original)
+++ branches/disp_speed/lib/dispersion/lm63.py  Wed May 21 13:02:59 2014
@@ -85,6 +85,15 @@
     @type num_points:       int
     """
 
+    # Catch divide with zeros (to avoid pointless mathematical operations).
+    if kex == 0.0:
+        return array([1e100]*num_points)
+
+    # Catch zeros (to avoid pointless mathematical operations).
+    # This will result in no exchange, returning flat lines.
+    if phi_ex == 0.0:
+        return array([r20]*num_points)
+
     # Repetitive calculations (to speed up calculations).
     rex = phi_ex / kex
     kex_4 = 4.0 / kex




Related Messages


Powered by MHonArc, Updated Wed May 21 13:20:03 2014