Project

General

Profile

Actions

Bug #13569

closed

Grid images with no squares found result in Ptolemy error and an empty file

Added by William Rice about 2 years ago. Updated about 2 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
-
Target version:
Start date:
10/03/2022
Due date:
% Done:

0%

Estimated time:
Affected Version:
Appion/Leginon 3.6
Show in known bugs:
No
Workaround:

Description

  • Ptolemy crashes with the following error if it finds no squares in a LM image, script lowmag_cli.py
    /data/cryoem/cryoemdata/leginon/22sep30c/rawdata/22sep30c_p5b12g4_00032gr.mrc
    Traceback (most recent call last):
      File "/home/svc_cryoem/packages/ptolemy/lowmag_cli.py", line 92, in <module>
        main()
      File "/home/svc_cryoem/packages/ptolemy/lowmag_cli.py", line 46, in main
        ex.get_crops(cropper)
      File "/home/svc_cryoem/packages/ptolemy/ptolemy/images.py", line 71, in get_crops
        crops = CropSet(crops, self.boxes, self.rotated_boxes)
      File "/home/svc_cryoem/packages/ptolemy/ptolemy/CropSet.py", line 13, in __init__
        self.center_coords = PointSet2D.concatenate([PointSet2D([int(np.mean(box.y))], [int(np.mean(box.x))]) for box in boxes])
      File "/home/svc_cryoem/packages/ptolemy/ptolemy/PointSet.py", line 93, in concatenate
        new = np.concatenate([ps.as_matrix_y() for ps in list_of_pointsets], axis=0)
      File "<__array_function__ internals>", line 5, in concatenate
    ValueError: need at least one array to concatenate
    
  • it produces an empty output file which then causes problems in the external hole finder in Leginon:
    Exception in thread data binder handler thread:
    Traceback (most recent call last):
      File "/usr/lib64/python2.7/threading.py", line 812, in __bootstrap_inner
        self.run()
      File "/usr/lib64/python2.7/threading.py", line 765, in run
        self.__target(*self.__args, **self.__kwargs)
      File "/usr/lib/python2.7/site-packages/leginon/databinder.py", line 131, in handleData
        method(args)
      File "/usr/lib/python2.7/site-packages/leginon/mosaictargetfinder.py", line 201, in handleTargetListDone
        self.autoTargetFinder()
      File "/usr/lib/python2.7/site-packages/leginon/mosaictargetfinder.py", line 241, in autoTargetFinder
        blobs = self.findSquareBlobs()
      File "/usr/lib/python2.7/site-packages/leginon/mosaicexternalfinder.py", line 469, in findSquareBlobs
        self.loadBlobs(label, outpath)
      File "/usr/lib/python2.7/site-packages/leginon/mosaicexternalfinder.py", line 190, in loadBlobs
        line = f.readlines()[0]
    IndexError: list index out of range
    
  • This results in Leginon needing the user to press the square finding button to get a list of squares, and the list is randomly incomplete
  • I added an exception to the Leginon code, in that if the readlines call fails, it returns an empty set of points, which lets Leginon handle an empty file
Actions

Also available in: Atom PDF