[Numpy-discussion] verbosity control for warnings

Benjamin Georgi georgi at molgen.mpg.de
Wed Mar 29 01:51:17 CST 2006


my application frequently requires to take logarithms of zero, i.e.

>>> import numarray
>>> numarray.log(0.0)
Warning: Encountered divide by zero(s)  in log

Now, while the result of -inf works just fine, any direct application of 
numarray.log produces tons of warnings. Right now I'm masking the input 
arrays to avoid the warnings, which is rather inefficient.

So, the question is whether there is some kind of verbosity control I 
could use to deactivate these warnings. If there is no such functionality, 
I would like to suggest looking into the build-in Python logging package 
for that purpose.


More information about the Numpy-discussion mailing list