[Numpy-discussion] verbosity control for warnings

Perry Greenfield perry at stsci.edu
Wed Mar 29 06:01:10 EST 2006


On Mar 29, 2006, at 4:50 AM, Benjamin Georgi wrote:

>
> Hi,
>
> 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
> -inf
>
> 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.
>

Yes, look at section 6.2 of the numarray manual.

Perry Greenfield





More information about the NumPy-Discussion mailing list