Went on a PEP-8 rampage
This commit is contained in:
parent
f99ad30fb6
commit
0948c9308a
36 changed files with 186 additions and 218 deletions
|
|
@ -1,28 +1,26 @@
|
|||
import time
|
||||
import numpy as np
|
||||
|
||||
from openflexure_microscope.plugins import MicroscopePlugin
|
||||
from openflexure_microscope.utilities import set_properties
|
||||
from openflexure_microscope.api.v1.views import MicroscopeViewPlugin
|
||||
from openflexure_microscope.api.utilities import JsonPayload
|
||||
|
||||
from flask import request, Response, escape, jsonify
|
||||
from flask import request, jsonify
|
||||
import logging
|
||||
|
||||
from .recalibrate_utils import recalibrate_camera
|
||||
|
||||
|
||||
class RecalibrateAPIView(MicroscopeViewPlugin):
|
||||
def post(self):
|
||||
payload = JsonPayload(request)
|
||||
|
||||
# Figure out the range of z values to use
|
||||
# TODO: Figure out the range of z values to use
|
||||
|
||||
print("Starting microscope recalibration...")
|
||||
task = self.microscope.task.start(self.plugin.recalibrate)
|
||||
|
||||
# return a handle on the autofocus task
|
||||
# Return a handle on the autofocus task
|
||||
return jsonify(task.state, 202)
|
||||
|
||||
|
||||
class Plugin(MicroscopePlugin):
|
||||
"""
|
||||
A set of default plugins
|
||||
|
|
@ -45,16 +43,14 @@ class Plugin(MicroscopePlugin):
|
|||
streaming = scamera.state['stream_active']
|
||||
if streaming:
|
||||
logging.info("Stopping stream before recalibration")
|
||||
scamera.stop_stream_recording(resolution=(640,480))
|
||||
scamera.stop_stream_recording(resolution=(640, 480))
|
||||
old_resolution = scamera.camera.resolution
|
||||
try:
|
||||
scamera.camera.resolution=(640,480)
|
||||
scamera.camera.resolution = (640, 480)
|
||||
recalibrate_camera(scamera.camera)
|
||||
finally:
|
||||
scamera.camera.resolution=old_resolution
|
||||
scamera.camera.resolution = old_resolution
|
||||
self.microscope.save_config()
|
||||
if streaming:
|
||||
logging.info("Restarting stream after recalibration")
|
||||
scamera.start_stream_recording()
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue