Included Richards autofocus plugin in defaults
This commit is contained in:
parent
cc36aa7593
commit
d7e19c40e2
3 changed files with 84 additions and 6 deletions
|
|
@ -1,6 +1,9 @@
|
|||
from openflexure_microscope.api.v1.views import MicroscopeViewPlugin
|
||||
import numpy as np
|
||||
|
||||
from flask import request, Response, escape
|
||||
from openflexure_microscope.api.v1.views import MicroscopeViewPlugin
|
||||
from openflexure_microscope.api.utilities import JsonPayload
|
||||
|
||||
from flask import request, Response, escape, jsonify
|
||||
|
||||
import logging
|
||||
|
||||
|
|
@ -16,4 +19,22 @@ class IdentifyAPI(MicroscopeViewPlugin):
|
|||
.. :quickref: Default plugin; Identify hardware
|
||||
"""
|
||||
data = self.microscope.plugin.default.identify() # Call a method from our plugin, using the full route
|
||||
return Response(escape(data))
|
||||
return Response(escape(data))
|
||||
|
||||
class MeasureSharpnessAPI(MicroscopeViewPlugin):
|
||||
def post(self):
|
||||
payload = JsonPayload(request)
|
||||
return jsonify({'sharpness': self.plugin.measure_sharpness()})
|
||||
|
||||
class AutofocusAPI(MicroscopeViewPlugin):
|
||||
def post(self):
|
||||
payload = JsonPayload(request)
|
||||
|
||||
# Figure out the range of z values to use
|
||||
dz = payload.param("dz", default=np.linspace(-300,300,7), convert=np.array)
|
||||
|
||||
print("Running autofocus...")
|
||||
task = self.microscope.task.start(self.plugin.autofocus, dz)
|
||||
|
||||
# return a handle on the autofocus task
|
||||
return jsonify(task.state, 202)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue