From d97692e090edd7f0934aebf995b0e447d22dabf0 Mon Sep 17 00:00:00 2001 From: x01dc Date: Mon, 27 Jul 2026 17:02:05 +0200 Subject: [PATCH] fix(flomni): always attempt tomo_id registration, accept interactive kwarg Mirrors LamNI.tomo_scan()'s same fix: remove the outer "bec.active_account != ''" short-circuit so an empty/test account still goes through add_sample_database() -> TomoIDManager.register() (which now handles test-host registration itself) instead of hard-coding tomo_id=0. Also accept an unused interactive kwarg for signature compatibility with LamNI.tomo_scan(), since tomo_queue_execute() (shared between both setups) calls tomo_scan(interactive=False) uniformly. --- .../plugins/flomni/flomni.py | 37 ++++++++++++------- 1 file changed, 23 insertions(+), 14 deletions(-) diff --git a/csaxs_bec/bec_ipython_client/plugins/flomni/flomni.py b/csaxs_bec/bec_ipython_client/plugins/flomni/flomni.py index f416cca..9d8c46f 100644 --- a/csaxs_bec/bec_ipython_client/plugins/flomni/flomni.py +++ b/csaxs_bec/bec_ipython_client/plugins/flomni/flomni.py @@ -2489,8 +2489,16 @@ class Flomni( for scan_nr in range(start_scan_number, end_scan_number): self._write_tomo_scan_number(scan_nr, angle, subtomo_number=0) - def tomo_scan(self, subtomo_start=1, start_angle=None, projection_number=None): - """start a tomo scan""" + def tomo_scan( + self, subtomo_start=1, start_angle=None, projection_number=None, interactive: bool = True + ): + """start a tomo scan + + Args: + interactive: accepted for signature compatibility with + LamNI.tomo_scan() (tomo_queue_execute() calls both the same + way) -- unused here, FlOMNI has no fine-alignment gate. + """ if not self._check_eye_out_and_optics_in(): print( @@ -2519,18 +2527,19 @@ class Flomni( ): # pylint: disable=undefined-variable - if bec.active_account != "": - self.tomo_id = self.add_sample_database( - self.sample_name, - str(datetime.date.today()), - bec.active_account, - bec.queue.next_scan_number, - "flomni", - "test additional info", - "BEC", - ) - else: - self.tomo_id = 0 + # Always attempt registration (even for an empty/test account) + # and let add_sample_database() -> TomoIDManager.register() + # decide production vs. test-server vs. genuine-failure fallback + # -- see LamNI.tomo_scan()'s equivalent change for why. + self.tomo_id = self.add_sample_database( + self.sample_name, + str(datetime.date.today()), + bec.active_account or "", + bec.queue.next_scan_number, + "flomni", + "test additional info", + "BEC", + ) self.write_pdf_report() self.progress["tomo_start_time"] = datetime.datetime.now().isoformat() # reset stale estimates from any previous scan, otherwise the GUI