[Numpy-svn] r8251 - trunk/numpy/testing
numpy-svn at scipy.org
numpy-svn at scipy.org
Sun Feb 21 18:17:54 EST 2010
Author: charris
Date: 2010-02-21 17:17:54 -0600 (Sun, 21 Feb 2010)
New Revision: 8251
Modified:
trunk/numpy/testing/utils.py
Log:
BUG: Ignore "invalid value" from abs in testing/utils.py
Modified: trunk/numpy/testing/utils.py
===================================================================
--- trunk/numpy/testing/utils.py 2010-02-21 22:05:45 UTC (rev 8250)
+++ trunk/numpy/testing/utils.py 2010-02-21 23:17:54 UTC (rev 8251)
@@ -521,9 +521,14 @@
return
# Normalized the numbers to be in range (-10.0,10.0)
# scale = float(pow(10,math.floor(math.log10(0.5*(abs(desired)+abs(actual))))))
- scale = 0.5*(np.abs(desired) + np.abs(actual))
- scale = np.power(10,np.floor(np.log10(scale)))
+ err = np.seterr(invalid='ignore')
try:
+ scale = 0.5*(np.abs(desired) + np.abs(actual))
+ scale = np.power(10,np.floor(np.log10(scale)))
+ finally:
+ np.seterr(**err)
+
+ try:
sc_desired = desired/scale
except ZeroDivisionError:
sc_desired = 0.0
More information about the Numpy-svn
mailing list