Loading openflexure_microscope/api/default_extensions/autofocus.py +6 −4 Original line number Diff line number Diff line Loading @@ -376,7 +376,9 @@ class FastAutofocusAPI(ActionView): if microscope.has_real_stage(): logging.debug("Running autofocus...") # return a handle on the autofocus task # Acquire microscope lock with 1s timeout with microscope.lock(timeout=1): # Run fast_up_down_up_autofocus return fast_up_down_up_autofocus( microscope, dz=dz, mini_backlash=backlash ) Loading openflexure_microscope/api/default_extensions/scan.py +18 −17 Original line number Diff line number Diff line Loading @@ -325,7 +325,9 @@ class TileScanAPI(ActionView): logging.info("Running tile scan...") # return a handle on the scan task # Acquire microscope lock with 1s timeout with microscope.lock(timeout=1): # Run scan_extension_v2 return scan_extension_v2.tile( microscope, basename=args.get("filename"), Loading @@ -342,5 +344,4 @@ class TileScanAPI(ActionView): tags=args.get("tags"), ) scan_extension_v2.add_view(TileScanAPI, "/tile", endpoint="tile") openflexure_microscope/api/v2/views/actions/stage.py +5 −3 Original line number Diff line number Diff line Loading @@ -45,8 +45,8 @@ class MoveStageAPI(ActionView): # Move if stage exists if microscope.stage: # Explicitally acquire lock with microscope.stage.lock: # Explicitally acquire lock with 1s timeout with microscope.stage.lock(timeout=1): microscope.stage.move_rel(position) else: logging.warning("Unable to move. No stage found.") Loading @@ -62,6 +62,8 @@ class ZeroStageAPI(ActionView): Does not move the stage, but rather makes the current position read as [0, 0, 0] """ microscope = find_component("org.openflexure.microscope") with microscope.stage.lock(timeout=1): microscope.stage.zero_position() # TODO: Make schema for microscope state Loading openflexure_microscope/camera/base.py +1 −1 Original line number Diff line number Diff line Loading @@ -23,7 +23,7 @@ class BaseCamera(metaclass=ABCMeta): self.thread = None self.camera = None self.lock = StrictLock(name="Camera", timeout=1) self.lock = StrictLock(name="Camera", timeout=None) self.frame = None self.last_access = 0 Loading openflexure_microscope/microscope.py +4 −4 Original line number Diff line number Diff line Loading @@ -153,7 +153,7 @@ class Microscope: Return: dict: Dictionary containing complete microscope state """ with self.lock(timeout=None): with self.lock: state = {"camera": self.camera.state, "stage": self.stage.state} return state Loading @@ -161,7 +161,7 @@ class Microscope: """ Applies a settings dictionary to the microscope. Missing parameters will be left untouched. """ with self.lock(timeout=None): with self.lock: logging.debug("Microscope: Applying settings: {}".format(settings)) # If attached to a camera Loading Loading @@ -206,7 +206,7 @@ class Microscope: "extensions": self.extension_settings, } with self.lock(timeout=None): with self.lock: # If attached to a camera if self.camera: settings_current_camera = self.camera.read_settings() Loading Loading @@ -254,7 +254,7 @@ class Microscope: @property def configuration(self): with self.lock(timeout=None): with self.lock: initial_configuration = self.configuration_file.load() current_configuration = { Loading Loading
openflexure_microscope/api/default_extensions/autofocus.py +6 −4 Original line number Diff line number Diff line Loading @@ -376,7 +376,9 @@ class FastAutofocusAPI(ActionView): if microscope.has_real_stage(): logging.debug("Running autofocus...") # return a handle on the autofocus task # Acquire microscope lock with 1s timeout with microscope.lock(timeout=1): # Run fast_up_down_up_autofocus return fast_up_down_up_autofocus( microscope, dz=dz, mini_backlash=backlash ) Loading
openflexure_microscope/api/default_extensions/scan.py +18 −17 Original line number Diff line number Diff line Loading @@ -325,7 +325,9 @@ class TileScanAPI(ActionView): logging.info("Running tile scan...") # return a handle on the scan task # Acquire microscope lock with 1s timeout with microscope.lock(timeout=1): # Run scan_extension_v2 return scan_extension_v2.tile( microscope, basename=args.get("filename"), Loading @@ -342,5 +344,4 @@ class TileScanAPI(ActionView): tags=args.get("tags"), ) scan_extension_v2.add_view(TileScanAPI, "/tile", endpoint="tile")
openflexure_microscope/api/v2/views/actions/stage.py +5 −3 Original line number Diff line number Diff line Loading @@ -45,8 +45,8 @@ class MoveStageAPI(ActionView): # Move if stage exists if microscope.stage: # Explicitally acquire lock with microscope.stage.lock: # Explicitally acquire lock with 1s timeout with microscope.stage.lock(timeout=1): microscope.stage.move_rel(position) else: logging.warning("Unable to move. No stage found.") Loading @@ -62,6 +62,8 @@ class ZeroStageAPI(ActionView): Does not move the stage, but rather makes the current position read as [0, 0, 0] """ microscope = find_component("org.openflexure.microscope") with microscope.stage.lock(timeout=1): microscope.stage.zero_position() # TODO: Make schema for microscope state Loading
openflexure_microscope/camera/base.py +1 −1 Original line number Diff line number Diff line Loading @@ -23,7 +23,7 @@ class BaseCamera(metaclass=ABCMeta): self.thread = None self.camera = None self.lock = StrictLock(name="Camera", timeout=1) self.lock = StrictLock(name="Camera", timeout=None) self.frame = None self.last_access = 0 Loading
openflexure_microscope/microscope.py +4 −4 Original line number Diff line number Diff line Loading @@ -153,7 +153,7 @@ class Microscope: Return: dict: Dictionary containing complete microscope state """ with self.lock(timeout=None): with self.lock: state = {"camera": self.camera.state, "stage": self.stage.state} return state Loading @@ -161,7 +161,7 @@ class Microscope: """ Applies a settings dictionary to the microscope. Missing parameters will be left untouched. """ with self.lock(timeout=None): with self.lock: logging.debug("Microscope: Applying settings: {}".format(settings)) # If attached to a camera Loading Loading @@ -206,7 +206,7 @@ class Microscope: "extensions": self.extension_settings, } with self.lock(timeout=None): with self.lock: # If attached to a camera if self.camera: settings_current_camera = self.camera.read_settings() Loading Loading @@ -254,7 +254,7 @@ class Microscope: @property def configuration(self): with self.lock(timeout=None): with self.lock: initial_configuration = self.configuration_file.load() current_configuration = { Loading