From 283a10c560429dd631f8343a89f9dbbc7b27a94b Mon Sep 17 00:00:00 2001 From: Joe Knapper Date: Wed, 23 Apr 2025 09:15:54 +0000 Subject: [PATCH] Always move back to expected focus after failed autofocus --- src/openflexure_microscope_server/things/smart_scan.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/openflexure_microscope_server/things/smart_scan.py b/src/openflexure_microscope_server/things/smart_scan.py index 7d6124ab..8d96927a 100644 --- a/src/openflexure_microscope_server/things/smart_scan.py +++ b/src/openflexure_microscope_server/things/smart_scan.py @@ -632,7 +632,7 @@ class SmartScanThing(Thing): if autofocus_sharp_enough: return True, self._stage.position["z"] else: - z = this_xyz[2] - dz / 2 if attempts < max_attempts else this_xyz[2] + z = this_xyz[2] self._stage.move_absolute(z=z) self._scan_logger.warning("Could not autofocus after 3 attempts.")