Loading openflexure_microscope/plugins/default/autofocus/api.py +16 −8 Original line number Diff line number Diff line Loading @@ -7,6 +7,7 @@ from openflexure_microscope.devel import ( request, jsonify, taskify, abort, ) Loading @@ -23,12 +24,15 @@ class AutofocusAPI(MicroscopeViewPlugin): # Figure out the range of z values to use dz = payload.param("dz", default=np.linspace(-300, 300, 7), convert=np.array) if self.microscope.has_real_stage(): logging.info("Running autofocus...") task = taskify(self.plugin.autofocus)(dz) # return a handle on the autofocus task return jsonify(task.state), 202 else: abort(503, 'No stage connected. Unable to autofocus.') class FastAutofocusAPI(MicroscopeViewPlugin): def post(self): Loading @@ -40,8 +44,12 @@ class FastAutofocusAPI(MicroscopeViewPlugin): if backlash < 0: backlash = 0 if self.microscope.has_real_stage(): logging.info("Running autofocus...") task = taskify(self.plugin.fast_autofocus)(dz, backlash=backlash) # return a handle on the autofocus task return jsonify(task.state), 202 else: abort(503, 'No stage connected. Unable to autofocus.') Loading
openflexure_microscope/plugins/default/autofocus/api.py +16 −8 Original line number Diff line number Diff line Loading @@ -7,6 +7,7 @@ from openflexure_microscope.devel import ( request, jsonify, taskify, abort, ) Loading @@ -23,12 +24,15 @@ class AutofocusAPI(MicroscopeViewPlugin): # Figure out the range of z values to use dz = payload.param("dz", default=np.linspace(-300, 300, 7), convert=np.array) if self.microscope.has_real_stage(): logging.info("Running autofocus...") task = taskify(self.plugin.autofocus)(dz) # return a handle on the autofocus task return jsonify(task.state), 202 else: abort(503, 'No stage connected. Unable to autofocus.') class FastAutofocusAPI(MicroscopeViewPlugin): def post(self): Loading @@ -40,8 +44,12 @@ class FastAutofocusAPI(MicroscopeViewPlugin): if backlash < 0: backlash = 0 if self.microscope.has_real_stage(): logging.info("Running autofocus...") task = taskify(self.plugin.fast_autofocus)(dz, backlash=backlash) # return a handle on the autofocus task return jsonify(task.state), 202 else: abort(503, 'No stage connected. Unable to autofocus.')