From b812c6be35484b51dd94904d2b4ab390edd84424 Mon Sep 17 00:00:00 2001 From: jaknapper Date: Wed, 21 May 2025 15:41:49 +0100 Subject: [PATCH] Settling time as global, settle before taking first image in stack --- src/openflexure_microscope_server/things/autofocus.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/openflexure_microscope_server/things/autofocus.py b/src/openflexure_microscope_server/things/autofocus.py index 306a928c..1a14f074 100644 --- a/src/openflexure_microscope_server/things/autofocus.py +++ b/src/openflexure_microscope_server/things/autofocus.py @@ -34,6 +34,8 @@ from .capture import CaptureThing CaptureDep = direct_thing_client_dependency(CaptureThing, "/capture/") +SETTLING_TIME = 0.3 + class JPEGSharpnessMonitor: __globals__ = globals() # Required for FastAPI dependency @@ -295,6 +297,8 @@ class AutofocusThing(Thing): stage.move_relative(z=-stack_z_range / 2) for capture_count in range(images_to_capture): + time.sleep(SETTLING_TIME) + jpeg_path = os.path.join( stack_dir, f"{capture_count}.jpeg", @@ -309,7 +313,6 @@ class AutofocusThing(Thing): # If the stack isn't complete yet, move if capture_count + 1 < images_to_capture: stage.move_relative(z=stack_dz) - time.sleep(0.3) self.copy_central_image_from_stack(images_dir, stack_dir)