From 0facd3786093a8800e7c3d865cb90e5fbb645bf7 Mon Sep 17 00:00:00 2001 From: x12sa Date: Thu, 9 Jul 2026 12:33:29 +0200 Subject: [PATCH] better timing printout end of tomogram --- .../plugins/flomni/flomni.py | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/csaxs_bec/bec_ipython_client/plugins/flomni/flomni.py b/csaxs_bec/bec_ipython_client/plugins/flomni/flomni.py index 13eff32..f211c9b 100644 --- a/csaxs_bec/bec_ipython_client/plugins/flomni/flomni.py +++ b/csaxs_bec/bec_ipython_client/plugins/flomni/flomni.py @@ -2680,9 +2680,22 @@ class Flomni( self._print_progress() self._log_tomogram_timing() self.OMNYTools.printgreenbold("Tomoscan finished") - print( - f"Total measurement time lost to detected gaps: {self._format_duration(self.progress.get('accumulated_idle_time', 0.0))}" - ) + idle_s = self.progress.get("accumulated_idle_time", 0.0) + start_str = self.progress.get("tomo_start_time") + elapsed_s = None + if start_str is not None: + try: + elapsed_s = ( + datetime.datetime.now() - datetime.datetime.fromisoformat(start_str) + ).total_seconds() + except (ValueError, TypeError): + elapsed_s = None + if elapsed_s is not None: + print(f"Total measurement time: {self._format_duration(elapsed_s)}") + print( + f"Total measurement time excluding detected gaps: {self._format_duration(elapsed_s - idle_s)}" + ) + print(f"Total measurement time lost to detected gaps: {self._format_duration(idle_s)}") def tomo_scan_resume(self) -> None: """Resume a tomo_scan() that crashed or was interrupted, picking up