From dbb65d55b5edb9587b8874f3175d7f8a9cd0c93b Mon Sep 17 00:00:00 2001 From: jaknapper Date: Tue, 17 Jun 2025 12:05:46 +0100 Subject: [PATCH] Use scan autofocus dz --- src/openflexure_microscope_server/things/autofocus.py | 3 ++- src/openflexure_microscope_server/things/smart_scan.py | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/openflexure_microscope_server/things/autofocus.py b/src/openflexure_microscope_server/things/autofocus.py index eadc26dc..117e40b0 100644 --- a/src/openflexure_microscope_server/things/autofocus.py +++ b/src/openflexure_microscope_server/things/autofocus.py @@ -297,6 +297,7 @@ class AutofocusThing(Thing): capture: CaptureDep, sharpness_monitor: SharpnessMonitorDep, images_dir: str, + autofocus_dz: int, ) -> None: """Run a z stack, saving all images to stack_dir and copying the central image to stack_dir""" @@ -360,7 +361,7 @@ class AutofocusThing(Thing): self.looping_autofocus( stage=stage, sharpness_monitor=sharpness_monitor, - dz=2000, + dz=autofocus_dz, ) stage.move_relative( z=-(overshoot + BACKLASH_CORRECTION + stack_z_range / 2) diff --git a/src/openflexure_microscope_server/things/smart_scan.py b/src/openflexure_microscope_server/things/smart_scan.py index 92f5f5aa..2eb5d285 100644 --- a/src/openflexure_microscope_server/things/smart_scan.py +++ b/src/openflexure_microscope_server/things/smart_scan.py @@ -646,6 +646,7 @@ class SmartScanThing(Thing): focused_height = self._autofocus.run_z_stack( images_dir=self._ongoing_scan_images_dir, + autofocus_dz = self._scan_data['autofocus_dz'] ) current_pos_xyz = (