Implemented root API v2 routes

This commit is contained in:
jtc42 2019-11-14 16:33:00 +00:00
parent 5aa783c269
commit 6581612312
27 changed files with 1205 additions and 148 deletions

View file

@ -37,10 +37,10 @@ class Plugin(MicroscopePlugin):
"""
scamera = self.microscope.camera
with scamera.lock:
assert not scamera.state[
assert not scamera.status[
"record_active"
], "Can't recalibrate while recording!"
streaming = scamera.state["stream_active"]
streaming = scamera.status["stream_active"]
if streaming:
logging.info("Stopping stream before recalibration")
scamera.stop_stream_recording(resolution=(640, 480))
@ -51,7 +51,7 @@ class Plugin(MicroscopePlugin):
recalibrate_camera(scamera.camera)
finally:
scamera.camera.resolution = old_resolution
self.microscope.save_config()
self.microscope.save_settings()
if streaming:
logging.info("Restarting stream after recalibration")
scamera.start_stream_recording()

View file

@ -97,18 +97,19 @@ class ScanPlugin(MicroscopePlugin):
if "scan" not in tags:
tags.append("scan")
metadata.update(
{
"scan_id": scan_id,
"basename": basename,
"microscope_settings": self.microscope.read_config(),
"microscope_state": self.microscope.state,
"microscope_id": self.microscope.id,
"microscope_name": self.microscope.name,
}
)
# Inject system metadata
system_metadata = {
"microscope_settings": self.microscope.read_settings(),
"microscope_state": self.microscope.state,
"microscope_id": self.microscope.id,
"microscope_name": self.microscope.name,
}
output.system_metadata.update(system_metadata)
# Insert custom metadata
output.put_metadata(metadata)
# Insert custom tags
output.put_tags(tags)
def tile(