Loading openflexure_microscope/api/v2/blueprints/actions/__init__.py +5 −0 Original line number Diff line number Diff line Loading @@ -37,6 +37,11 @@ _actions = { "view_class": stage.MoveStageAPI, "conditions": True, }, "zeroStage": { "rule": "/stage/zero/", "view_class": stage.ZeroStageAPI, "conditions": True, }, "shutdown": { "rule": "/system/shutdown/", "view_class": system.ShutdownAPI, Loading openflexure_microscope/api/v2/blueprints/actions/stage.py +19 −0 Original line number Diff line number Diff line Loading @@ -56,3 +56,22 @@ class MoveStageAPI(MicroscopeView): logging.warning("Unable to move. No stage found.") return jsonify(self.microscope.status["stage"]["position"]) class ZeroStageAPI(MicroscopeView): """ Zero stage coordinates """ def post(self): """ Set the current position to zero .. :quickref: Actions; Zero stage :reqheader Accept: application/json """ self.microscope.stage.zero_position() return jsonify(self.microscope.status["stage"]) openflexure_microscope/stage/base.py +5 −0 Original line number Diff line number Diff line Loading @@ -74,6 +74,11 @@ class BaseStage(metaclass=ABCMeta): """Make an absolute move to a position""" pass @abstractmethod def zero_position(self): """Set the current position to zero""" pass @abstractmethod def close(self): """Cleanly close communication with the stage""" Loading openflexure_microscope/stage/mock.py +4 −0 Original line number Diff line number Diff line Loading @@ -96,5 +96,9 @@ class MockStage(BaseStage): self._position = list(final) logging.debug(f"New position: {self._position}") def zero_position(self): """Set the current position to zero""" self._position = [0, 0, 0] def close(self): pass openflexure_microscope/stage/sanga.py +5 −0 Original line number Diff line number Diff line Loading @@ -147,6 +147,11 @@ class SangaStage(BaseStage): with self.lock: self.board.move_abs(final, **kwargs) def zero_position(self): """Set the current position to zero""" with self.lock: self.board.zero_position() def close(self): """Cleanly close communication with the stage""" if hasattr(self, "board"): Loading Loading
openflexure_microscope/api/v2/blueprints/actions/__init__.py +5 −0 Original line number Diff line number Diff line Loading @@ -37,6 +37,11 @@ _actions = { "view_class": stage.MoveStageAPI, "conditions": True, }, "zeroStage": { "rule": "/stage/zero/", "view_class": stage.ZeroStageAPI, "conditions": True, }, "shutdown": { "rule": "/system/shutdown/", "view_class": system.ShutdownAPI, Loading
openflexure_microscope/api/v2/blueprints/actions/stage.py +19 −0 Original line number Diff line number Diff line Loading @@ -56,3 +56,22 @@ class MoveStageAPI(MicroscopeView): logging.warning("Unable to move. No stage found.") return jsonify(self.microscope.status["stage"]["position"]) class ZeroStageAPI(MicroscopeView): """ Zero stage coordinates """ def post(self): """ Set the current position to zero .. :quickref: Actions; Zero stage :reqheader Accept: application/json """ self.microscope.stage.zero_position() return jsonify(self.microscope.status["stage"])
openflexure_microscope/stage/base.py +5 −0 Original line number Diff line number Diff line Loading @@ -74,6 +74,11 @@ class BaseStage(metaclass=ABCMeta): """Make an absolute move to a position""" pass @abstractmethod def zero_position(self): """Set the current position to zero""" pass @abstractmethod def close(self): """Cleanly close communication with the stage""" Loading
openflexure_microscope/stage/mock.py +4 −0 Original line number Diff line number Diff line Loading @@ -96,5 +96,9 @@ class MockStage(BaseStage): self._position = list(final) logging.debug(f"New position: {self._position}") def zero_position(self): """Set the current position to zero""" self._position = [0, 0, 0] def close(self): pass
openflexure_microscope/stage/sanga.py +5 −0 Original line number Diff line number Diff line Loading @@ -147,6 +147,11 @@ class SangaStage(BaseStage): with self.lock: self.board.move_abs(final, **kwargs) def zero_position(self): """Set the current position to zero""" with self.lock: self.board.zero_position() def close(self): """Cleanly close communication with the stage""" if hasattr(self, "board"): Loading