Update Thing Settings to use the new format provided by PR #110 of Labthings FastAPI
This commit is contained in:
parent
fd4d51401f
commit
840ed7f20e
10 changed files with 169 additions and 203 deletions
|
|
@ -19,7 +19,8 @@ from pydantic import BaseModel
|
|||
|
||||
from labthings_fastapi.thing import Thing
|
||||
from labthings_fastapi.dependencies.blocking_portal import BlockingPortal
|
||||
from labthings_fastapi.decorators import thing_action, thing_property
|
||||
from labthings_fastapi.decorators import thing_action
|
||||
from labthings_fastapi.descriptors import ThingSetting
|
||||
from labthings_fastapi.types.numpy import NDArray
|
||||
|
||||
from .camera import RawCameraDependency as Camera
|
||||
|
|
@ -396,37 +397,36 @@ class AutofocusThing(Thing):
|
|||
stage.move_absolute(z=peak_height)
|
||||
return heights.tolist(), sizes.tolist()
|
||||
|
||||
@thing_property
|
||||
def stack_images_to_save(self) -> int:
|
||||
"""The number of images to capture and save in a stack
|
||||
Defaults to 1 unless you need to see either side of focus"""
|
||||
return self.thing_settings.get("stack_images_to_save", 1)
|
||||
stack_images_to_save = ThingSetting(
|
||||
initial_value=1,
|
||||
model=int,
|
||||
description="""The number of images to save in a stack.
|
||||
|
||||
@stack_images_to_save.setter
|
||||
def stack_images_to_save(self, value: int) -> None:
|
||||
self.thing_settings["stack_images_to_save"] = value
|
||||
Defaults to 1 unless you need to see either side of focus""",
|
||||
)
|
||||
|
||||
@thing_property
|
||||
def stack_min_images_to_test(self) -> int:
|
||||
"""The number of images to test for successful focusing in a stack
|
||||
Defaults to 9, which balances reliability and speed"""
|
||||
return self.thing_settings.get("stack_min_images_to_test", 9)
|
||||
stack_min_images_to_test = ThingSetting(
|
||||
initial_value=9,
|
||||
model=int,
|
||||
description="""The minimum number of images to capture in a stack.
|
||||
|
||||
@stack_min_images_to_test.setter
|
||||
def stack_min_images_to_test(self, value: int) -> None:
|
||||
self.thing_settings["stack_min_images_to_test"] = value
|
||||
This many images are captures and tested for focus, if the focus
|
||||
is not central enough more images may be captured. After new images
|
||||
are captured the number sets the number of images used for checking
|
||||
if focus is central.
|
||||
|
||||
@thing_property
|
||||
def stack_dz(self) -> int:
|
||||
"""Space in steps between images in a z-stack
|
||||
Suggested is 50 for 60-100x
|
||||
100 for 40x
|
||||
200 for 20x"""
|
||||
return self.thing_settings.get("stack_dz", 50)
|
||||
Defaults to 9 which balances reliability and speed
|
||||
""",
|
||||
)
|
||||
|
||||
@stack_dz.setter
|
||||
def stack_dz(self, value: int) -> None:
|
||||
self.thing_settings["stack_dz"] = value
|
||||
stack_dz = ThingSetting(
|
||||
initial_value=50,
|
||||
model=int,
|
||||
description="""Space in steps between images in a z-stack
|
||||
Suggested is 50 for 60-100x
|
||||
100 for 40x
|
||||
200 for 20x""",
|
||||
)
|
||||
|
||||
@thing_action
|
||||
def run_smart_stack(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue