Apply suggestions from code review of branch stack-height-sanitise
Co-authored-by: Julian Stirling <julian@julianstirling.co.uk>
This commit is contained in:
parent
c89db72d0a
commit
33ff356f76
1 changed files with 6 additions and 5 deletions
|
|
@ -104,7 +104,8 @@ class StackParams(BaseModel):
|
||||||
raise ValueError("Can't save more images than the minimum number tested.")
|
raise ValueError("Can't save more images than the minimum number tested.")
|
||||||
return self
|
return self
|
||||||
|
|
||||||
@computed_field
|
# Note MyPy doesn't support decorating properties. See MyPy Pull #16571 and issue #14461.
|
||||||
|
@computed_field # type: ignore[prop-decorator]
|
||||||
@property
|
@property
|
||||||
def stack_z_range(self) -> int:
|
def stack_z_range(self) -> int:
|
||||||
"""The range of the z stack, in steps.
|
"""The range of the z stack, in steps.
|
||||||
|
|
@ -115,7 +116,7 @@ class StackParams(BaseModel):
|
||||||
"""
|
"""
|
||||||
return self.stack_dz * (self.min_images_to_test - 1)
|
return self.stack_dz * (self.min_images_to_test - 1)
|
||||||
|
|
||||||
@computed_field
|
@computed_field # type: ignore[prop-decorator]
|
||||||
@property
|
@property
|
||||||
def steps_undershoot(self) -> int:
|
def steps_undershoot(self) -> int:
|
||||||
"""The distance to deliberately undershoot the estimated optimal starting point."""
|
"""The distance to deliberately undershoot the estimated optimal starting point."""
|
||||||
|
|
@ -125,7 +126,7 @@ class StackParams(BaseModel):
|
||||||
# requires extra +z movements and captures.
|
# requires extra +z movements and captures.
|
||||||
return self.stack_dz * self.img_undershoot
|
return self.stack_dz * self.img_undershoot
|
||||||
|
|
||||||
@computed_field
|
@computed_field # type: ignore[prop-decorator]
|
||||||
@property
|
@property
|
||||||
def max_images_to_test(self) -> int:
|
def max_images_to_test(self) -> int:
|
||||||
"""The maximum number of images that will be captured and tested in a stack.
|
"""The maximum number of images that will be captured and tested in a stack.
|
||||||
|
|
@ -492,7 +493,7 @@ class AutofocusThing(lt.Thing):
|
||||||
autofocus_dz: int,
|
autofocus_dz: int,
|
||||||
save_resolution: tuple[int, int],
|
save_resolution: tuple[int, int],
|
||||||
logger: lt.deps.InvocationLogger,
|
logger: lt.deps.InvocationLogger,
|
||||||
) -> Type[StackParams]:
|
) -> StackParams:
|
||||||
"""Set up the parameters used for all stacks in a scan.
|
"""Set up the parameters used for all stacks in a scan.
|
||||||
|
|
||||||
:param images_dir: the folder to save all images
|
:param images_dir: the folder to save all images
|
||||||
|
|
@ -518,7 +519,7 @@ class AutofocusThing(lt.Thing):
|
||||||
cam: CameraClient,
|
cam: CameraClient,
|
||||||
stage: Stage,
|
stage: Stage,
|
||||||
sharpness_monitor: SharpnessMonitorDep,
|
sharpness_monitor: SharpnessMonitorDep,
|
||||||
stack_parameters: Type[StackParams],
|
stack_parameters: StackParams,
|
||||||
) -> tuple[bool, int]:
|
) -> tuple[bool, int]:
|
||||||
"""Run a smart stack.
|
"""Run a smart stack.
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue