Restructured fast autofocus into main autofocus plugin

This commit is contained in:
Joel Collins 2019-04-08 15:09:36 +03:00
parent edc5e7c241
commit 24ded8de32
4 changed files with 157 additions and 4 deletions

View file

@ -24,3 +24,19 @@ class AutofocusAPI(MicroscopeViewPlugin):
# return a handle on the autofocus task
return jsonify(task.state), 202
class FastAutofocusAPI(MicroscopeViewPlugin):
def post(self):
payload = JsonPayload(request)
# Figure out the parameters to use
dz = payload.param("dz", default=2000, convert=int)
backlash = payload.param("backlash", default=None, convert=int)
if backlash < 0:
backlash = None
print("Running autofocus...")
task = self.microscope.task.start(self.plugin.fast_autofocus, dz, backlash=backlash)
# return a handle on the autofocus task
return jsonify(task.state), 202