fix: current state reading
CI / lint (push) Skipped
CI / test (3.12) (push) Skipped
CI / test (3.13) (push) Skipped
CI / test-with-beamline-plugins (pxi_bec) (push) Skipped
CI / test-with-beamline-plugins (pxii_bec) (push) Skipped
CI / test-with-beamline-plugins (pxiii_bec) (push) Skipped
CI / lint (pull_request) Failing after 29s
CI / test (3.13) (pull_request) Successful in 1m5s
CI / test (3.12) (pull_request) Successful in 1m11s
CI / test (3.14) (pull_request) Successful in 1m16s
CI / test-with-beamline-plugins (pxi_bec) (pull_request) Successful in 1m18s
CI / test-with-beamline-plugins (pxii_bec) (pull_request) Successful in 1m16s
CI / test-with-beamline-plugins (pxiii_bec) (pull_request) Successful in 1m21s
CI / test-with-coverage (pull_request) Successful in 1m39s
CI / coverage-analysis (pull_request) Failing after 4s

This commit is contained in:
David Perl committed 2026-08-27 11:34:10 +02:00
1 parent adfc39d4cd
commit 588419c057
3 files changed
+19 -14

No files matched your search

@@ -68,6 +68,7 @@ class RotationService:
)
time.sleep(smargon_time_step)
self.ctx.deps.devs.aerotech.wait_till_done(timeout=int(round(total_time + 60, 0)))
self.ctx.deps.devs.aerotech_omega = omega_start
+17 -13
View File
@@ -50,21 +50,22 @@ class BeamlineState(str, Enum):
XTAL_SNAPSHOT = "xtal_snapshot"
def _bec_state_to_aare_state(bec_state: BeamlineState) -> BeamlineStateEnum:
def _bec_state_to_aare_state(bec_state: str) -> BeamlineStateEnum:
map = {
BeamlineState.BEAMSTOP_ALIGNMENT: BeamlineStateEnum.BeamstopAlignment,
BeamlineState.SAMPLE_ALIGNMENT: BeamlineStateEnum.SampleAlignment,
BeamlineState.DATA_COLLECTION: BeamlineStateEnum.DataCollection,
BeamlineState.DC_XRF: BeamlineStateEnum.XrayFluorescence,
BeamlineState.MANUAL_SAMPLE_EXCHANGE: BeamlineStateEnum.SampleExchange,
BeamlineState.BEAM_VISUALISATION: BeamlineStateEnum.BeamLocation,
BeamlineState.FLUX_MEASUREMENT: BeamlineStateEnum.FluxMeasurement,
BeamlineState.BEAMSTOP_ALIGNMENT: BeamlineStateEnum.BeamstopAlignment,
BeamlineState.MAINTENANCE: BeamlineStateEnum.Maintenance,
BeamlineState.XTAL_SNAPSHOT: BeamlineStateEnum.XtalSnapshot,
"BEAMSTOP_ALIGNMENT": BeamlineStateEnum.BeamstopAlignment,
"SAMPLE_ALIGNMENT": BeamlineStateEnum.SampleAlignment,
"DATA_COLLECTION": BeamlineStateEnum.DataCollection,
"DC_XRF": BeamlineStateEnum.XrayFluorescence,
"MANUAL_SAMPLE_EXCHANGE": BeamlineStateEnum.SampleExchange,
"BEAM_VISUALISATION": BeamlineStateEnum.BeamLocation,
"FLUX_MEASUREMENT": BeamlineStateEnum.FluxMeasurement,
"BEAMSTOP_ALIGNMENT": BeamlineStateEnum.BeamstopAlignment,
"MAINTENANCE": BeamlineStateEnum.Maintenance,
"XTAL_SNAPSHOT": BeamlineStateEnum.XtalSnapshot,
}
if bec_state in map:
return map[bec_state]
logger.warning(f"No match for state: {bec_state}")
return BeamlineStateEnum.Maintenance
@@ -138,9 +139,12 @@ class BECClientWorker:
if self.planner is None:
return BeamlineStateEnum.Maintenance
matching_states = self.planner.current_state()
if matching_states is None or len(matching_states) > 1:
if matching_states is None or len(matching_states) < 1:
return BeamlineStateEnum.Maintenance
return _bec_state_to_aare_state(matching_states[0])
logger.debug(f"BEC planner returned matching states: {matching_states}")
current_state = _bec_state_to_aare_state(matching_states[0][0])
logger.info(f"Current state detected from BEC: {current_state}")
return current_state
def _bec_error(
self, exc: Exception, *, operation: str, tags: list[str] | None = None
+1 -1
View File
@@ -232,7 +232,7 @@ class SimpleRotationSettingsPanel(QWidget):
self._d = s
# TODO only update best_res after raster finished otherwise ask to update. or have toggle to overwrite with user value
# TODO only take best res from flat face scan
# TODO identify flat face!!!!
# TODO identify flat face!
best_res = s.last_best_res
self._omega = s.geom.omega_deg