From 0d32983b62b5dabcaa2f318cffabb64d1d37db29 Mon Sep 17 00:00:00 2001 From: jaknapper Date: Thu, 8 May 2025 20:05:16 +0100 Subject: [PATCH] Only undershoot z stack if image count > 1, settle before first capture --- src/openflexure_microscope_server/things/autofocus.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/openflexure_microscope_server/things/autofocus.py b/src/openflexure_microscope_server/things/autofocus.py index 0d90e70d..1edde53f 100644 --- a/src/openflexure_microscope_server/things/autofocus.py +++ b/src/openflexure_microscope_server/things/autofocus.py @@ -299,8 +299,10 @@ class AutofocusThing(Thing): images_to_capture = self.stack_images_to_capture stack_z_range = stack_dz * (images_to_capture - 1) - stage.move_relative(z=-(STACK_OVERSHOOT + stack_z_range / 2)) - stage.move_relative(z=STACK_OVERSHOOT) + if stack_z_range > 0: + stage.move_relative(z=-(STACK_OVERSHOOT + stack_z_range / 2)) + stage.move_relative(z=STACK_OVERSHOOT) + time.sleep(0.3) for capture_count in range(images_to_capture): time.sleep(SETTLING_TIME)