diff options
author | Travis Oliphant <oliphant@enthought.com> | 2007-12-15 18:54:52 +0000 |
---|---|---|
committer | Travis Oliphant <oliphant@enthought.com> | 2007-12-15 18:54:52 +0000 |
commit | e76b5fa6896c09257181675bbf4cf47789d32927 (patch) | |
tree | 7174e22c68fc47df61e745ee18625ee9f4f5b88c /numpy/numarray/util.py | |
parent | 02ee35a7e1c722a1cdac8f3a60fe9ef7aa079a37 (diff) | |
download | numpy-e76b5fa6896c09257181675bbf4cf47789d32927.tar.gz |
Create a branch for io work in NumPy
Diffstat (limited to 'numpy/numarray/util.py')
-rw-r--r-- | numpy/numarray/util.py | 40 |
1 files changed, 0 insertions, 40 deletions
diff --git a/numpy/numarray/util.py b/numpy/numarray/util.py deleted file mode 100644 index 2a7efb60d..000000000 --- a/numpy/numarray/util.py +++ /dev/null @@ -1,40 +0,0 @@ -from numpy import geterr - -__all__ = ['MathDomainError', 'UnderflowError', 'NumOverflowError', 'handleError', - 'get_numarray_include_dirs'] - -class MathDomainError(ArithmeticError): pass -class UnderflowError(ArithmeticError): pass -class NumOverflowError(OverflowError, ArithmeticError): pass - -def handleError(errorStatus, sourcemsg): - """Take error status and use error mode to handle it.""" - modes = geterr() - if errorStatus & FPE_INVALID: - if modes['invalid'] == "warn": - print "Warning: Encountered invalid numeric result(s)", sourcemsg - if modes['invalid'] == "raise": - raise MathDomainError(sourcemsg) - if errorStatus & FPE_DIVIDEBYZERO: - if modes['dividebyzero'] == "warn": - print "Warning: Encountered divide by zero(s)", sourcemsg - if modes['dividebyzero'] == "raise": - raise ZeroDivisionError(sourcemsg) - if errorStatus & FPE_OVERFLOW: - if modes['overflow'] == "warn": - print "Warning: Encountered overflow(s)", sourcemsg - if modes['overflow'] == "raise": - raise NumOverflowError(sourcemsg) - if errorStatus & FPE_UNDERFLOW: - if modes['underflow'] == "warn": - print "Warning: Encountered underflow(s)", sourcemsg - if modes['underflow'] == "raise": - raise UnderflowError(sourcemsg) - - -import os -import numpy -def get_numarray_include_dirs(): - base = os.path.dirname(numpy.__file__) - newdirs = [os.path.join(base, 'numarray')] - return newdirs |