fix: display flux more nicely
This commit is contained in:
+1
-1
@@ -6,7 +6,7 @@ readme = "README.md"
|
||||
requires-python = ">=3.11"
|
||||
dependencies = [
|
||||
"uv",
|
||||
"aarecommon>=0.7.3",
|
||||
"aarecommon>=0.8.0",
|
||||
"pydantic>=2.11",
|
||||
"numpy",
|
||||
"jfjoch_client>=1.0.0rc165",
|
||||
|
||||
@@ -4,6 +4,7 @@ import time
|
||||
from aarecommon.config.beamline import cfg_get
|
||||
from aarecommon.config.logger import setup_logger
|
||||
from aarecommon.config.logger_events import log_timing
|
||||
from aarecommon.config.util import suppress_output
|
||||
from aarecommon.math.coordinate import AerotechCoordinate, SmargonCoordinate
|
||||
from aarecommon.models.beamline import MXBeamline
|
||||
from aarecommon.models.models import BeamlineStateEnum, SampleCameraSettings, StagePositionEnum
|
||||
@@ -210,7 +211,12 @@ class BeamlineDevices:
|
||||
|
||||
@property
|
||||
def full_flux(self) -> float:
|
||||
return self._dispatch.bec_macros.full_flux_ph_per_s()
|
||||
try:
|
||||
with suppress_output():
|
||||
return self._dispatch.bec_macros.full_flux_ph_per_s()
|
||||
except Exception as e:
|
||||
logger.error(f"Could not get flux from BEC macro {e}")
|
||||
return 9.99e12
|
||||
|
||||
# Cryojet
|
||||
@property
|
||||
|
||||
@@ -67,7 +67,7 @@ class StatusBar(QStatusBar):
|
||||
|
||||
self.sharpness = ValueLabel("Samcam image sharpness", "", self)
|
||||
self.samcam_fps = ValueLabel("Samcam FPS", "fps", self)
|
||||
self.flux = ValueLabel("Flux", "x 10<sup>9</sup> ph/s", self)
|
||||
self.flux = ValueLabel("Flux", "ph/s", self)
|
||||
self.transmission = ValueLabel("Transmission", "", self)
|
||||
self.ring_current = ValueLabel("Ring current", "mA", self)
|
||||
self.wvl = ValueLabel("Wavelength", "Å", self)
|
||||
@@ -172,7 +172,14 @@ class StatusBar(QStatusBar):
|
||||
if status.bl.flux_ph_s is None:
|
||||
self.flux.set_value("0")
|
||||
else:
|
||||
self.flux.set_value(f"{(status.bl.flux_ph_s / 1e9):.0f}")
|
||||
try:
|
||||
num = f"{status.bl.flux_ph_s:.2E}"
|
||||
mod, exp = num.split("E")
|
||||
self.flux.set_value(f"{mod} x 10<sup>{int(exp)}</sup>")
|
||||
except Exception as e:
|
||||
logger.error(f"Error parsing flux result: {e}")
|
||||
self.flux.set_value(f"{status.bl.flux_ph_s:.2E}")
|
||||
|
||||
|
||||
if status.bl.transmission is None:
|
||||
self.transmission.set_value("(moving)")
|
||||
|
||||
Reference in New Issue
Block a user