Hi,
Brendon Higgins wrote (April 20, 2011):
> When I set manual ticks (to remove those at the origin, for
> example) I get a ZeroDivisionErro in the rater. It seems that there is no
> weight. What I struggle to understand is why it works fine for ordinary
> PyX graphs, but not my minkowski class.
After much gnashing of teeth, I have eliminated my own code as the cause. I
believe this is a bug in PyX. Example trigger code can be constructed using
the ordinary data.function source with particular (and not unreasonable,
especially in the case of direct relativistic calculations) parameters, as
follows:
from pyx import *
g = graph.graphxy(width=8,
x=graph.axis.linear(title="$x$", min=-120000, max=120000,
manualticks=[graph.axis.tick.tick(0, None, None)]),
y=graph.axis.linear(title="$y$", min=-0.0002, max=0.0002,
manualticks=[graph.axis.tick.tick(0, None, None)]))
g.plot(graph.data.function("y(x)=x/6e8", min=0, max=0.0001))
g.writePDFfile("test")
The error looks something like this:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/b2higgin/packages/pyx/pyx/pyx/canvas.py", line 289, in
wrappedindocument
return method(d, file)
File "/home/b2higgin/packages/pyx/pyx/pyx/document.py", line 171, in
writePDFfile
pdfwriter.PDFwriter(self, _outputstream(file, "pdf"), **kwargs)
File "/home/b2higgin/packages/pyx/pyx/pyx/pdfwriter.py", line 316, in
__init__
catalog = PDFcatalog(document, self, registry)
File "/home/b2higgin/packages/pyx/pyx/pyx/pdfwriter.py", line 142, in
__init__
self.PDFpages = PDFpages(document, writer, registry)
File "/home/b2higgin/packages/pyx/pyx/pyx/pdfwriter.py", line 201, in
__init__
page = PDFpage(page, pageno, self, writer, registry)
File "/home/b2higgin/packages/pyx/pyx/pyx/pdfwriter.py", line 235, in
__init__
self.PDFcontent = PDFcontent(page, writer, self.pageregistry)
File "/home/b2higgin/packages/pyx/pyx/pyx/pdfwriter.py", line 267, in
__init__
page.processPDF(contentfile, writer, acontext, registry, self.bbox)
File "/home/b2higgin/packages/pyx/pyx/pyx/document.py", line 134, in
processPDF
self._process("processPDF", *args)
File "/home/b2higgin/packages/pyx/pyx/pyx/document.py", line 84, in _process
bbox.set(self.canvas.bbox())
File "/home/b2higgin/packages/pyx/pyx/pyx/graph/graph.py", line 151, in bbox
self.finish()
File "/home/b2higgin/packages/pyx/pyx/pyx/graph/graph.py", line 280, in
finish
self.doaxes()
File "/home/b2higgin/packages/pyx/pyx/pyx/graph/graph.py", line 503, in
doaxes
self.dolayout()
File "/home/b2higgin/packages/pyx/pyx/pyx/graph/graph.py", line 487, in
dolayout
self.doaxiscreate(axisname)
File "/home/b2higgin/packages/pyx/pyx/pyx/graph/graph.py", line 217, in
doaxiscreate
self.axes[axisname].create()
File "/home/b2higgin/packages/pyx/pyx/pyx/graph/axis/axis.py", line 574, in
create
self.canvas = self.axis.create(self.data, self.positioner,
self.graphtexrunner, self.errorname)
File "/home/b2higgin/packages/pyx/pyx/pyx/graph/axis/axis.py", line 237, in
create
return _regularaxis._create(self, data, positioner, graphtexrunner,
self.parter, self.rater, errorname)
File "/home/b2higgin/packages/pyx/pyx/pyx/graph/axis/axis.py", line 181, in
_create
rate = rater.rateticks(self, ticks, self.density)
File "/home/b2higgin/packages/pyx/pyx/pyx/graph/axis/rater.py", line 186, in
rateticks
return rate/weight
ZeroDivisionError: integer division or modulo by zero
This was the output with the current head version in svn. Remove the
manualticks and there is no problem. Perhaps some overzealous rounding is
going on somewhere; not sure why manualticks would trigger that, though.
Peace,
Brendon
------------------------------------------------------------------------------
WhatsUp Gold - Download Free Network Management Software
The most intuitive, comprehensive, and cost-effective network
management toolset available today. Delivers lowest initial
acquisition cost and overall TCO of any competing solution.
http://p.sf.net/sfu/whatsupgold-sd
_______________________________________________
PyX-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pyx-user