workflows: refactored to use daq move_to fucntion wrapper of planner move to function
This commit is contained in:
+23
-17
@@ -51,7 +51,7 @@ def common_2rse(devs: BeamlineDevices, cfg: BeamlineConfig):
|
||||
#print('move cryo to park')
|
||||
#devs.__cryojet_pos = StagePositionEnum.PARK
|
||||
else:
|
||||
devs.bec_worker.planner.move_to(BeamlineState.ROBOT_SAMPLE_EXCHANGE)
|
||||
devs.bec_worker.move_to(BeamlineState.ROBOT_SAMPLE_EXCHANGE)
|
||||
print('move smargon home')
|
||||
devs.smargon_move_home()
|
||||
print('try to move aerotech')
|
||||
@@ -64,7 +64,7 @@ def rse2se(devs: BeamlineDevices, cfg: BeamlineConfig):
|
||||
|
||||
def m2se(devs: BeamlineDevices, cfg: BeamlineConfig):
|
||||
devs.samcam_auto(AutoEnum.AUTO)
|
||||
devs.bec_worker.planner.move_to(BeamlineState.MANUAL_SAMPLE_EXCHANGE)
|
||||
devs.bec_worker.move_to(BeamlineState.MANUAL_SAMPLE_EXCHANGE)
|
||||
logger.info(f"moved to sample exchange, now moving to {cfg.abr_meas_pos}")
|
||||
devs.aerotech_pos = cfg.abr_meas_pos
|
||||
devs.smargon_move_home()
|
||||
@@ -72,13 +72,13 @@ def m2se(devs: BeamlineDevices, cfg: BeamlineConfig):
|
||||
|
||||
def m2sa(devs: BeamlineDevices, cfg: BeamlineConfig):
|
||||
devs.samcam_auto(AutoEnum.AUTO)
|
||||
devs.bec_worker.planner.move_to(BeamlineState.SAMPLE_ALIGNMENT)
|
||||
devs.bec_worker.move_to(BeamlineState.SAMPLE_ALIGNMENT)
|
||||
devs.samcam_auto(AutoEnum.ONCE)
|
||||
|
||||
def sa2se(devs: BeamlineDevices, cfg: BeamlineConfig):
|
||||
try:
|
||||
devs.samcam_auto(AutoEnum.AUTO)
|
||||
devs.bec_worker.planner.move_to(BeamlineState.MANUAL_SAMPLE_EXCHANGE)
|
||||
devs.bec_worker.move_to(BeamlineState.MANUAL_SAMPLE_EXCHANGE)
|
||||
logger.info(f"moved to sample exchange, now moving to {cfg.abr_meas_pos}")
|
||||
devs.aerotech_pos = cfg.abr_meas_pos
|
||||
devs.smargon_move_home()
|
||||
@@ -96,22 +96,22 @@ def sa2xtal_snapshot(devs:BeamlineDevices, cfg:BeamlineConfig):
|
||||
logger.info("SA to Xtal Snapshot")
|
||||
devs.samcam_settings = SampleCameraSettings(gain=0.0, exposure=0.0005)
|
||||
logger.debug(f"new sam cam settings: {devs.samcam_settings}")
|
||||
devs.bec_worker.planner.move_to(BeamlineState.XTAL_SNAPSHOT)
|
||||
devs.bec_worker.move_to(BeamlineState.XTAL_SNAPSHOT)
|
||||
|
||||
def dc2xtal_snapshot(devs:BeamlineDevices, cfg:BeamlineConfig):
|
||||
logger.debug("DC to Xtal Snapshot")
|
||||
devs.samcam_settings = SampleCameraSettings(gain=0.0, exposure=0.0005)
|
||||
logger.debug(f"new sam cam settings: {devs.samcam_settings}")
|
||||
devs.bec_worker.planner.move_to(BeamlineState.XTAL_SNAPSHOT)
|
||||
devs.bec_worker.move_to(BeamlineState.XTAL_SNAPSHOT)
|
||||
|
||||
def xtal_snapshot2dc(devs:BeamlineDevices, cfg:BeamlineConfig):
|
||||
devs.samcam_auto(AutoEnum.AUTO)
|
||||
devs.bec_worker.planner.move_to(BeamlineState.DATA_COLLECTION)
|
||||
devs.bec_worker.move_to(BeamlineState.DATA_COLLECTION)
|
||||
devs.samcam_auto(AutoEnum.ONCE)
|
||||
|
||||
def xtal_snapshot2sa(devs:BeamlineDevices, cfg:BeamlineConfig):
|
||||
devs.samcam_auto(AutoEnum.AUTO)
|
||||
devs.bec_worker.planner.move_to(BeamlineState.SAMPLE_ALIGNMENT)
|
||||
devs.bec_worker.move_to(BeamlineState.SAMPLE_ALIGNMENT)
|
||||
devs.samcam_auto(AutoEnum.ONCE)
|
||||
|
||||
def xtal_snapshot2rse(devs:BeamlineDevices, cfg:BeamlineConfig):
|
||||
@@ -121,10 +121,10 @@ def xtal_snapshot2se(devs:BeamlineDevices, cfg:BeamlineConfig):
|
||||
sa2se(devs, cfg)
|
||||
|
||||
def xtal_snapshot2xrf(devs:BeamlineDevices, cfg:BeamlineConfig):
|
||||
devs.bec_worker.planner.move_to(BeamlineState.FLUX_MEASUREMENT)
|
||||
devs.bec_worker.move_to(BeamlineState.FLUX_MEASUREMENT)
|
||||
|
||||
def xtal_snapshot2bl(devs: BeamlineDevices, cfg: BeamlineConfig):
|
||||
devs.bec_worker.planner.move_to(BeamlineState.BEAM_VISUALISATION)
|
||||
devs.bec_worker.move_to(BeamlineState.BEAM_VISUALISATION)
|
||||
|
||||
def xtal_snapshot2dh(devs: BeamlineDevices, cfg: BeamlineConfig):
|
||||
xtal_snapshot2sa(devs,cfg)
|
||||
@@ -135,7 +135,7 @@ def dc2rse(devs: BeamlineDevices, cfg: BeamlineConfig):
|
||||
|
||||
def se2sa(devs: BeamlineDevices, cfg: BeamlineConfig):
|
||||
devs.samcam_auto(AutoEnum.AUTO)
|
||||
devs.bec_worker.planner.move_to(BeamlineState.SAMPLE_ALIGNMENT)
|
||||
devs.bec_worker.move_to(BeamlineState.SAMPLE_ALIGNMENT)
|
||||
devs.aerotech_pos = cfg.abr_meas_pos
|
||||
devs.samcam_auto(AutoEnum.ONCE)
|
||||
|
||||
@@ -149,9 +149,15 @@ def sa2dc(devs: BeamlineDevices, cfg: BeamlineConfig):
|
||||
if not det_z_pos:
|
||||
logger.error("Detector Z position not set, defaulting to 170")
|
||||
det_z_pos = 170
|
||||
cfg.dtz = 170
|
||||
if det_z_pos and det_z_pos < 170:
|
||||
logger.warning(f"Detector Z position is less than 170: {det_z_pos}, setting to 170")
|
||||
det_z_pos = 170
|
||||
cfg.dtz = 170
|
||||
if det_z_pos and det_z_pos > 1200:
|
||||
logger.warning(f"Detector Z position is greater than 1200: {det_z_pos}, setting to 1200")
|
||||
det_z_pos = 1200
|
||||
cfg.dtz = 1200
|
||||
status = devs.bec_worker.det_z(value=det_z_pos)
|
||||
logger.info(f"start detector move to {cfg.dtz} at {time.perf_counter() - start:.2f}")
|
||||
devs.samcam_auto(AutoEnum.AUTO)
|
||||
@@ -168,7 +174,7 @@ def dc2sa(devs: BeamlineDevices, cfg: BeamlineConfig):
|
||||
if cfg.dtz and cfg.dtz < SAFE_POSITION:
|
||||
status = devs.bec_worker.det_z(value=SAFE_POSITION)
|
||||
devs.samcam_auto(AutoEnum.AUTO)
|
||||
devs.bec_worker.planner.move_to(BeamlineState.SAMPLE_ALIGNMENT)
|
||||
devs.bec_worker.move_to(BeamlineState.SAMPLE_ALIGNMENT)
|
||||
devs.aerotech_pos = cfg.abr_meas_pos
|
||||
if hasattr(status, "wait"):
|
||||
status.wait(timeout=60)
|
||||
@@ -177,7 +183,7 @@ def dc2sa(devs: BeamlineDevices, cfg: BeamlineConfig):
|
||||
def sa2xrf(devs: BeamlineDevices, cfg: BeamlineConfig):
|
||||
"""sample alignment to XrfCollection"""
|
||||
devs.samcam_auto(AutoEnum.AUTO)
|
||||
devs.bec_worker.planner.move_to(BeamlineState.FLUX_MEASUREMENT)
|
||||
devs.bec_worker.move_to(BeamlineState.FLUX_MEASUREMENT)
|
||||
devs.samcam_auto(AutoEnum.ONCE)
|
||||
|
||||
def xrf2sa(devs: BeamlineDevices, cfg: BeamlineConfig):
|
||||
@@ -201,11 +207,11 @@ def ba2sa(devs: BeamlineDevices, cfg: BeamlineConfig):
|
||||
pass
|
||||
|
||||
def sa2bl(devs: BeamlineDevices, cfg: BeamlineConfig):
|
||||
devs.bec_worker.planner.move_to(BeamlineState.BEAM_VISUALISATION)
|
||||
devs.bec_worker.move_to(BeamlineState.BEAM_VISUALISATION)
|
||||
devs.samcam_settings.exposure = 0.001
|
||||
|
||||
def bl2sa(devs: BeamlineDevices, cfg: BeamlineConfig):
|
||||
devs.bec_worker.planner.move_to(BeamlineState.SAMPLE_ALIGNMENT)
|
||||
devs.bec_worker.move_to(BeamlineState.SAMPLE_ALIGNMENT)
|
||||
devs.samcam_auto(AutoEnum.ONCE)
|
||||
|
||||
def bl2ba(devs: BeamlineDevices, cfg: BeamlineConfig):
|
||||
@@ -230,10 +236,10 @@ def common2dh(devs: BeamlineDevices, cfg: BeamlineConfig):
|
||||
devs.tell.dry(wait_cold=-1, wait=False)
|
||||
|
||||
def dh2sa(devs: BeamlineDevices, cfg: BeamlineConfig):
|
||||
devs.bec_worker.planner.move_to(BeamlineState.SAMPLE_ALIGNMENT)
|
||||
devs.bec_worker.move_to(BeamlineState.SAMPLE_ALIGNMENT)
|
||||
|
||||
def common2maintenance(devs: BeamlineDevices, cfg: BeamlineConfig):
|
||||
devs.bec_worker.planner.move_to(BeamlineState.MAINTENANCE)
|
||||
devs.bec_worker.move_to(BeamlineState.MAINTENANCE)
|
||||
|
||||
if __name__ == "__main__":
|
||||
from aare.common.beamline import mx_beamline
|
||||
|
||||
Reference in New Issue
Block a user