monashmicroimaging / podocytes

GNU General Public License v3.0
2 stars 3 forks source link

Need to check list of dataframes is not empty before pandas concatenation #26

Closed GenevieveBuckley closed 5 years ago

GenevieveBuckley commented 6 years ago

If there are no matching files found an empty list is generated, and pandas concat does not enjoy trying to concatenate an empty list. We need to raise and handle the error appropriately instead.

2018-08-31 10:43:53,478 Podocyte automated analysis program
...
2018-08-31 10:43:53,479 0 .lif files found.
[54500] Failed to execute script launch-gui
Traceback (most recent call last):
  File "bin/launch-gui.py", line 3, in <module>
  File "podocytes/main.py", line 61, in main
  File "site-packages/pandas/core/reshape/concat.py", line 225, in concat
  File "site-packages/pandas/core/reshape/concat.py", line 259, in __init__
ValueError: No objects to concatenate
GenevieveBuckley commented 6 years ago

This is a bigger bug than it seems, particularly now that we're not writing the csv output files until the very end:

2018-08-31 11:54:55,451 Processing file: /Volumes/NO NAME/Images/51641/glom 14.tif
2018-08-31 11:54:55,693 Image:0
2018-08-31 11:54:55,694 glom 14.tif
2018-08-31 11:54:56,208 Voxel volume in real space: 0.29264116114765465
2018-08-31 11:54:56,486 1 glomeruli identified.
2018-08-31 11:54:58,511 54 podocytes found for glomerulus with centroid voxel coord (x,y,z): (114, 93, 43)
2018-08-31 11:54:58,635 Processing file: /Volumes/NO NAME/Images/51641/glom 15.tif
2018-08-31 11:54:58,830 Image:0
2018-08-31 11:54:58,830 glom 15.tif
2018-08-31 11:54:59,294 Voxel volume in real space: 0.29264116114765465
2018-08-31 11:54:59,562 0 glomeruli identified.
[57605] Failed to execute script launch-gui
Traceback (most recent call last):
  File "bin/launch-gui.py", line 3, in <module>
  File "podocytes/main.py", line 54, in main
  File "podocytes/main.py", line 574, in process_image_series
  File "site-packages/pandas/core/reshape/concat.py", line 225, in concat
  File "site-packages/pandas/core/reshape/concat.py", line 259, in __init__
ValueError: No objects to concatenate