From 06c66c1944a353aa727ef649ae767ba629083136 Mon Sep 17 00:00:00 2001 From: David Perl Date: Wed, 9 Sep 2026 18:10:09 +0200 Subject: [PATCH] fix: implement simulated flux --- src/aare/beamline_dispatch/simulated/beamline_dispatch.py | 7 +++++-- src/aare/daq/devices.py | 2 +- src/aare/gui/widgets/status_bar.py | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/aare/beamline_dispatch/simulated/beamline_dispatch.py b/src/aare/beamline_dispatch/simulated/beamline_dispatch.py index ed14548e..fe06ba2f 100644 --- a/src/aare/beamline_dispatch/simulated/beamline_dispatch.py +++ b/src/aare/beamline_dispatch/simulated/beamline_dispatch.py @@ -17,8 +17,8 @@ class SimulatedBecMacros(BecMacros): @staticmethod def save_current_position(device, position, axis=None, force=False, max_delta=0.5) -> None: ... @staticmethod - def init_beamline_environment() -> tuple[Any, Any, Any]: - return (None, None, None) + def init_beamline_environment() -> tuple[Any, Any]: + return (None, None) @staticmethod def bl_energy(energy_ev, move_gap=True, mono_scan=True, plot=True): ... @@ -28,6 +28,9 @@ class SimulatedBecMacros(BecMacros): def mono_pitch_scan(plot=True): ... @staticmethod def auto_exposure(): ... + @staticmethod + def full_flux_ph_per_s() -> float: + return 42 class SimulatedDispatch(DefaultDispatch): diff --git a/src/aare/daq/devices.py b/src/aare/daq/devices.py index 4548af52..7a2416ab 100644 --- a/src/aare/daq/devices.py +++ b/src/aare/daq/devices.py @@ -214,7 +214,7 @@ class BeamlineDevices: try: with suppress_output(): return self._dispatch.bec_macros.full_flux_ph_per_s() - except Exception as e: #noqa + except Exception as e: # noqa logger.error(f"Could not get flux from BEC macro {e}") return 9.99e12 diff --git a/src/aare/gui/widgets/status_bar.py b/src/aare/gui/widgets/status_bar.py index 1926ef8e..5fe1b790 100644 --- a/src/aare/gui/widgets/status_bar.py +++ b/src/aare/gui/widgets/status_bar.py @@ -176,7 +176,7 @@ class StatusBar(QStatusBar): num = f"{(status.bl.flux_ph_s / status.bl.transmission):.2E}" mod, exp = num.split("E") self.flux.set_value(f"{mod} x 10{int(exp)}") - except Exception as e: #noqa + except Exception as e: # noqa logger.error(f"Error parsing flux result: {e}") self.flux.set_value(f"{status.bl.flux_ph_s:.2E}")