From 78d0345239b802cf2e4901a31af663f7239b6e77 Mon Sep 17 00:00:00 2001 From: Joel Collins Date: Wed, 1 Jul 2020 15:58:18 +0100 Subject: [PATCH] Spawn metadata IO in greenlets --- openflexure_microscope/microscope.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/openflexure_microscope/microscope.py b/openflexure_microscope/microscope.py index 9d090ee0..3df77eb1 100644 --- a/openflexure_microscope/microscope.py +++ b/openflexure_microscope/microscope.py @@ -360,6 +360,10 @@ class Microscope: if not tags: tags = [] + # Read metadata for capture + full_metadata = {"instrument": self.get_metadata(cache_key), **metadata} + + # Do capture with self.camera.lock: # Create output object output = self.captures.new_image( @@ -376,14 +380,7 @@ class Microscope: fmt=fmt, ) - # Gether metadata from hardware in a greenlet - logging.debug(f"Waiting for {output.file}") - # Wait for the file to be written to disk - output.file_ready.wait() - full_metadata = {"instrument": self.get_metadata(cache_key), **metadata} output.put_and_save(tags, annotations, full_metadata) - logging.debug(f"Finished adding EXIF data to {output.file}") - logging.debug(f"Finished capture to {output.file}") return output