From c2d8160ff4494fc44a076acb06ffb8f24b6a8d11 Mon Sep 17 00:00:00 2001 From: jaknapper Date: Tue, 21 Oct 2025 19:00:15 +0100 Subject: [PATCH] Smart Scan metadata containing scan name if scan is running --- .../things/smart_scan.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/openflexure_microscope_server/things/smart_scan.py b/src/openflexure_microscope_server/things/smart_scan.py index a6ab415c..71376362 100644 --- a/src/openflexure_microscope_server/things/smart_scan.py +++ b/src/openflexure_microscope_server/things/smart_scan.py @@ -7,7 +7,16 @@ It also controls external processes for live stitching composite images, and the creation of the final stitched images. """ -from typing import Optional, Self, TypeVar, ParamSpec, Callable, Concatenate +from typing import ( + Optional, + Self, + TypeVar, + ParamSpec, + Callable, + Concatenate, + Mapping, + Any, +) import threading import os import time @@ -481,6 +490,13 @@ class SmartScanThing(lt.Thing): **self._scan_data.starting_position, block_cancellation=True ) + @property + def thing_state(self) -> Mapping[str, Any]: + """Return a metadata dict for ongoing scan to populate.""" + if self._ongoing_scan is None: + return {} + return {"scan_name": self._ongoing_scan.name} + @_scan_running def _perform_final_stitch(self) -> None: """Update the scan zip and perform final stitch of the data."""