Fix/beamline debugging 260827 #179
@@ -486,7 +486,7 @@ class RasterService:
|
||||
|
||||
com = raster_highest_score(scan_result.images)
|
||||
if com is None:
|
||||
self.logger.info("Calcualted COM is None using centre image")
|
||||
self.logger.info("Calcualted COM is None -> using centre image")
|
||||
if request.n_x == 1:
|
||||
x = request.grid_size_mm.x / 2.0
|
||||
else:
|
||||
@@ -515,7 +515,7 @@ class RasterService:
|
||||
),
|
||||
)
|
||||
else:
|
||||
self.logger.info("Calcualted COM is not None, procedding")
|
||||
self.logger.info("Calcualted COM is not None, proceeding")
|
||||
target_coor = com.get_com_mm(request)
|
||||
target_coor_offset = self.ctx.sample_geometry.smargon_nudge(target_coor)
|
||||
self.logger.info(
|
||||
|
||||
@@ -50,21 +50,21 @@ 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,
|
||||
"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 +138,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
|
||||
|
||||
@@ -277,10 +277,20 @@ class JFJochWrapper:
|
||||
|
||||
@needs_init
|
||||
def wait_till_running(self, timeout: float = 60):
|
||||
logger.info("Waiting for JFJoch to report detector armed")
|
||||
if self._simulated:
|
||||
return None
|
||||
try:
|
||||
self._api.wait_until_running_post_with_http_info(timeout=math.ceil(timeout))
|
||||
status = self._api.status_get()
|
||||
logger.debug(status)
|
||||
if status.message_severity == "error":
|
||||
raise self._jfjoch_error(
|
||||
f"JFJoch status message has error severity after waiting for arm: {status.message}",
|
||||
error=RuntimeError(status.message),
|
||||
operation="POST",
|
||||
endpoint="wait_until_running_post",
|
||||
)
|
||||
return True
|
||||
except Exception as e:
|
||||
raise self._jfjoch_error(
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -877,7 +877,6 @@ class SampleCameraImageLabel(QGraphicsView):
|
||||
case SampleCameraImageState.IDLE:
|
||||
point = self.mapToScene(event.pos())
|
||||
if not self.scene.sceneRect().contains(point):
|
||||
logger.error("Point is outside scene bounds")
|
||||
return
|
||||
|
||||
if event.modifiers() & Qt.KeyboardModifier.ShiftModifier:
|
||||
|
||||
Reference in New Issue
Block a user