Project

General

Profile

gui / zero division error from GetVirtualSize

Added by Anonymous almost 20 years ago

a question for christian, i guess?

i'm trying to acquire raw images using the calibrations application on our non-suse machine with manually compiled modules (wxpython, numarray, etc.). acquire fails with a zero division in gui/wx/ImageViewer.py; specifically, getScrolledCenter tries to return (x + width/2.0)/vwidth, where vwidth (from self.panel.GetVirtualSize) is 0. same thing works fine on the suse machine, so this must be an error or missed option in the compilation of wxpython or something similar? have you ever come across something like that?

justus


Replies (3)

- Added by Anonymous almost 20 years ago

after several weeks of work, we have still not been able to get rid of this problem.

we have tried reinstalling or updating all of the relevant graphics packages on our custom distro, from the gtk+ up, on 2.4 and 2.6 kernels. our latest try was glib 2.6.4, gtk+ 2.6.7, pygtk 2.6.1, wx 2.6.0, wxPython 2.6.0 on a kernel 2.6.9 (these are the latest releases of all packages, i believe; we have tried installing the earlier version corresponding to the suse distro, without success). however, this doesn't change a thing, the zero-division exceptions stay where they were.....

our temporary solution has been to edit the gui/wx/ImageViewer.py source code and remove the call to the function panel.getvirtualsize and pass some parameters by hand (why yes, we are getting desperate ;). this seems to work to some degree; leginon keeps on running and data acquistion looks alright. there are some minor issues with the imageviewer showing negative values for x- and y-coordinates beyond the picture (i.e. raw data) boundaries (if i remember correctly, this does not appear on the suse-platform), but apart from that, we have not experienced any other problems. i am still playing around with the image acquisition a bit, so we will see how the packages behaves...

do you anticipate any problems with this temporary solution? if i understand the code correctly, the function in question (getscrolledcenter) is used only for scaling of the acquired picture, right? do you see any way for securing this crude fix by bypassing getvirtualsize in any way?

thanks for you help,

justus

- Added by Jim Pulokas almost 20 years ago

Justus,

Your temporary solution should not create any problems. I just looked it up, and the latest Leginon release (1.1) has a fix for this zero division if you are willing to upgrade. Maybe your fix is similar to our fix. Unfortunately, I just found a mistake in the "fixed" version also. This is what the new getScrolledCenter looks like in 1.1:

  def getScrolledCenter(self):

x, y = self.panel.GetViewStart()

width, height = self.panel.GetSize()

vwidth, vheight = self.panel.GetVirtualSize()

if vwidth == 0:

x = 0

else:

(x + width/2.0)/vwidth

if vheight == 0:

y = 0

else:

y = (y + height/2.0)/vheight

return x, y

But there is one thing missing. The following line:

(x+width/2.0)/vwidth

should be:

x = (x+width/2.0)/vwidth

Seems like this would cause some problems, but I have not had any complaints about it, so I'll have to investigate.

Jim

- Added by Anonymous over 19 years ago

okay, thanks a lot. actually, i had been hoping that this had been fixed in the 1.1. i'll give it a try as soon as i get some microscope time. thanks again,

j.

    (1-3/3)