From 21168d50869c15f00b2ed756c73db352d59c0196 Mon Sep 17 00:00:00 2001 From: Mirko Holler Date: Fri, 25 Sep 2026 14:12:33 +0200 Subject: [PATCH 1/5] fix(lamni): scan defaults, sim feedback interlock, fttrz draft - lamni/omny fermat scan: default exp_time 0.1, drop unused readout_time (devices already fall back to their own configured readout time) - sim_lamni: refuse the sd scan start and abort a running scan while the interferometer feedback loop is off; add tests - simulated_lamni.yaml: lsamrot sim_velocity 48 (4x hw) - lamni_optics_mixin / ptycho_lamni.yaml: commented-out draft for moving the fttrz flight tube in leye_out/leye_in, pending commissioned positions Co-Authored-By: Claude Sonnet 5 Claude-Session: https://claude.ai/code/session_016gUjUT2xCNpnBQkThn3CqP --- .../plugins/LamNI/lamni_optics_mixin.py | 33 ++++++++++ csaxs_bec/device_configs/ptycho_lamni.yaml | 4 ++ .../simulated_omny/simulated_lamni.yaml | 2 +- csaxs_bec/devices/sim/sim_lamni.py | 15 ++++- csaxs_bec/scans/lamni_fermat_scan.py | 11 +--- csaxs_bec/scans/omny_fermat_scan.py | 11 +--- .../tests_devices/test_sim_lamni_feedback.py | 61 +++++++++++++++++++ 7 files changed, 119 insertions(+), 18 deletions(-) create mode 100644 tests/tests_devices/test_sim_lamni_feedback.py diff --git a/csaxs_bec/bec_ipython_client/plugins/LamNI/lamni_optics_mixin.py b/csaxs_bec/bec_ipython_client/plugins/LamNI/lamni_optics_mixin.py index c04a4d24..c5f4095c 100644 --- a/csaxs_bec/bec_ipython_client/plugins/LamNI/lamni_optics_mixin.py +++ b/csaxs_bec/bec_ipython_client/plugins/LamNI/lamni_optics_mixin.py @@ -223,10 +223,43 @@ class LamNIOpticsMixin: umv(dev.lsamrot, 0) #umv(dev.dttrz, 5854, dev.fttrz, 2395) + # DRAFT, disabled until the fttrz positions are known: move the flight tube + # in after the eye is out, like flomni's feye_out(). Needs the userParameters + # fttrz_in / fttrz_out on leyex (see ptycho_lamni.yaml). + # if "fttrz" not in dev: + # if not self.OMNYTools.yesno( + # "Device 'fttrz' does not exist in the current config, so it " + # "can't be moved into position. Continue anyway? WARNING: " + # "this could cause collisions when operating on the real " + # "beamline." + # ): + # print("Aborting leye_out(): fttrz not moved.") + # return + # else: + # fttrz_in = self._get_user_param_safe("leyex", "fttrz_in") + # umv(dev.fttrz, fttrz_in) + def leye_in(self): bec.queue.next_dataset_number += 1 umv(dev.lsamrot, 0) #umv(dev.dttrz, 6419.677, dev.fttrz, 2959.979) + + # DRAFT, disabled until the fttrz positions are known: move the flight tube + # out before the eye goes in, like flomni's feye_in(). When enabled, this + # replaces the manual "Did the flight tube move out?" prompt below. + # if "fttrz" not in dev: + # if not self.OMNYTools.yesno( + # "Device 'fttrz' does not exist in the current config, so it " + # "can't be moved out of the way. Continue anyway? WARNING: " + # "this could cause collisions when operating on the real " + # "beamline." + # ): + # print("Aborting leye_in(): fttrz not moved.") + # return + # else: + # fttrz_out = self._get_user_param_safe("leyex", "fttrz_out") + # umv(dev.fttrz, fttrz_out) + if not self.OMNYTools.yesno("Did the flight tube move out?", "y"): return leyex_in = self._get_user_param_safe("leyex", "in") diff --git a/csaxs_bec/device_configs/ptycho_lamni.yaml b/csaxs_bec/device_configs/ptycho_lamni.yaml index bb294dc3..efec07c9 100644 --- a/csaxs_bec/device_configs/ptycho_lamni.yaml +++ b/csaxs_bec/device_configs/ptycho_lamni.yaml @@ -20,6 +20,10 @@ leyex: connectionTimeout: 20 userParameter: in: 14.117 + # flight tube positions used by leye_out()/leye_in() (draft, still commented there); + # fill in and uncomment once the fttrz positions are known + # fttrz_in: + # fttrz_out: deviceTags: - ptycho_lamni leyey: diff --git a/csaxs_bec/device_configs/simulated_omny/simulated_lamni.yaml b/csaxs_bec/device_configs/simulated_omny/simulated_lamni.yaml index b8ffe91e..63600cb4 100644 --- a/csaxs_bec/device_configs/simulated_omny/simulated_lamni.yaml +++ b/csaxs_bec/device_configs/simulated_omny/simulated_lamni.yaml @@ -141,7 +141,7 @@ lsamrot: sign: 1 sim_stppermm: 50154.32099 sim_encpermm: 36000 - sim_velocity: 5 # 48 #4x than hw + sim_velocity: 48 # 4x faster than hw sim_initial_position: 0 tolerance: 1 enabled: true diff --git a/csaxs_bec/devices/sim/sim_lamni.py b/csaxs_bec/devices/sim/sim_lamni.py index 406c237c..abfa4ac6 100644 --- a/csaxs_bec/devices/sim/sim_lamni.py +++ b/csaxs_bec/devices/sim/sim_lamni.py @@ -12,7 +12,8 @@ RT (LAMNI_server.cpp, port 3333): its own protocol dialect — As (start cap sampling, no reply) / Ar -> 8-field cap sensor data, Ss (start rt sampler, no reply) / Sr -> 7-field sampler sums, V velocity limit (no reply), a (no reply) / ar -> angle, - pa/pr, scan s/sc/sd/sr/sh, r -> 21-field sample rows + pa/pr, scan s/sc/sd/sr/sh (sd only starts, and the scan only continues, while the + feedback loop is running), r -> 21-field sample rows (x/y target-avg-stdev, five cap-sensor avg/stdev pairs, angle avg/stdev), o/t. """ @@ -183,6 +184,9 @@ class SimRtLamniState: num_pos = len(self.scan_positions) if num_pos == 0 or self.scan_mode > 0: return num_pos + if not self.feedback_running: + logger.warning("[sim rt lamni] scan not started: feedback loop is not running") + return num_pos self.scan_mode = 3 self.scan_current = 0 self._scan_abort.clear() @@ -198,6 +202,13 @@ class SimRtLamniState: if self._scan_abort.wait(self.point_dwell_s): return with self.lock: + if not self.feedback_running: + logger.warning( + "[sim rt lamni] scan aborted at point" + f" {self.scan_current}: feedback loop stopped" + ) + self.scan_mode = 0 + return self.scan_current = index + 1 self.targets[: len(self.scan_positions[index])] = self.scan_positions[index] with self.lock: @@ -305,6 +316,8 @@ class SimRtLamniSocket(SimSocketBase): return f"{mode:.0f},{num_pos:.0f},{current:.0f}\n" if args.startswith("d"): num_pos = state.start_scan() + if num_pos > 0 and not state.feedback_running: + return "Scan not started: feedback loop not running.\n" return f"Scan mode started with #positions in scan {num_pos:.0f}. Timing: Detector Trigger.\n" if args.startswith("h"): state.clear_scan() diff --git a/csaxs_bec/scans/lamni_fermat_scan.py b/csaxs_bec/scans/lamni_fermat_scan.py index e2312ff1..b95969ca 100644 --- a/csaxs_bec/scans/lamni_fermat_scan.py +++ b/csaxs_bec/scans/lamni_fermat_scan.py @@ -60,7 +60,7 @@ class LamniFermatScan(ScanBase): "fov_circular", "stitch_overlap", ], - "Acquisition Parameters": ["exp_time", "frames_per_trigger", "readout_time"], + "Acquisition Parameters": ["exp_time", "frames_per_trigger"], } MIN_POSITIONS = 20 # Minimum number of positions required for a valid scan @@ -81,9 +81,8 @@ class LamniFermatScan(ScanBase): fov_circular: Annotated[float, ScanArgument(display_name="Fov Circular", description="Generate a circular field of view in the sample plane. This is an additional cropping within the rectangular fovx/fovy range", units=Units.µm)] = 0, stitch_overlap: Annotated[float, ScanArgument(display_name="Stitch Overlap", description="Overlap of the stitched regions", units=Units.µm)] = 1, corridor_size: Annotated[float | None, ScanArgument(display_name="Corridor Size", description="Corridor size for the corridor optimization.", units=Units.µm)] = None, - exp_time: DefaultArgType.ExposureTime = 0, + exp_time: DefaultArgType.ExposureTime = 0.1, frames_per_trigger: DefaultArgType.FramesPerTrigger = 1, - readout_time: DefaultArgType.ReadoutTime = 0, **kwargs, # fmt: on ): @@ -106,7 +105,6 @@ class LamniFermatScan(ScanBase): exp_time (float): Exposure time in seconds corridor_size (float | None): Corridor size for the corridor optimization. If None, the corridor size will be estimated. frames_per_trigger (int): Number of frames per trigger for devices that support configurable frame counts per trigger. - readout_time (float): Configuration for devices that support configurable readout times. Returns: ScanReport @@ -128,12 +126,9 @@ class LamniFermatScan(ScanBase): self.stitch_overlap = stitch_overlap self.exp_time = exp_time self.frames_per_trigger = frames_per_trigger - self.readout_time = readout_time self.corridor_size = corridor_size - self.update_scan_info( - exp_time=exp_time, frames_per_trigger=frames_per_trigger, readout_time=readout_time - ) + self.update_scan_info(exp_time=exp_time, frames_per_trigger=frames_per_trigger) @scan_hook def prepare_scan(self): diff --git a/csaxs_bec/scans/omny_fermat_scan.py b/csaxs_bec/scans/omny_fermat_scan.py index 35b9ca58..7dce2e29 100644 --- a/csaxs_bec/scans/omny_fermat_scan.py +++ b/csaxs_bec/scans/omny_fermat_scan.py @@ -57,7 +57,7 @@ class OmnyFermatScan(ScanBase): "angle", "corridor_size", ], - "Acquisition Parameters": ["exp_time", "frames_per_trigger", "readout_time"], + "Acquisition Parameters": ["exp_time", "frames_per_trigger"], } def __init__( @@ -71,9 +71,8 @@ class OmnyFermatScan(ScanBase): zshift: Annotated[float, ScanArgument(display_name="Zshift", description="Shift in z.", units=Units.µm, example=0)], angle: Annotated[float | None, ScanArgument(display_name="Angle", description="Rotation angle (will rotate first)", units=Units.deg)] = None, corridor_size: Annotated[float, ScanArgument(display_name="Corridor Size", description="Corridor size for the corridor optimization. ", units=Units.µm)] = 3, - exp_time: DefaultArgType.ExposureTime = 0, + exp_time: DefaultArgType.ExposureTime = 0.1, frames_per_trigger: DefaultArgType.FramesPerTrigger = 1, - readout_time: DefaultArgType.ReadoutTime = 0, **kwargs, # fmt: on ): @@ -91,7 +90,6 @@ class OmnyFermatScan(ScanBase): corridor_size (float): Corridor size for the corridor optimization. exp_time (float): Exposure time in seconds frames_per_trigger (int): Number of frames per trigger for devices that support configurable frame counts per trigger. - readout_time (float): Configuration for devices that support configurable readout times. Returns: ScanReport @@ -108,7 +106,6 @@ class OmnyFermatScan(ScanBase): self.corridor_size = corridor_size self.exp_time = exp_time self.frames_per_trigger = frames_per_trigger - self.readout_time = readout_time if self.zshift > 100: logger.warning("The zshift is larger than 100 um. It will be limited to 100 um.") @@ -117,9 +114,7 @@ class OmnyFermatScan(ScanBase): logger.warning("The zshift is smaller than -100 um. It will be limited to -100 um.") self.zshift = -100 - self.update_scan_info( - exp_time=exp_time, frames_per_trigger=frames_per_trigger, readout_time=readout_time - ) + self.update_scan_info(exp_time=exp_time, frames_per_trigger=frames_per_trigger) self.omny_rotation_status = None diff --git a/tests/tests_devices/test_sim_lamni_feedback.py b/tests/tests_devices/test_sim_lamni_feedback.py new file mode 100644 index 00000000..58222876 --- /dev/null +++ b/tests/tests_devices/test_sim_lamni_feedback.py @@ -0,0 +1,61 @@ +"""The simulated LamNI RT server must not run scans while the feedback loop is off.""" + +import time + +import pytest + +from csaxs_bec.devices.sim.sim_lamni import SimRtLamniSocket, SimRtLamniState + +N_POSITIONS = 10 + + +@pytest.fixture +def state(): + state = SimRtLamniState() + state.point_dwell_s = 0.02 + for ii in range(N_POSITIONS): + state.add_scan_position([float(ii), float(ii)]) + yield state + state.clear_scan() + + +def _wait_for_scan_end(state, timeout=5): + deadline = time.time() + timeout + while state.scan_mode != 0 and time.time() < deadline: + time.sleep(0.005) + assert state.scan_mode == 0 + + +def test_scan_not_started_without_feedback(state): + state.feedback_running = False + assert state.start_scan() == N_POSITIONS + assert state.scan_mode == 0 + assert state.scan_current == 0 + assert state._scan_thread is None + + +def test_scan_runs_with_feedback(state): + state.feedback_running = True + state.start_scan() + _wait_for_scan_end(state) + assert state.scan_current == N_POSITIONS + + +def test_scan_aborts_when_feedback_drops(state): + state.feedback_running = True + state.start_scan() + time.sleep(3.5 * state.point_dwell_s) + state.feedback_running = False + _wait_for_scan_end(state) + assert 0 < state.scan_current < N_POSITIONS + + +def test_sd_command_reply_without_feedback(state): + socket = SimRtLamniSocket.__new__(SimRtLamniSocket) + socket.state = state + state.feedback_running = False + assert "not started" in socket.handle_command("sd") + assert state.scan_mode == 0 + state.feedback_running = True + assert "Scan mode started" in socket.handle_command("sd") + _wait_for_scan_end(state) From 14ebd94e4e2f4ab0c1454bd0be3439a2eb0f721d Mon Sep 17 00:00:00 2001 From: Mirko Holler Date: Fri, 25 Sep 2026 14:23:51 +0200 Subject: [PATCH 2/5] feat(lamni): add lamni_move_to_scan_center wrapper, document shift computation - LamNI.lamni_move_to_scan_center(shift_x, shift_y, angle): thin client wrapper around scans.lamni_move_to_scan_center with the same parameters and docstring - user docs: describe how the per-projection shift is computed (base shift, x-ray eye fit, manual shift, correction tables) in the fine alignment section, and add a section on checking the x-ray eye correction with the eye still in Co-Authored-By: Claude Sonnet 5 Claude-Session: https://claude.ai/code/session_016gUjUT2xCNpnBQkThn3CqP --- .../bec_ipython_client/plugins/LamNI/lamni.py | 15 ++++++++++ docs/user/ptychography/lamni.md | 30 +++++++++++++++++++ 2 files changed, 45 insertions(+) diff --git a/csaxs_bec/bec_ipython_client/plugins/LamNI/lamni.py b/csaxs_bec/bec_ipython_client/plugins/LamNI/lamni.py index df2e018d..eccb144f 100644 --- a/csaxs_bec/bec_ipython_client/plugins/LamNI/lamni.py +++ b/csaxs_bec/bec_ipython_client/plugins/LamNI/lamni.py @@ -733,6 +733,21 @@ class LamNI(TomoQueueMixin, LamNIAlignmentMixin, LamNIOpticsMixin, LamniGuiTools def lights_on(self): self.device_manager.devices.lsamx.controller.lights_on() + def lamni_move_to_scan_center(self, shift_x: float, shift_y: float, angle: float): + """ + LamNI scan to move the interferometer to the computed scan center based on the provided shift and angle. + + Args: + shift_x (float): Shift x. + shift_y (float): Shift y. + angle (float): Angle. + + Returns: + ScanReport + """ + scans = builtins.__dict__.get("scans") + return scans.lamni_move_to_scan_center(shift_x=shift_x, shift_y=shift_y, angle=angle) + # ------------------------------------------------------------------ # Global parameters (backed by BEC global vars) # ------------------------------------------------------------------ diff --git a/docs/user/ptychography/lamni.md b/docs/user/ptychography/lamni.md index 12bc9c03..4257352b 100644 --- a/docs/user/ptychography/lamni.md +++ b/docs/user/ptychography/lamni.md @@ -67,6 +67,20 @@ To capture a single fresh frame without running the full alignment: `lamni.xrayeye_update_frame()` or with the shutter left open: `lamni.xrayeye_update_frame(keep_shutter_open=True)` +##### Checking the x-ray eye alignment with the eye still in + +While the X-ray eye is still in, you can move the interferometer to the scan centre of any angle and look at where the sample ends up, without starting a scan: +`lamni.lamni_move_to_scan_center(shift_x, shift_y, angle)` + +This is the same move that the alignment procedure and every scan use to place the sample. `shift_x` and `shift_y` are the base shift in mm, i.e. the centre found with the first click at 0° (`lamni.tomo_fovx_offset`, `lamni.tomo_fovy_offset`), `angle` is the rotation angle in degrees. The shift is rotated with the angle using the LamNI geometry. The command does not rotate the sample itself and it returns a scan report, so add `.wait()` to block until the move is done. + +Example, checking the correction at 90°: + +1. `lamni.feedback_disable()` and rotate: `umv(dev.lsamrot, 90)` +2. `lamni.lamni_move_to_scan_center(lamni.tomo_fovx_offset, lamni.tomo_fovy_offset, 90).wait()` (this re-enables the feedback) +3. `lamni.xrayeye_update_frame(keep_shutter_open=True)` to look at the sample +4. `lamni.lamni_compute_additional_correction_xeye_mu(90)` prints the correction (x and y, in mm) that the scan will add on top of this position. The sample should appear displaced from the FZP centre by the size of this correction, and the correction compensates for that displacement. A clearly different displacement means the fit is off, e.g. a bad click, and the alignment should be repeated. + * If slits were opened during alignment, close the slits: `slits` to around 0.3 * `lamni.leye_out()` remove the X-ray eye and move the flight tube in * *possibly check slit1, idgap* @@ -75,6 +89,22 @@ or with the shutter left open: `lamni.xrayeye_update_frame(keep_shutter_open=Tru The sample fine alignment can be obtained using ptychography. For this a short laminogram has to be recorded. +**How the shift at each projection angle is computed.** `lamni.tomo_scan_projection(angle)`, which is used by the alignment scan and by the laminography scan, combines several contributions. All are evaluated for the requested angle: + +| Contribution | Source | Applied as | +|---|---|---| +| Base shift | first click (0°) of the x-ray eye alignment, stored as `lamni.tomo_fovx_offset` / `tomo_fovy_offset` | scan centre (`center_x`, `center_y`), rotated with the angle | +| X-ray eye correction | sinusoidal fit `A·sin(angle + B) + C` of the 8 clicked positions, `lamni.lamni_compute_additional_correction_xeye_mu(angle)` | added to the shift | +| Manual shift | `lamni.manual_shift_x` / `manual_shift_y`, constant for all angles | added to the shift | +| Additional correction 1 | lookup table from the fine alignment, `lamni.read_additional_correction(file)` | subtracted from the shift | +| Additional correction 2 | lookup table of the second iteration, `lamni.read_additional_correction_2(file)` | subtracted from the shift | + +The shift is therefore `manual + x-ray eye − correction 1 − correction 2`, on top of the rotated base shift. The x-ray eye fit was measured after the base shift was applied, so the two do not count twice. + +The correction tables are read from the files written by `BEC_ptycho_align`, with one shift per alignment angle. There is no interpolation: for each projection the entry with the closest angle is used. If a table has no data, it is skipped and `Not applying additional correction` is printed. Without an x-ray eye fit, `Not applying any X-ray eye correction` is printed. Each correction can be removed again with `lamni.reset_correction()`, `lamni.reset_correction_2()` and `lamni.reset_xray_eye_correction()`. + +The alignment scan itself already uses the x-ray eye correction and any correction tables that are loaded. So the ptychographic alignment measures what is left over after those corrections, which is why a second iteration with `read_additional_correction_2()` is useful. + * `lamni.tomo_parameters()` adjust the ptychographic scan parameters for the alignment scan (FOV/step size/counting time) — `tomo_type` and number of projections are ignored, since the alignment scan always runs its own fixed 12 points spread evenly across the full 360 degrees, independent of the main tomogram's settings. * `lamni.tomo_alignment_scan()` perform the alignment scan. Requires x-ray-eye alignment to have already been done — it will abort with a message otherwise. Scan numbers, angles and the existing x-ray-eye-fit offset at each angle are written to `~/data/raw/logs/ptychotomoalign_scannum.txt` and also printed at the end. * Run `BEC_ptycho_align` (in Matlab, **force ptycho=1**, and **correct scan numbers**) using the printed/logged scan numbers. From ebd1d361c40bb9c6e7847f239b1817456d22a1a7 Mon Sep 17 00:00:00 2001 From: Mirko Holler Date: Fri, 25 Sep 2026 14:28:28 +0200 Subject: [PATCH 3/5] fix(lamni): port flomni's tomo_reconstruct scan-list fallback and folder resync - fall back to the last completed scan number when _current_scan_list is missing or stale (direct calls outside tomo_scan_projection) - re-read ptycho_reconstruct_foldername on every write so changes from another client session are picked up - add tests Co-Authored-By: Claude Sonnet 5 Claude-Session: https://claude.ai/code/session_016gUjUT2xCNpnBQkThn3CqP --- .../bec_ipython_client/plugins/LamNI/lamni.py | 22 ++++++-- .../test_lamni_tomo_reconstruct.py | 56 +++++++++++++++++++ 2 files changed, 74 insertions(+), 4 deletions(-) create mode 100644 tests/tests_bec_ipython_client/test_lamni_tomo_reconstruct.py diff --git a/csaxs_bec/bec_ipython_client/plugins/LamNI/lamni.py b/csaxs_bec/bec_ipython_client/plugins/LamNI/lamni.py index eccb144f..97aa41aa 100644 --- a/csaxs_bec/bec_ipython_client/plugins/LamNI/lamni.py +++ b/csaxs_bec/bec_ipython_client/plugins/LamNI/lamni.py @@ -1436,12 +1436,26 @@ class LamNI(TomoQueueMixin, LamNIAlignmentMixin, LamNIOpticsMixin, LamniGuiTools self.write_to_scilog(scilog_content, ["alignmentscan"]) def tomo_reconstruct(self, base_path="~/data/raw/logs/reconstruction_queue"): - """write the tomo reconstruct file for the reconstruction queue""" + """Write the tomo reconstruct file for the reconstruction queue. + + Normally called automatically at the end of tomo_scan_projection(), + which keeps self._current_scan_list up to date with the scan + number(s) of the projection just acquired (possibly several, when + stitching). When called directly -- e.g. from the command line after + a plain scans.lamni_fermat_scan(), without going through + tomo_scan_projection() -- that cached list is either stale (left over + from an earlier tomo scan) or not set at all, so fall back to just + the most recently completed scan number. + """ bec = builtins.__dict__.get("bec") + next_scan_number = bec.queue.next_scan_number + last_scan_number = next_scan_number - 1 + scan_list = getattr(self, "_current_scan_list", None) + if not scan_list or scan_list[-1] != last_scan_number: + scan_list = [last_scan_number] + self.reconstructor.folder_name = self.ptycho_reconstruct_foldername self.reconstructor.write( - scan_list=self._current_scan_list, - next_scan_number=bec.queue.next_scan_number, - base_path=base_path, + scan_list=scan_list, next_scan_number=next_scan_number, base_path=base_path ) def _at_each_angle(self, angle: float) -> None: diff --git a/tests/tests_bec_ipython_client/test_lamni_tomo_reconstruct.py b/tests/tests_bec_ipython_client/test_lamni_tomo_reconstruct.py new file mode 100644 index 00000000..163da14d --- /dev/null +++ b/tests/tests_bec_ipython_client/test_lamni_tomo_reconstruct.py @@ -0,0 +1,56 @@ +"""tomo_reconstruct() must write the right scan list and queue folder, also when called +directly (without tomo_scan_projection() having just set _current_scan_list).""" + +import builtins +import types + +import pytest + +from csaxs_bec.bec_ipython_client.plugins.LamNI.lamni import LamNI + + +class FakeReconstructor: + def __init__(self): + self.folder_name = "stale_folder" + self.calls = [] + + def write(self, **kwargs): + self.calls.append(dict(kwargs, folder_name=self.folder_name)) + + +class FakeClient: + def get_global_var(self, key): + return {"ptycho_reconstruct_foldername": "current_folder"}.get(key) + + +@pytest.fixture +def lamni(monkeypatch): + obj = object.__new__(LamNI) + obj.client = FakeClient() + obj.reconstructor = FakeReconstructor() + fake_bec = types.SimpleNamespace(queue=types.SimpleNamespace(next_scan_number=101)) + monkeypatch.setitem(builtins.__dict__, "bec", fake_bec) + return obj + + +def test_uses_cached_scan_list_when_current(lamni): + lamni._current_scan_list = [99, 100] + lamni.tomo_reconstruct() + assert lamni.reconstructor.calls[0]["scan_list"] == [99, 100] + assert lamni.reconstructor.calls[0]["next_scan_number"] == 101 + + +def test_falls_back_when_scan_list_stale(lamni): + lamni._current_scan_list = [40, 41] + lamni.tomo_reconstruct() + assert lamni.reconstructor.calls[0]["scan_list"] == [100] + + +def test_falls_back_when_scan_list_missing(lamni): + lamni.tomo_reconstruct() + assert lamni.reconstructor.calls[0]["scan_list"] == [100] + + +def test_folder_name_resynced_from_global_var(lamni): + lamni.tomo_reconstruct() + assert lamni.reconstructor.calls[0]["folder_name"] == "current_folder" From d064ec5358094376be38def5312262c1b271a102 Mon Sep 17 00:00:00 2001 From: Mirko Holler Date: Fri, 25 Sep 2026 14:31:49 +0200 Subject: [PATCH 4/5] fix(lamni,flomni): create documentation folder before writing the tomo PDF report PDFWriter does not create directories, so tomo_scan() failed with FileNotFoundError when ~/data/raw/documentation did not exist. Also add an omny TODO for porting the remaining ~/Data10 paths and the same folder fix. Co-Authored-By: Claude Sonnet 5 Claude-Session: https://claude.ai/code/session_016gUjUT2xCNpnBQkThn3CqP --- .../bec_ipython_client/plugins/LamNI/lamni.py | 1 + .../plugins/flomni/flomni.py | 1 + .../TODO_data10_to_new_data_structure.md | 46 +++++++++++++++++++ 3 files changed, 48 insertions(+) create mode 100644 csaxs_bec/bec_ipython_client/plugins/omny/AI_docs/TODO_data10_to_new_data_structure.md diff --git a/csaxs_bec/bec_ipython_client/plugins/LamNI/lamni.py b/csaxs_bec/bec_ipython_client/plugins/LamNI/lamni.py index 97aa41aa..edde4935 100644 --- a/csaxs_bec/bec_ipython_client/plugins/LamNI/lamni.py +++ b/csaxs_bec/bec_ipython_client/plugins/LamNI/lamni.py @@ -2420,6 +2420,7 @@ class LamNI(TomoQueueMixin, LamNIAlignmentMixin, LamNIOpticsMixin, LamniGuiTools user_target = os.path.expanduser( f"~/data/raw/documentation/tomo_scan_ID_{self.tomo_id}.pdf" ) + os.makedirs(os.path.dirname(user_target), exist_ok=True) with PDFWriter(user_target) as file: self._add_psi_footer(file) # PDFWriter (bec_lib) has no public image API -- reach into its diff --git a/csaxs_bec/bec_ipython_client/plugins/flomni/flomni.py b/csaxs_bec/bec_ipython_client/plugins/flomni/flomni.py index 60205aed..b46837bf 100644 --- a/csaxs_bec/bec_ipython_client/plugins/flomni/flomni.py +++ b/csaxs_bec/bec_ipython_client/plugins/flomni/flomni.py @@ -4289,6 +4289,7 @@ class Flomni( user_target = os.path.expanduser( f"~/data/raw/documentation/tomo_scan_ID_{self.tomo_id}.pdf" ) + os.makedirs(os.path.dirname(user_target), exist_ok=True) with PDFWriter(user_target) as file: self._add_psi_footer(file) # PDFWriter (bec_lib) has no public image API -- reach into its diff --git a/csaxs_bec/bec_ipython_client/plugins/omny/AI_docs/TODO_data10_to_new_data_structure.md b/csaxs_bec/bec_ipython_client/plugins/omny/AI_docs/TODO_data10_to_new_data_structure.md new file mode 100644 index 00000000..26ee8171 --- /dev/null +++ b/csaxs_bec/bec_ipython_client/plugins/omny/AI_docs/TODO_data10_to_new_data_structure.md @@ -0,0 +1,46 @@ +# TODO: OMNY still uses the old `~/Data10` layout, and its PDF report can fail on a missing folder + +LamNI and flomni write their files under the new data structure (`~/data/raw/...`). +OMNY still points at the old `~/Data10/...` tree in several places and needs porting. +Not done yet, to avoid conflicting with other in-progress OMNY changes. + +## 1. Port `~/Data10` paths to the new data structure + +Where OMNY (`csaxs_bec/bec_ipython_client/plugins/omny/`) still uses `~/Data10`: + +| File | Line | Path | LamNI/flomni equivalent | +|---|---|---|---| +| `omny.py` | 1217 | `tomo_reconstruct(base_path="~/Data10/specES1")` | `~/data/raw/logs/reconstruction_queue` | +| `omny.py` | 1236 | `~/Data10/specES1/dat-files/tomography_scannumbers.txt` | `~/data/raw/logs/tomography_scannumbers.txt` | +| `omny.py` | 1484 | `~/Data10/documentation/tomo_scan_ID_.pdf` | `~/data/raw/documentation/tomo_scan_ID_.pdf` | +| `omny.py` | 1489 | `xterm /work/sls/spec/local/XOMNY/bin/upload/upload_last_pon.sh &` | old spec upload script, check it still applies | +| `x_ray_eye_align.py` | 392 | `~/Data10/specES1/internal/xrayeye_alignmentvalues` | `~/data/raw/logs/xrayeye_alignmentvalues/` (timestamped HDF5) | +| `omny_alignment_mixin.py` | 62 | `~/Data10/specES1/internal/` | see the same alignment-values location | + +The reconstruction queue folder in the new layout is created and written by the shared +`PtychoReconstructor.write()` (`OMNY_shared/omny_general_tools.py`), which OMNY does not use +yet. See also `TODO_tomo_reconstruct_stale_scan_list.md` (already ported to flomni and LamNI, +so switching OMNY to the shared reconstructor would cover both items). + +## 2. Create the documentation folder if it does not exist + +`OMNY.write_pdf_report()` (`omny.py:1439`) opens `PDFWriter(user_target)` without creating the +target folder first. `PDFWriter.close()` calls fpdf's `output(path)` +(`bec_lib/pdf_writer.py:90`), which does not create directories, so on an account without the +folder `tomo_scan()` fails with: + +``` +FileNotFoundError: [Errno 2] No such file or directory: '.../documentation/tomo_scan_ID_0.pdf' +``` + +Seen on LamNI; flomni had the identical pattern. Both are fixed by creating the folder before +the writer is opened: + +```python +os.makedirs(os.path.dirname(user_target), exist_ok=True) +with PDFWriter(user_target) as file: +``` + +Apply the same line in `OMNY.write_pdf_report()`, and use the new-structure path from item 1. +Note the later steps in that method (the `upload_last_pon.sh` call and the logbook message) +only run if the PDF write succeeds. From 0717e1ebc359a8bf0c732969fb7e9ff6640d2672 Mon Sep 17 00:00:00 2001 From: Mirko Holler Date: Fri, 25 Sep 2026 14:42:56 +0200 Subject: [PATCH 5/5] feat(lamni,flomni): tomo_parameters() opens the GUI window, CLI is tomo_parameters_cli() - shared TomoQueueMixin.tomo_parameters() opens OMNY_TomoParams in its own window (lamni_tomo_params / flomni_tomo_params); repeat calls do not open a second one; a missing or failing GUI raises the setup's error and points to tomo_parameters_cli() instead of silently falling back - rename the prompt-based versions to tomo_parameters_cli() - docs: describe both, and use the CLI in the queue examples that rely on the command blocking until the values are entered - add tests with a fake GUI Co-Authored-By: Claude Sonnet 5 Claude-Session: https://claude.ai/code/session_016gUjUT2xCNpnBQkThn3CqP --- .../bec_ipython_client/plugins/LamNI/lamni.py | 8 +- .../plugins/OMNY_shared/tomo_queue_mixin.py | 43 +++++++++ .../plugins/flomni/flomni.py | 8 +- docs/user/ptychography/flomni.md | 12 ++- docs/user/ptychography/lamni.md | 12 ++- .../test_tomo_parameters_gui.py | 96 +++++++++++++++++++ 6 files changed, 165 insertions(+), 14 deletions(-) create mode 100644 tests/tests_bec_ipython_client/test_tomo_parameters_gui.py diff --git a/csaxs_bec/bec_ipython_client/plugins/LamNI/lamni.py b/csaxs_bec/bec_ipython_client/plugins/LamNI/lamni.py index edde4935..a1a090b7 100644 --- a/csaxs_bec/bec_ipython_client/plugins/LamNI/lamni.py +++ b/csaxs_bec/bec_ipython_client/plugins/LamNI/lamni.py @@ -130,6 +130,9 @@ class LamNIError(Exception): class LamNI(TomoQueueMixin, LamNIAlignmentMixin, LamNIOpticsMixin, LamniGuiTools): + _TOMO_PARAMS_WINDOW_NAME = "lamni_tomo_params" + _TOMO_PARAMS_ERROR = LamNIError + # Ordered set of all global-var-backed tomo scan parameters snapshotted # by tomo_queue_add()/restored by tomo_queue_execute(). Lamni's own # names for overlapping flomni concepts (tomo_circfov instead of @@ -2114,8 +2117,9 @@ class LamNI(TomoQueueMixin, LamNIAlignmentMixin, LamNIOpticsMixin, LamniGuiTools return LamniFermatScan.MIN_POSITIONS - def tomo_parameters(self): - """Print and interactively update the tomo parameters.""" + def tomo_parameters_cli(self): + """Print and interactively update the tomo parameters on the command line. + tomo_parameters() opens the GUI version.""" print("Current settings:") print(f"Counting time per frame = {self.tomo_countingtime} s") print(f"Stepsize microns = {self.tomo_shellstep}") diff --git a/csaxs_bec/bec_ipython_client/plugins/OMNY_shared/tomo_queue_mixin.py b/csaxs_bec/bec_ipython_client/plugins/OMNY_shared/tomo_queue_mixin.py index f5af08ef..1b427dab 100644 --- a/csaxs_bec/bec_ipython_client/plugins/OMNY_shared/tomo_queue_mixin.py +++ b/csaxs_bec/bec_ipython_client/plugins/OMNY_shared/tomo_queue_mixin.py @@ -41,6 +41,7 @@ import inspect import json import os import threading +import time import uuid from typing import Callable @@ -210,6 +211,12 @@ class TomoQueueMixin: _TOMO_QUEUE_ACTIONS: dict = {} _TOMO_QUEUE_MOVE_DEVICES: dict = {} + # tomo_parameters() GUI window: subclasses set a unique window name (a valid + # Python identifier, e.g. "lamni_tomo_params") and their own error class. + _TOMO_PARAMS_WINDOW_NAME: str = "" + _TOMO_PARAMS_ERROR: type[Exception] = RuntimeError + _TOMO_PARAMS_GUI_TIMEOUT = 20 + # Name of a registered at_each_angle hook (see register_at_each_angle_hook()), # or None for the default per-projection behaviour. at_each_angle_hook = _GlobalVarParam(None) @@ -237,6 +244,42 @@ class TomoQueueMixin: # since-ended session must not linger and look registered. self._publish_at_each_angle_hooks() + # ── tomo parameter GUI window ─────────────────────────────────────────── + + def tomo_parameters(self) -> None: + """Open the tomo parameter GUI (OMNY_TomoParams) in its own window. + + Calling it again while the window is open does nothing. The widget + works on the same global variables as the command line version, + ``tomo_parameters_cli()``, which is not used as an automatic fallback: + if the GUI cannot be opened this raises, so the problem gets fixed. + """ + name = self._TOMO_PARAMS_WINDOW_NAME + error = self._TOMO_PARAMS_ERROR + gui = getattr(self.client, "gui", None) + if gui is None: + raise error( + "No BEC GUI is available in this session, so the tomo parameter window cannot be" + " opened. Use tomo_parameters_cli() for the command line version." + ) + timeout = self._TOMO_PARAMS_GUI_TIMEOUT + try: + if name in gui.windows: + window = getattr(gui, name) + if hasattr(window, "tomo_params"): + print("The tomo parameter window is already open.") + return + else: + gui.new(name, timeout=timeout) + time.sleep(1) + window = getattr(gui, name) + window.new("OMNY_TomoParams", object_name="tomo_params", timeout=timeout) + except Exception as exc: # pylint: disable=broad-except + raise error( + f"Could not open the tomo parameter window ({type(exc).__name__}: {exc}). Use" + " tomo_parameters_cli() for the command line version." + ) from exc + # ── at_each_angle hook registry ───────────────────────────────────────── def register_at_each_angle_hook(self, name: str, func) -> None: diff --git a/csaxs_bec/bec_ipython_client/plugins/flomni/flomni.py b/csaxs_bec/bec_ipython_client/plugins/flomni/flomni.py index b46837bf..a2ed2c7d 100644 --- a/csaxs_bec/bec_ipython_client/plugins/flomni/flomni.py +++ b/csaxs_bec/bec_ipython_client/plugins/flomni/flomni.py @@ -1784,6 +1784,9 @@ class Flomni( cSAXSBeamlineChecks, flomniGuiTools, ): + _TOMO_PARAMS_WINDOW_NAME = "flomni_tomo_params" + _TOMO_PARAMS_ERROR = FlomniError + # Backed by a BEC global var (Redis) so the pre-open slit position # survives a kernel restart while the eye is still in. _sl1xs_before_eye = _GlobalVarParam(None) @@ -3757,8 +3760,9 @@ class Flomni( return FlomniFermatScan.MIN_POSITIONS - def tomo_parameters(self): - """print and update the tomo parameters""" + def tomo_parameters_cli(self): + """print and update the tomo parameters on the command line. + tomo_parameters() opens the GUI version.""" print("Current settings:") print(f"Counting time per frame = {self.tomo_countingtime} s") print(f"Stepsize microns = {self.tomo_shellstep}") diff --git a/docs/user/ptychography/flomni.md b/docs/user/ptychography/flomni.md index 65ebe493..0ae5a53f 100644 --- a/docs/user/ptychography/flomni.md +++ b/docs/user/ptychography/flomni.md @@ -76,7 +76,7 @@ _To bypass the fine alignment: `flomni.feye_out()`_ ### Tomographic Measurement Now that the sample is aligned, the tomographic measurement can be performed. -1. `flomni.tomo_parameters()` adjust the scan parameters for the tomographic scan. This includes the parameters for ptychographic scans of projections plus the strategy for angular sampling. The vertical shift adjusts the field of view, up (positive) or down (negative). After adjusting the numbers, type again `flomni.tomo_parameters()` and verify that they are correct. For the "8 sub-tomograms" mode, an optional 0-deg reference shot can be enabled at the start of every odd sub-tomogram and once more at the end, useful for tracking radiation damage over the course of a long measurement. +1. `flomni.tomo_parameters()` opens the tomo parameter window (GUI) to adjust the scan parameters for the tomographic scan (`flomni.tomo_parameters_cli()` is the command line version, which prompts for each value in the terminal). This includes the parameters for ptychographic scans of projections plus the strategy for angular sampling. The vertical shift adjusts the field of view, up (positive) or down (negative). After adjusting the numbers, type again `flomni.tomo_parameters()` and verify that they are correct. For the "8 sub-tomograms" mode, an optional 0-deg reference shot can be enabled at the start of every odd sub-tomogram and once more at the end, useful for tracking radiation damage over the course of a long measurement. 1. `flomni.tomo_scan_projection(angle)` perform a ptychographic scan at the rotation angle . Launch the tomographic measurement by `flomni.tomo_scan()`. During the scan a live progress report is printed, including an estimated time of completion. Unusually long gaps (e.g. a beamline interruption) are detected automatically and excluded from the estimate, and the total time lost to such gaps is reported once the scan finishes. 1. Before changing sample, verify that all subtomograms were completely acquired using the tomo_reconstruction matlab script. @@ -404,11 +404,13 @@ The queue is persisted (it survives a BEC client restart). Each job's status is If the process running the queue dies hard enough that it never gets to write a status update at all (a kernel restart, a Ctrl-C during a blocking prompt) a job can be left stuck showing `running` with nothing actually running. `flomni.tomo_queue_delete(index)` has no status guard and works on a stuck row regardless; you can also fix the status directly with `flomni._tomo_queue_proxy.update_by_id(job_id, status="incomplete")` (to make it resumable) or `status="done"` (to skip it). The GUI's Delete/Clear normally refuse to touch a `running` row, but detect a stale one (no recent scan heartbeat) and offer to proceed anyway with an explicit confirmation instead of blocking forever. +In the examples, `flomni.tomo_parameters_cli()` is used because it waits until the values are entered before the next command runs. With the GUI window, adjust the values there and add the job with its queue button, or with `flomni.tomo_queue_add()`. + Example: ``` -flomni.tomo_parameters() # set up parameter set #1 +flomni.tomo_parameters_cli() # set up parameter set #1 flomni.tomo_queue_add("fast overview") -flomni.tomo_parameters() # set up parameter set #2 +flomni.tomo_parameters_cli() # set up parameter set #2 flomni.tomo_queue_add("hires scan") flomni.tomo_queue_show() flomni.tomo_queue_execute() # runs both, in order, on this sample @@ -544,7 +546,7 @@ Example — queue a polarizer-modulated tomogram, then a normal one: ```python flomni.register_at_each_angle_hook("polarizer_mod", polarizer_modulation) -flomni.tomo_parameters() # set up the scan parameters as usual +flomni.tomo_parameters_cli() # set up the scan parameters as usual flomni.at_each_angle_hook = "polarizer_mod" # activate the hook flomni.tomo_queue_add("polarizer run") @@ -613,7 +615,7 @@ Load and use it: import my_hooks flomni.register_at_each_angle_hook("high_res_every_5th", my_hooks.high_res_every_5th) -flomni.tomo_parameters() # set up the scan parameters as usual +flomni.tomo_parameters_cli() # set up the scan parameters as usual flomni.at_each_angle_hook = "high_res_every_5th" # activate the hook flomni.tomo_queue_add("subtomo 2 high-res every 5th") diff --git a/docs/user/ptychography/lamni.md b/docs/user/ptychography/lamni.md index 4257352b..0c693c62 100644 --- a/docs/user/ptychography/lamni.md +++ b/docs/user/ptychography/lamni.md @@ -119,7 +119,7 @@ The alignment scan itself already uses the x-ray eye correction and any correcti Start the laminography scan by -1. `lamni.tomo_parameters()` adjust the parameters to the desired settings. +1. `lamni.tomo_parameters()` opens the tomo parameter window (GUI) to adjust the parameters to the desired settings. The command line version, which prompts for each value in the terminal, is `lamni.tomo_parameters_cli()`. 2. for test scans run `lamni.tomo_scan_projection(angle)` `lamni.tomo_reconstruct()` @@ -160,11 +160,13 @@ The queue is persisted (it survives a BEC client restart). Each job's status is If the process running the queue dies hard enough that it never gets to write a status update at all (a kernel restart, a Ctrl-C during a blocking prompt) a job can be left stuck showing `running` with nothing actually running. `lamni.tomo_queue_delete(index)` has no status guard and works on a stuck row regardless; you can also fix the status directly with `lamni._tomo_queue_proxy.update_by_id(job_id, status="incomplete")` (to make it resumable) or `status="done"` (to skip it). The GUI's Delete/Clear normally refuse to touch a `running` row, but detect a stale one (no recent scan heartbeat) and offer to proceed anyway with an explicit confirmation instead of blocking forever. +In the examples, `lamni.tomo_parameters_cli()` is used because it waits until the values are entered before the next command runs. With the GUI window, adjust the values there and add the job with its queue button, or with `lamni.tomo_queue_add()`. + Example: ``` -lamni.tomo_parameters() # set up parameter set #1 +lamni.tomo_parameters_cli() # set up parameter set #1 lamni.tomo_queue_add("fast overview") -lamni.tomo_parameters() # set up parameter set #2 +lamni.tomo_parameters_cli() # set up parameter set #2 lamni.tomo_queue_add("hires scan") lamni.tomo_queue_show() lamni.tomo_queue_execute() # runs both, in order, on this sample @@ -287,7 +289,7 @@ Example — queue a polarizer-modulated laminogram, then a normal one: ```python lamni.register_at_each_angle_hook("polarizer_mod", polarizer_modulation) -lamni.tomo_parameters() # set up the scan parameters as usual +lamni.tomo_parameters_cli() # set up the scan parameters as usual lamni.at_each_angle_hook = "polarizer_mod" # activate the hook lamni.tomo_queue_add("polarizer run") @@ -356,7 +358,7 @@ Load and use it: import my_hooks lamni.register_at_each_angle_hook("high_res_every_5th", my_hooks.high_res_every_5th) -lamni.tomo_parameters() # set up the scan parameters as usual +lamni.tomo_parameters_cli() # set up the scan parameters as usual lamni.at_each_angle_hook = "high_res_every_5th" # activate the hook lamni.tomo_queue_add("subtomo 2 high-res every 5th") diff --git a/tests/tests_bec_ipython_client/test_tomo_parameters_gui.py b/tests/tests_bec_ipython_client/test_tomo_parameters_gui.py new file mode 100644 index 00000000..18540b11 --- /dev/null +++ b/tests/tests_bec_ipython_client/test_tomo_parameters_gui.py @@ -0,0 +1,96 @@ +"""tomo_parameters() opens the OMNY_TomoParams widget in its own window (shared TomoQueueMixin +implementation, used by LamNI and Flomni); tomo_parameters_cli() is the command line version.""" + +import pytest + +import csaxs_bec.bec_ipython_client.plugins.OMNY_shared.tomo_queue_mixin as mixin_module +from csaxs_bec.bec_ipython_client.plugins.flomni.flomni import Flomni, FlomniError +from csaxs_bec.bec_ipython_client.plugins.LamNI.lamni import LamNI, LamNIError + + +class FakeWindow: + def __init__(self): + self.new_calls = [] + + def new(self, widget, **kwargs): + self.new_calls.append((widget, kwargs)) + self.tomo_params = object() + + +class FakeGui: + def __init__(self, fail_new=False): + self.windows = {} + self.new_calls = [] + self.fail_new = fail_new + + def new(self, name, **kwargs): + if self.fail_new: + raise TimeoutError("GUI server did not answer") + self.new_calls.append((name, kwargs)) + self.windows[name] = window = FakeWindow() + setattr(self, name, window) + return window + + +class FakeClient: + def __init__(self, gui): + if gui is not None: + self.gui = gui + + +@pytest.fixture(autouse=True) +def no_sleep(monkeypatch): + monkeypatch.setattr(mixin_module.time, "sleep", lambda *_: None) + + +def make(cls, gui): + obj = object.__new__(cls) + obj.client = FakeClient(gui) + return obj + + +@pytest.mark.parametrize( + "cls, window_name, error", + [(LamNI, "lamni_tomo_params", LamNIError), (Flomni, "flomni_tomo_params", FlomniError)], +) +class TestTomoParametersWindow: + def test_opens_widget_in_own_window(self, cls, window_name, error): + gui = FakeGui() + make(cls, gui).tomo_parameters() + assert [name for name, _ in gui.new_calls] == [window_name] + widget, kwargs = gui.windows[window_name].new_calls[0] + assert widget == "OMNY_TomoParams" + assert kwargs["object_name"] == "tomo_params" + + def test_second_call_does_not_open_another(self, cls, window_name, error, capsys): + gui = FakeGui() + obj = make(cls, gui) + obj.tomo_parameters() + obj.tomo_parameters() + assert len(gui.new_calls) == 1 + assert len(gui.windows[window_name].new_calls) == 1 + assert "already open" in capsys.readouterr().out + + def test_window_without_widget_gets_the_widget(self, cls, window_name, error): + gui = FakeGui() + gui.new(window_name) # window exists, but holds no tomo_params widget + make(cls, gui).tomo_parameters() + assert len(gui.new_calls) == 1 # window reused, not created again + assert gui.windows[window_name].new_calls[0][0] == "OMNY_TomoParams" + + def test_raises_without_gui_and_names_cli(self, cls, window_name, error): + with pytest.raises(error, match="tomo_parameters_cli"): + make(cls, None).tomo_parameters() + + def test_raises_when_gui_fails_and_does_not_fall_back(self, cls, window_name, error): + obj = make(cls, FakeGui(fail_new=True)) + obj.tomo_parameters_cli = lambda: pytest.fail("must not fall back to the CLI") + with pytest.raises(error, match="tomo_parameters_cli") as exc_info: + obj.tomo_parameters() + assert isinstance(exc_info.value.__cause__, TimeoutError) + + +def test_cli_version_exists_and_gui_version_is_the_mixin_one(): + for cls in (LamNI, Flomni): + assert "tomo_parameters_cli" in vars(cls) + assert "tomo_parameters" not in vars(cls)