From 7f42b3b70675d2d6e4390919b0c2cf13d1926710 Mon Sep 17 00:00:00 2001 From: Joel Collins Date: Tue, 15 Jan 2019 11:48:04 +0000 Subject: [PATCH] Microscope now has option to add a name --- openflexure_microscope/microscope.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/openflexure_microscope/microscope.py b/openflexure_microscope/microscope.py index 80fc4436..c819beb4 100644 --- a/openflexure_microscope/microscope.py +++ b/openflexure_microscope/microscope.py @@ -5,6 +5,7 @@ Defines a microscope object, binding a camera and stage with basic functionality import logging import os import numpy as np +import uuid from openflexure_stage import OpenFlexureStage from .camera.pi import StreamingCamera @@ -39,6 +40,10 @@ class Microscope(object): # Attach plugins if attach_plugins: self.attach_plugins() + + # Get name from config, or generate + if not 'name' in self.config: + self.config['name'] = uuid.uuid4().hex def __enter__(self): """Create microscope on context enter."""