From 75cc75b10eda4fde1dc77555be89033b2f93606b Mon Sep 17 00:00:00 2001 From: Filip Leonarski Date: Mon, 14 Jul 2025 10:33:45 +0200 Subject: [PATCH] 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 --- daq/src/aaredaq/daq.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/daq/src/aaredaq/daq.py b/daq/src/aaredaq/daq.py index c19f3d99..159f2060 100644 --- a/daq/src/aaredaq/daq.py +++ b/daq/src/aaredaq/daq.py @@ -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}")