Swap stream for scan, target_resolution as arg

This commit is contained in:
jaknapper 2025-05-07 19:34:13 +01:00 committed by Julian Stirling
parent f5c1ff2621
commit 9f2a131f1e
4 changed files with 27 additions and 42 deletions

View file

@ -294,7 +294,7 @@ class AutofocusThing(Thing):
capture: CaptureDep,
images_dir: str,
stack_dir: str,
capture_method: str = "array",
target_resolution: tuple[int, int],
) -> None:
"""Run a z stack, saving all images to stack_dir and copying the
central image to stack_dir"""
@ -311,21 +311,13 @@ class AutofocusThing(Thing):
stack_dir,
f"{capture_count}.jpeg",
)
if capture_method == "blob":
capture.capture_jpeg(filename=jpeg_path, cam=cam)
elif capture_method == "hires_array" or capture_method == "array":
stream = "main" if capture_method == "array" else "full"
capture._capture_and_save(
jpeg_path=jpeg_path,
cam=cam,
logger=logger,
metadata_getter=metadata_getter,
stream_name=stream,
)
else:
raise ValueError(
'Capture method must be one of "array", "blob" or "hires_array"'
)
capture._capture_and_save(
jpeg_path=jpeg_path,
cam=cam,
logger=logger,
metadata_getter=metadata_getter,
target_resolution=target_resolution,
)
# If the stack isn't complete yet, move
if capture_count + 1 < images_to_capture: