[SciPy-user] Pylab plotting: math range errors unrecoverable

Adam Ginsburg adam.ginsburg@colorado....
Thu Nov 15 13:07:51 CST 2007


I've been encountering these errors quite often:
<type 'exceptions.OverflowError'>: math range error

> /usr/lib/python2.5/site-packages/matplotlib/ticker.py(791)scale_range()

    790     else:

--> 791         ex = divmod(math.log10(-meanv), 1)[0]

    792         offset = -10**ex


They happen when I try to plot an array containing "inf" values - no
surprise there.  Two questions, though:
1. is there any way to make pylab ignore inf values, i.e. plot zeroes
or quit cleanly instead of giving a messy error?  I've looked at
masked arrays, but they don't seem to do it, and I'd like something
that does not require modifying my data
2. when I get the above error, then try to plot something WITHOUT
infinities, it fails with the exact same error, and when I ran the
debugger it claimed that meanv was still inf.  Is there any way to fix
that short of quitting and reentering the python command line?

Thanks,
Adam


More information about the SciPy-user mailing list