Fixed #103
This commit is contained in:
parent
e2e1783ab9
commit
e76dee2383
1 changed files with 16 additions and 8 deletions
|
|
@ -7,6 +7,7 @@ from openflexure_microscope.devel import (
|
||||||
request,
|
request,
|
||||||
jsonify,
|
jsonify,
|
||||||
taskify,
|
taskify,
|
||||||
|
abort,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -23,12 +24,15 @@ class AutofocusAPI(MicroscopeViewPlugin):
|
||||||
# Figure out the range of z values to use
|
# Figure out the range of z values to use
|
||||||
dz = payload.param("dz", default=np.linspace(-300, 300, 7), convert=np.array)
|
dz = payload.param("dz", default=np.linspace(-300, 300, 7), convert=np.array)
|
||||||
|
|
||||||
logging.info("Running autofocus...")
|
if self.microscope.has_real_stage():
|
||||||
task = taskify(self.plugin.autofocus)(dz)
|
logging.info("Running autofocus...")
|
||||||
|
task = taskify(self.plugin.autofocus)(dz)
|
||||||
|
|
||||||
# return a handle on the autofocus task
|
# return a handle on the autofocus task
|
||||||
return jsonify(task.state), 202
|
return jsonify(task.state), 202
|
||||||
|
|
||||||
|
else:
|
||||||
|
abort(503, 'No stage connected. Unable to autofocus.')
|
||||||
|
|
||||||
class FastAutofocusAPI(MicroscopeViewPlugin):
|
class FastAutofocusAPI(MicroscopeViewPlugin):
|
||||||
def post(self):
|
def post(self):
|
||||||
|
|
@ -40,8 +44,12 @@ class FastAutofocusAPI(MicroscopeViewPlugin):
|
||||||
if backlash < 0:
|
if backlash < 0:
|
||||||
backlash = 0
|
backlash = 0
|
||||||
|
|
||||||
logging.info("Running autofocus...")
|
if self.microscope.has_real_stage():
|
||||||
task = taskify(self.plugin.fast_autofocus)(dz, backlash=backlash)
|
logging.info("Running autofocus...")
|
||||||
|
task = taskify(self.plugin.fast_autofocus)(dz, backlash=backlash)
|
||||||
|
|
||||||
# return a handle on the autofocus task
|
# return a handle on the autofocus task
|
||||||
return jsonify(task.state), 202
|
return jsonify(task.state), 202
|
||||||
|
|
||||||
|
else:
|
||||||
|
abort(503, 'No stage connected. Unable to autofocus.')
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue