Loading openflexure_microscope/stage/openflexure.py +8 −9 Original line number Diff line number Diff line from openflexure_stage import OpenFlexureStage from serial import SerialException from openflexure_microscope.lock import StrictLock Loading @@ -15,15 +14,15 @@ class Stage(OpenFlexureStage): """ self.lock = StrictLock(timeout=2) #: :py:class:`openflexure_microscope.lock.StrictLock`: Strict lock controlling thread access to camera hardware try: OpenFlexureStage.__init__(self, *args, **kwargs) except SerialException: logging.error("No stage found. Aborting stage.") logging.warning("Stage lock can be acquired, but any stage methods will fail and raise exceptions.") def _move_rel_nobacklash(self, *args, **kwargs): """ Overrides :py:function:`openflexure_stage.stage.OpenFlexureStage._move_rel_nobacklash` to acquire lock first. """ if self._ser: with self.lock: OpenFlexureStage._move_rel_nobacklash(self, *args, **kwargs) else: logging.warning("Unable to move stage. Serial communication unavailable.") Loading
openflexure_microscope/stage/openflexure.py +8 −9 Original line number Diff line number Diff line from openflexure_stage import OpenFlexureStage from serial import SerialException from openflexure_microscope.lock import StrictLock Loading @@ -15,15 +14,15 @@ class Stage(OpenFlexureStage): """ self.lock = StrictLock(timeout=2) #: :py:class:`openflexure_microscope.lock.StrictLock`: Strict lock controlling thread access to camera hardware try: OpenFlexureStage.__init__(self, *args, **kwargs) except SerialException: logging.error("No stage found. Aborting stage.") logging.warning("Stage lock can be acquired, but any stage methods will fail and raise exceptions.") def _move_rel_nobacklash(self, *args, **kwargs): """ Overrides :py:function:`openflexure_stage.stage.OpenFlexureStage._move_rel_nobacklash` to acquire lock first. """ if self._ser: with self.lock: OpenFlexureStage._move_rel_nobacklash(self, *args, **kwargs) else: logging.warning("Unable to move stage. Serial communication unavailable.")