From 06f12973f4f0791812c986c7d299209f6aaed7c4 Mon Sep 17 00:00:00 2001 From: Joe Knapper Date: Mon, 2 Mar 2026 19:40:44 +0000 Subject: [PATCH] Add limits to background detect and settling time settings --- .../things/background_detect.py | 8 ++++---- .../things/camera/__init__.py | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/openflexure_microscope_server/things/background_detect.py b/src/openflexure_microscope_server/things/background_detect.py index 19ab6874..8039605f 100644 --- a/src/openflexure_microscope_server/things/background_detect.py +++ b/src/openflexure_microscope_server/things/background_detect.py @@ -99,14 +99,14 @@ class ColourChannelDetectLUV(BackgroundDetectAlgorithm): # provided there. min_stds = [0.5, 0.3, 0.5] - channel_tolerance: float = lt.setting(default=7.0) + channel_tolerance: float = lt.setting(default=7.0, ge=0) """Channel Tolerance The number of standard deviations a pixel value must be from the background mean to be considered sample. """ - min_sample_coverage: float = lt.setting(default=25) + min_sample_coverage: float = lt.setting(default=25, ge=0, le=100) """Sample Coverage Required (%) The minimum percentage of the image that needs to be identified as sample for the @@ -223,14 +223,14 @@ class ChannelDeviationLUV(BackgroundDetectAlgorithm): # LUV colour space not converting to the CIELUV numbers) min_stds = [0.5, 0.3, 0.5] - channel_tolerance: float = lt.setting(default=7.0) + channel_tolerance: float = lt.setting(default=7.0, ge=0) """Channel Tolerance The number of standard deviations a pixel value must be from the background mean to be considered sample. """ - min_sample_coverage: float = lt.setting(default=25) + min_sample_coverage: float = lt.setting(default=25, ge=0, le=100) """Sample Coverage Required (%) The minimum percentage of the image that needs to be identified as sample for the diff --git a/src/openflexure_microscope_server/things/camera/__init__.py b/src/openflexure_microscope_server/things/camera/__init__.py index dd4f6cdd..14088f21 100644 --- a/src/openflexure_microscope_server/things/camera/__init__.py +++ b/src/openflexure_microscope_server/things/camera/__init__.py @@ -565,7 +565,7 @@ class BaseCamera(lt.Thing): except Exception as e: raise IOError(f"An error occurred while saving {jpeg_path}") from e - settling_time: float = lt.setting(default=0.2) + settling_time: float = lt.setting(default=0.2, ge=0) """The settling time when calling the ``settle()`` method.""" @lt.action