DAQ: fixed bug in identify_crystal_raster where if filtered_images is none, none was given to max(). Now checks for this and uses all images if filtered_images is None
This commit is contained in:
+11
-4
@@ -295,19 +295,26 @@ class AareDAQ:
|
||||
return self.__devs.tell.get_detected_pucks()
|
||||
|
||||
def identify_crystal_raster(self, result, r: RasterGridRequest):
|
||||
if result.images:
|
||||
filtered_images = [img for img in result.images
|
||||
images = result.images
|
||||
if images:
|
||||
|
||||
filtered_images = [img for img in images
|
||||
if img.spots_ice is not None and img.spots_low_res > 0 and (img.spots_ice / img.spots_low_res) < 5.0
|
||||
and (img.spots_ice / img.spots_low_res) != 1]
|
||||
|
||||
indexed_images = [img for img in filtered_images if img.index]
|
||||
if filtered_images:
|
||||
images=filtered_images
|
||||
|
||||
indexed_images = [img for img in images if img.index]
|
||||
|
||||
if indexed_images:
|
||||
max_image = max(indexed_images, key=lambda img: img.spots_low_res)
|
||||
print(max_image.spots_ice / max_image.spots_low_res)
|
||||
print(f"Image with maximum spots_low_res: {max_image}")
|
||||
print(f"Maximum spots_low_res value: {max_image.spots_low_res}")
|
||||
|
||||
else:
|
||||
images = [img for img in filtered_images]
|
||||
images = [img for img in images]
|
||||
print("No indexed images found.")
|
||||
max_image = max(images, key=lambda img: img.spots_low_res)
|
||||
print(f"Image with maximum spots_low_res: {max_image}")
|
||||
|
||||
Reference in New Issue
Block a user