Move ThingSetting and ThingProperty docstrings under the definition.
This commit is contained in:
parent
12df8c9072
commit
11a1fd7f85
7 changed files with 42 additions and 47 deletions
|
|
@ -393,33 +393,34 @@ class AutofocusThing(lt.Thing):
|
||||||
stack_images_to_save = lt.ThingSetting(
|
stack_images_to_save = lt.ThingSetting(
|
||||||
initial_value=1,
|
initial_value=1,
|
||||||
model=int,
|
model=int,
|
||||||
description="""The number of images to save in a stack.
|
|
||||||
|
|
||||||
Defaults to 1 unless you need to see either side of focus""",
|
|
||||||
)
|
)
|
||||||
|
"""The number of images to save in a stack.
|
||||||
|
|
||||||
|
Defaults to 1 unless you need to see either side of focus
|
||||||
|
"""
|
||||||
|
|
||||||
stack_min_images_to_test = lt.ThingSetting(
|
stack_min_images_to_test = lt.ThingSetting(
|
||||||
initial_value=9,
|
initial_value=9,
|
||||||
model=int,
|
model=int,
|
||||||
description="""The minimum number of images to capture in a stack.
|
|
||||||
|
|
||||||
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.
|
|
||||||
|
|
||||||
Defaults to 9 which balances reliability and speed
|
|
||||||
""",
|
|
||||||
)
|
)
|
||||||
|
"""The minimum number of images to capture in a stack.
|
||||||
|
|
||||||
stack_dz = lt.ThingSetting(
|
This many images are captures and tested for focus, if the focus is not central
|
||||||
initial_value=50,
|
enough more images may be captured. After new images are captured the number sets
|
||||||
model=int,
|
the number of images used for checking if focus is central.
|
||||||
description="""Space in steps between images in a z-stack
|
|
||||||
Suggested is 50 for 60-100x
|
Defaults to 9 which balances reliability and speed/
|
||||||
100 for 40x
|
"""
|
||||||
200 for 20x""",
|
|
||||||
)
|
stack_dz = lt.ThingSetting(initial_value=50, model=int)
|
||||||
|
"""Distance in steps between images in a z-stack.
|
||||||
|
|
||||||
|
Suggested values:
|
||||||
|
|
||||||
|
* 50 for 60-100x
|
||||||
|
* 100 for 40x
|
||||||
|
* 200 for 20x
|
||||||
|
"""
|
||||||
|
|
||||||
@lt.thing_action
|
@lt.thing_action
|
||||||
def run_smart_stack(
|
def run_smart_stack(
|
||||||
|
|
|
||||||
|
|
@ -53,14 +53,14 @@ class BackgroundDetectThing(lt.Thing):
|
||||||
tolerance = lt.ThingSetting(
|
tolerance = lt.ThingSetting(
|
||||||
initial_value=7.0,
|
initial_value=7.0,
|
||||||
model=float,
|
model=float,
|
||||||
description="How many standard deviations to allow for the background",
|
|
||||||
)
|
)
|
||||||
|
"""How many standard deviations to allow for the background."""
|
||||||
|
|
||||||
fraction = lt.ThingSetting(
|
fraction = lt.ThingSetting(
|
||||||
initial_value=25.0,
|
initial_value=25.0,
|
||||||
model=float,
|
model=float,
|
||||||
description="How much of the image needs to be not background to label as sample",
|
|
||||||
)
|
)
|
||||||
|
"""How much of the image needs to be not background to label as sample"""
|
||||||
|
|
||||||
def background_mask(self, image: np.ndarray) -> np.ndarray:
|
def background_mask(self, image: np.ndarray) -> np.ndarray:
|
||||||
"""Calculate a binary image, showing whether each pixel is background.
|
"""Calculate a binary image, showing whether each pixel is background.
|
||||||
|
|
|
||||||
|
|
@ -128,22 +128,22 @@ class StreamingPiCamera2(BaseCamera):
|
||||||
stream_resolution = lt.ThingProperty(
|
stream_resolution = lt.ThingProperty(
|
||||||
tuple[int, int],
|
tuple[int, int],
|
||||||
initial_value=(820, 616),
|
initial_value=(820, 616),
|
||||||
description="Resolution to use for the MJPEG stream",
|
|
||||||
)
|
)
|
||||||
|
"""Resolution to use for the MJPEG stream."""
|
||||||
|
|
||||||
mjpeg_bitrate = lt.ThingProperty(
|
mjpeg_bitrate = lt.ThingProperty(
|
||||||
Optional[int],
|
Optional[int],
|
||||||
initial_value=100000000,
|
initial_value=100000000,
|
||||||
description="Bitrate for MJPEG stream (None for default)",
|
|
||||||
)
|
)
|
||||||
|
"""Bitrate for MJPEG stream (None for default)."""
|
||||||
|
|
||||||
stream_active = lt.ThingProperty(
|
stream_active = lt.ThingProperty(
|
||||||
bool,
|
bool,
|
||||||
initial_value=False,
|
initial_value=False,
|
||||||
description="Whether the MJPEG stream is active",
|
|
||||||
observable=True,
|
observable=True,
|
||||||
readonly=True,
|
readonly=True,
|
||||||
)
|
)
|
||||||
|
"""Whether the MJPEG stream is active."""
|
||||||
|
|
||||||
def save_settings(self):
|
def save_settings(self):
|
||||||
"""Override save_settings to ensure that camera properties don't recurse.
|
"""Override save_settings to ensure that camera properties don't recurse.
|
||||||
|
|
@ -282,6 +282,7 @@ class StreamingPiCamera2(BaseCamera):
|
||||||
return cam.sensor_resolution
|
return cam.sensor_resolution
|
||||||
|
|
||||||
tuning = lt.ThingSetting(Optional[dict], None, readonly=True)
|
tuning = lt.ThingSetting(Optional[dict], None, readonly=True)
|
||||||
|
"""The Raspberry PiCamera Tuning File JSON."""
|
||||||
|
|
||||||
def _initialise_picamera(self):
|
def _initialise_picamera(self):
|
||||||
"""Acquire the picamera device and store it as ``self._picamera``.
|
"""Acquire the picamera device and store it as ``self._picamera``.
|
||||||
|
|
|
||||||
|
|
@ -283,11 +283,9 @@ class CameraStageMapper(lt.Thing):
|
||||||
return np.array(displacement_matrix).tolist()
|
return np.array(displacement_matrix).tolist()
|
||||||
|
|
||||||
last_calibration = lt.ThingSetting(
|
last_calibration = lt.ThingSetting(
|
||||||
initial_value=None,
|
initial_value=None, model=Optional[dict], readonly=True
|
||||||
model=Optional[dict],
|
|
||||||
readonly=True,
|
|
||||||
description="The most recent CSM calibration",
|
|
||||||
)
|
)
|
||||||
|
"""The most recent CSM calibration."""
|
||||||
|
|
||||||
@lt.thing_property
|
@lt.thing_property
|
||||||
def image_resolution(self) -> Optional[Tuple[float, float]]:
|
def image_resolution(self) -> Optional[Tuple[float, float]]:
|
||||||
|
|
|
||||||
|
|
@ -46,14 +46,14 @@ class SettingsManager(lt.Thing):
|
||||||
external_metadata = lt.ThingSetting(
|
external_metadata = lt.ThingSetting(
|
||||||
initial_value={},
|
initial_value={},
|
||||||
model=Mapping,
|
model=Mapping,
|
||||||
description="External metadata stored in the server's settings",
|
|
||||||
)
|
)
|
||||||
|
"""External metadata stored in the server's settings."""
|
||||||
|
|
||||||
external_metadata_in_state = lt.ThingSetting(
|
external_metadata_in_state = lt.ThingSetting(
|
||||||
initial_value=[],
|
initial_value=[],
|
||||||
model=Sequence[str],
|
model=Sequence[str],
|
||||||
description='A list of strings that are included in the "state" metadata',
|
|
||||||
)
|
)
|
||||||
|
"""A list of strings that are included in the "state" metadata."""
|
||||||
|
|
||||||
@lt.thing_action
|
@lt.thing_action
|
||||||
def update_external_metadata(
|
def update_external_metadata(
|
||||||
|
|
|
||||||
|
|
@ -587,51 +587,46 @@ class SmartScanThing(lt.Thing):
|
||||||
save_resolution = lt.ThingSetting(
|
save_resolution = lt.ThingSetting(
|
||||||
initial_value=(1640, 1232),
|
initial_value=(1640, 1232),
|
||||||
model=tuple[int, int],
|
model=tuple[int, int],
|
||||||
description=("A tuple of the image resolution to capture."),
|
|
||||||
)
|
)
|
||||||
|
"""A tuple of the image resolution to capture."""
|
||||||
|
|
||||||
max_range = lt.ThingSetting(
|
max_range = lt.ThingSetting(
|
||||||
initial_value=45000,
|
initial_value=45000,
|
||||||
model=int,
|
model=int,
|
||||||
description=(
|
|
||||||
"The maximum distance from the centre of the scan before we break in steps"
|
|
||||||
),
|
|
||||||
)
|
)
|
||||||
|
"""The maximum distance in steps from the centre of the scan."""
|
||||||
|
|
||||||
stitch_tiff = lt.ThingSetting(
|
stitch_tiff = lt.ThingSetting(
|
||||||
initial_value=False,
|
initial_value=False,
|
||||||
model=bool,
|
model=bool,
|
||||||
description="Whether or not to also produce a pyramidal tiff",
|
|
||||||
)
|
)
|
||||||
|
"""Whether or not to also produce a pyramidal tiff at the end of a scan."""
|
||||||
|
|
||||||
skip_background = lt.ThingSetting(
|
skip_background = lt.ThingSetting(
|
||||||
initial_value=True,
|
initial_value=True,
|
||||||
model=bool,
|
model=bool,
|
||||||
description="""Whether to detect and skip empty fields of view
|
|
||||||
|
|
||||||
This uses the settings from the ``BackgroundDetectThing``.""",
|
|
||||||
)
|
)
|
||||||
|
"""Whether to detect and skip empty fields of view.
|
||||||
|
|
||||||
|
This uses the settings from the ``BackgroundDetectThing``."""
|
||||||
|
|
||||||
autofocus_dz = lt.ThingSetting(
|
autofocus_dz = lt.ThingSetting(
|
||||||
initial_value=1000,
|
initial_value=1000,
|
||||||
model=int,
|
model=int,
|
||||||
description="The z distance to perform an autofocus in steps",
|
|
||||||
)
|
)
|
||||||
|
"""The z distance to perform an autofocus in steps."""
|
||||||
|
|
||||||
overlap = lt.ThingSetting(
|
overlap = lt.ThingSetting(
|
||||||
initial_value=0.45,
|
initial_value=0.45,
|
||||||
model=float,
|
model=float,
|
||||||
description="The fraction (0-1) that adjacent images should overlap in x or y",
|
|
||||||
)
|
)
|
||||||
|
"""The fraction (0-1) that adjacent images should overlap in x or y."""
|
||||||
|
|
||||||
stitch_automatically = lt.ThingSetting(
|
stitch_automatically = lt.ThingSetting(
|
||||||
initial_value=True,
|
initial_value=True,
|
||||||
model=bool,
|
model=bool,
|
||||||
description=(
|
|
||||||
"Whether to run a final stitch at the end of the scan (assuming scan "
|
|
||||||
"success)"
|
|
||||||
),
|
|
||||||
)
|
)
|
||||||
|
"""Whether to run a final stitch at the end of a successful scan."""
|
||||||
|
|
||||||
@lt.thing_property
|
@lt.thing_property
|
||||||
def scans(self) -> list[scan_directories.ScanInfo]:
|
def scans(self) -> list[scan_directories.ScanInfo]:
|
||||||
|
|
|
||||||
|
|
@ -23,18 +23,18 @@ class BaseStage(lt.Thing):
|
||||||
position = lt.ThingProperty(
|
position = lt.ThingProperty(
|
||||||
Mapping[str, int],
|
Mapping[str, int],
|
||||||
dict.fromkeys(_axis_names, 0),
|
dict.fromkeys(_axis_names, 0),
|
||||||
description="Current position of the stage",
|
|
||||||
readonly=True,
|
readonly=True,
|
||||||
observable=True,
|
observable=True,
|
||||||
)
|
)
|
||||||
|
"""Current position of the stage."""
|
||||||
|
|
||||||
moving = lt.ThingProperty(
|
moving = lt.ThingProperty(
|
||||||
bool,
|
bool,
|
||||||
False,
|
False,
|
||||||
description="Whether the stage is in motion",
|
|
||||||
readonly=True,
|
readonly=True,
|
||||||
observable=True,
|
observable=True,
|
||||||
)
|
)
|
||||||
|
"""Whether the stage is in motion."""
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def thing_state(self):
|
def thing_state(self):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue