Project

General

Profile

Leginon 1.4.1 crash in targeting node with division by zero

Added by Anonymous over 17 years ago

I had Leginon 1.4.1 crashing in the Exposure Targeting node due to a division by zero. This occurred with a unusual case. Exposure Targeting had to deal with a blank image (itself targetted in error by Hole Targeting either due to bad settings in Hole Targeting or mis-aligned presets). These sort of images arise occasionally and it's better if Leginon can deal with them robustly rather than crash and stop entirely in the middle of a job. The blank image is mostly blank with some noise but may have some perfectly flat areas. I think this is causing problems with computing a moment in the blob detection stage. The error output is:

Exception in thread data binder handler thread:

Traceback (most recent call last):

File "/usr/lib64/python2.5/threading.py", line 460, in __bootstrap

self.run()

File "/usr/lib64/python2.5/threading.py", line 440, in run

self.__target(*self.__args, **self.__kwargs)

File "/usr/local/lib64/python2.5/site-packages/Leginon/databinder.py", line 131, in handleData

method(args)

File "/usr/local/lib64/python2.5/site-packages/Leginon/watcher.py", line 35, in handleEvent

self.processEvent(pubevent)

File "/usr/local/lib64/python2.5/site-packages/Leginon/watcher.py", line 46, in processEvent

self.processData(newdata)

File "/usr/local/lib64/python2.5/site-packages/Leginon/imagewatcher.py", line 46, in processData

self.processImageData(idata)

File "/usr/local/lib64/python2.5/site-packages/Leginon/targetfinder.py", line 196, in processImageData

self.findTargets(imagedata, targetlist)

File "/usr/local/lib64/python2.5/site-packages/Leginon/holefinder.py", line 436, in findTargets

self.everything()

File "/usr/local/lib64/python2.5/site-packages/Leginon/holefinder.py", line 371, in everything

self.findBlobs()

File "/usr/local/lib64/python2.5/site-packages/Leginon/holefinder.py", line 175, in findBlobs

self.hf.find_blobs()

File "/usr/local/lib64/python2.5/site-packages/Leginon/holefinderback.py", line 285, in find_blobs

blobs = imagefun.find_blobs(im, mask, border, maxblobs, maxsize)

File "/usr/local/lib64/python2.5/site-packages/pyami/imagefun.py", line 335, in find_blobs blobs = scipyblobs(image,tmpmask)

File "/usr/local/lib64/python2.5/site-packages/pyami/imagefun.py", line 271, in scipyblobs moments = moment_of_inertia(im,labels,range(1,n+1))

File "/usr/local/lib64/python2.5/site-packages/pyami/imagefun.py", line 301, in moment_of_inertia

moment = _moment(submask)

File "/usr/local/lib64/python2.5/site-packages/pyami/imagefun.py", line 312, in _moment

moi = scipy.ndimage.sum(subimage*sqmat)/(scipy.ndimage.sum(subimage)**2)*twopi

ZeroDivisionError: float division

I've modified _moment to just return zero when the denominator of the relevant expression is zero. I don't think this is correct but it is working for now. (I will probably attempt to come up with an improvement; but if Scripps can provide a suitable fix that would be better.) Also, I noticed when I added some output for the division by zero case that the numerator for this type of case (blank image and denominator equal to zero) is NaN,

William