#30 OverflowError if input y data is constant

closed
nobody
None
5
2012-10-16
2005-09-22
lszumel
No

If min and max are not specified on an axis (I'm using
graph.axis.linear), and the y-data is constant,
parter.py gets an OverflowError when trying to compute
the range (log(max - min) == log(0) => math range
error). Feature or bug?

I'm using PyX 0.8. Here is the trace:

Traceback (most recent call last):
File "./mycode.py", line 46, in ?
c.writeEPSfile('somefile')
File
"/usr/lib/python2.3/site-packages/pyx/canvas.py", line
326, in writeEPSfile
document.document([document.page(self,
**kwargs)]
).writeEPSfile(filename)
File
"/usr/lib/python2.3/site-packages/pyx/document.py",
line 138, in writeEPSfile
pswriter.epswriter(self, filename, args, *kwargs)
File
"/usr/lib/python2.3/site-packages/pyx/pswriter.py",
line 235, in init
bbox = page.bbox()
File
"/usr/lib/python2.3/site-packages/pyx/document.py",
line 78, in bbox
bbox = self.canvas.bbox()
File
"/usr/lib/python2.3/site-packages/pyx/canvas.py", line
161, in bbox
abbox = cmd.bbox()
File
"/usr/lib/python2.3/site-packages/pyx/graph/graph.py",
line 445, in bbox
self.finish()
File
"/usr/lib/python2.3/site-packages/pyx/graph/graph.py",
line 342, in finish
self.domethods0
File
"/usr/lib/python2.3/site-packages/pyx/graph/graph.py",
line 275, in dolayout
self.axes[key].create(self.texrunner)
File
"/usr/lib/python2.3/site-packages/pyx/graph/axis/axis.py",
line 526, in create
self.canvas = self.axis.create(self.data,
self.positioner, graphtexrunner, self.errorname)
File
"/usr/lib/python2.3/site-packages/pyx/graph/axis/axis.py",
line 163, in create
self.min is None, self.max is None)
File
"/usr/lib/python2.3/site-packages/pyx/graph/axis/parter.py",
line 148, in partfunctions
logmm = math.log(max - min) / math.log(10)
OverflowError: math range error

Discussion

  • lszumel

    lszumel - 2005-09-22
     
  • Andre Wobst

    Andre Wobst - 2005-09-23

    Logged In: YES
    user_id=405853

    I agree that the exception is bad, since it doesn't guide you to the source
    of the problem. I fixed it in the CVS head (i.e. for 0.9) some time ago
    already, where now a RuntimeError with the description "partitioning failed
    due to empty or invalid axis range" is raised instead. I hope this helps to
    clearify the situation. Beside that (and its not the first time we're
    discussing this issue) I just don't know how to proper handle this case,
    since I don't want some strange magic for such a case, where I just can't
    tell what the user really wants. I think an exception is the only option we
    have.

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks