SETTLING_TIME global in stacking

This commit is contained in:
jaknapper 2025-05-14 19:49:42 +01:00 committed by Julian Stirling
parent 478c3629c9
commit 968bd339c2
2 changed files with 8 additions and 3 deletions

View file

@ -36,8 +36,8 @@ from .capture import CaptureThing
CaptureDep = direct_thing_client_dependency(CaptureThing, "/capture/")
SETTLING_TIME = 0.3
STACK_OVERSHOOT = 200
SETTLING_TIME = 0.3
class JPEGSharpnessMonitor:
@ -322,7 +322,8 @@ class AutofocusThing(Thing):
if capture_count + 1 < images_to_capture:
stage.move_relative(z=stack_dz)
moved = time.time()
image = image.resize(target_resolution, Image.BOX)
if image.size != target_resolution:
image = image.resize(target_resolution, Image.BOX)
downsampled = time.time()
capture._save_capture(
jpeg_path=jpeg_path,
@ -331,6 +332,11 @@ class AutofocusThing(Thing):
logger=logger,
)
saved = time.time()
if saved - start < SETTLING_TIME:
time.sleep(SETTLING_TIME - (saved - start))
logger.info(
f"Settled for an extra {round(SETTLING_TIME - (saved - start), 3)} seconds"
)
logger.debug(f"Capturing took {round(captured - start, 2)} s")
logger.debug(f"Resizing took {round(downsampled - moved, 2)} s")
logger.debug(f"Saving took {round(saved - downsampled, 2)} s")

View file

@ -84,7 +84,6 @@ class CameraProtocol(Protocol):
for the main stream"""
...
@thing_action
def capture_image(self, stream_name, wait):
"""Capture a PIL image from stream stream_name with timeout wait"""
...