Blackened

This commit is contained in:
Joel Collins 2020-10-19 18:34:58 +01:00
parent b9bed71272
commit 1677f0df76
2 changed files with 4 additions and 6 deletions

View file

@ -228,7 +228,7 @@ def fast_autofocus(microscope, dz=2000):
"""Perform a down-up-down-up autofocus"""
with microscope.camera.lock, microscope.stage.lock:
with monitor_sharpness(microscope) as m:
# Move to (-dz / 2)
# Move to (-dz / 2)
m.focus_rel(-dz / 2)
# Move to dz while monitoring sharpness
# i: Sharpness monitor index for this move
@ -237,8 +237,8 @@ def fast_autofocus(microscope, dz=2000):
# Get the z position with highest sharpness from the previous move (index i)
fz = m.sharpest_z_on_move(i)
# Move all the way to the start so it's consistent
# Store final absolute z position from this return move
i, z = m.focus_rel(-dz)
# Store final absolute z position from this return move
i, z = m.focus_rel(-dz)
# Move to the target position fz
# Can't do absolute move here yet so move by (fz - z)
m.focus_rel(fz - z)

View file

@ -203,9 +203,7 @@ class ScanExtension(BaseExtension):
if autofocus_enabled:
if fast_autofocus:
# Run fast autofocus. Client should provide dz ~ 2000
autofocus_extension.fast_autofocus(
microscope, dz=autofocus_dz
)
autofocus_extension.fast_autofocus(microscope, dz=autofocus_dz)
else:
# Run slow autofocus. Client should provide dz ~ 50
autofocus_extension.autofocus(