Docstrings and tweaks of ScanWorflow refactor

This commit is contained in:
Julian Stirling 2026-01-15 22:00:15 +00:00
parent c938560f00
commit 11ef1217e0
4 changed files with 16 additions and 16 deletions

View file

@ -567,7 +567,7 @@ class AutofocusThing(lt.Thing):
"""Capture a series of images checking that sharpest image central.
This is part of run_smart_stack. This is the actual z_stackng stacking method
called by the action run_smart_stack. The action also handles reseting,
called by the action run_smart_stack. The action also handles resetting,
autofocussing, and retrying.
The images are separated in z offset by stack_parameters.stack_dz, as they

View file

@ -40,13 +40,13 @@ SettingModelType = TypeVar("SettingModelType", bound=BaseModel)
class ScanWorkflow(Generic[SettingModelType], lt.Thing):
"""A base class for all Scanworkflows.
Scan workflows set the behaviour of a scan, inclduing the background detection,
scan planning, aquisition routine.
Scan workflows set the behaviour of a scan, including the background detection,
scan planning, acquisition routine.
"""
_settings_model: type[SettingModelType]
# All workdlows must have a set class for scan planning
# All workflows must have a set class for scan planning
_planner_cls: type[ScanPlanner]
# All workflows set a save resolution
@ -98,19 +98,19 @@ class ScanWorkflow(Generic[SettingModelType], lt.Thing):
"Each specific ScanWorkflow must implement a ``new_scan_planner`` method."
)
def aquisition_routine(
def acquisition_routine(
self, settings: SettingModelType, xyz_pos: tuple[int, int, int]
) -> tuple[bool, Optional[int]]:
"""Overload to set the aquisition routine that happens at each scan site."""
"""Overload to set the acquisition routine that happens at each scan site."""
raise NotImplementedError(
"Each specific ScanWorkflow must implement an aquisition routine"
"Each specific ScanWorkflow must implement an acquisition routine"
)
class HistoScanSettingsModel(BaseModel):
"""The settings for a scan with the HistoScanWorkflow.
This includes settings caluclated when starting. This will be held by smart scan
This includes settings calculated when starting. This will be held by smart scan
during a scan and serialised to disk.
"""
@ -188,7 +188,7 @@ class HistoScanWorkflow(ScanWorkflow[HistoScanSettingsModel]):
* 200 for 20x
"""
# The noqa statment is because scan_name is unused but is needed for equivalence
# The noqa statement is because scan_name is unused but is needed for equivalence
# with other workflows that may want to validate the scan name.
def check_before_start(self, scan_name: str) -> None: # noqa: ARG002
"""Before starting a scan, check that background and camera-stage-mapping are set.
@ -389,13 +389,13 @@ class HistoScanWorkflow(ScanWorkflow[HistoScanSettingsModel]):
planner_settings=planner_settings,
)
def aquisition_routine(
def acquisition_routine(
self, settings: HistoScanSettingsModel, xyz_pos: tuple[int, int, int]
) -> tuple[bool, Optional[int]]:
"""Perform aquisition routine. This is run at each scan location.
"""Perform acquisition routine. This is run at each scan location.
:param settings: The settings for this scan as a HistoScanSettingsModel
:param xyz_position: The current position as a tuple or 3 ints.
:param xyz_pos: The current position as a tuple or 3 ints.
:return: A tuple of whether an image was taken, and the z-position for focus.
If failed to find focus, returns for the focus z-position.
"""

View file

@ -179,8 +179,8 @@ class SmartScanThing(lt.Thing):
def sample_scan(self, scan_name: str = "") -> None:
"""Move the stage to cover an area, taking images.
Depending on the way the stage moves depends on the selected worflow.
If images overlap for a scan workdlow then the images can be stitched together
Depending on the way the stage moves depends on the selected workflow.
If images overlap for a scan workflow then the images can be stitched together
into a larger composite image.
"""
got_lock = self._scan_lock.acquire(timeout=0.1)
@ -383,7 +383,7 @@ class SmartScanThing(lt.Thing):
new_pos_xyz[1],
self._stage.position["z"],
)
imaged, focus_height = workflow.aquisition_routine(
imaged, focus_height = workflow.acquisition_routine(
workflow_settings, current_pos_xyz
)