From 7c3a9ad01fdd615b9be0d67e4e2ca088c3cb7edb Mon Sep 17 00:00:00 2001 From: jaknapper Date: Mon, 23 Jun 2025 18:08:27 +0100 Subject: [PATCH] Copy sharpest image from stack, not the most average sharpness! --- src/openflexure_microscope_server/things/autofocus.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/openflexure_microscope_server/things/autofocus.py b/src/openflexure_microscope_server/things/autofocus.py index ab6a4c0a..64013551 100644 --- a/src/openflexure_microscope_server/things/autofocus.py +++ b/src/openflexure_microscope_server/things/autofocus.py @@ -353,8 +353,7 @@ class AutofocusThing(Thing): image to images dir.""" image_list = glob.glob(os.path.join(stack_dir, "*")) image_list = sorted(image_list, key=os.path.getsize) - central_index = (len(image_list) - 1) // 2 - central_image = image_list[central_index] + central_image = image_list[-1] xy_location = os.path.basename(stack_dir) logger.info(central_image)