diff --git a/csaxs_bec/bec_ipython_client/plugins/flomni/x_ray_eye_align.py b/csaxs_bec/bec_ipython_client/plugins/flomni/x_ray_eye_align.py index fc7b954..f02bf19 100644 --- a/csaxs_bec/bec_ipython_client/plugins/flomni/x_ray_eye_align.py +++ b/csaxs_bec/bec_ipython_client/plugins/flomni/x_ray_eye_align.py @@ -7,7 +7,7 @@ from typing import TYPE_CHECKING from bec_lib import bec_logger -from csaxs_bec.bec_ipython_client.plugins.cSAXS import epics_get, epics_put, fshopen +from csaxs_bec.bec_ipython_client.plugins.cSAXS import epics_get, epics_put, fshopen, fshclose logger = bec_logger.logger # import builtins to avoid linter errors @@ -22,6 +22,7 @@ if TYPE_CHECKING: class XrayEyeAlign: # pixel calibration, multiply to get mm + labview=False PIXEL_CALIBRATION = 0.1 / 113 # .2 with binning def __init__(self, client, flomni: Flomni) -> None: @@ -41,26 +42,29 @@ class XrayEyeAlign: epics_put("XOMNYI-XEYE-SAVFRAME:0", 1) def update_frame(self): - epics_put("XOMNYI-XEYE-ACQDONE:0", 0) + if self.labview: + epics_put("XOMNYI-XEYE-ACQDONE:0", 0) # start live epics_put("XOMNYI-XEYE-ACQ:0", 1) - # wait for start live - while epics_get("XOMNYI-XEYE-ACQDONE:0") == 0: - time.sleep(0.5) - print("waiting for live view to start...") + if self.labview: + # wait for start live + while epics_get("XOMNYI-XEYE-ACQDONE:0") == 0: + time.sleep(0.5) + print("waiting for live view to start...") fshopen() - epics_put("XOMNYI-XEYE-ACQDONE:0", 0) + if self.labview: + epics_put("XOMNYI-XEYE-ACQDONE:0", 0) - while epics_get("XOMNYI-XEYE-ACQDONE:0") == 0: - print("waiting for new frame...") - time.sleep(0.5) + while epics_get("XOMNYI-XEYE-ACQDONE:0") == 0: + print("waiting for new frame...") + time.sleep(0.5) time.sleep(0.5) # stop live view epics_put("XOMNYI-XEYE-ACQ:0", 0) - time.sleep(1) - # fshclose + time.sleep(0.1) + fshclose() print("got new frame") def tomo_rotate(self, val: float): @@ -152,11 +156,12 @@ class XrayEyeAlign: self.flomni.feedback_disable() umv(dev.fsamx, fsamx_in - 0.25) - self.update_frame() - epics_put("XOMNYI-XEYE-RECBG:0", 1) - while epics_get("XOMNYI-XEYE-RECBG:0") == 1: - time.sleep(0.5) - print("waiting for background frame...") + if self.labview: + self.update_frame() + epics_put("XOMNYI-XEYE-RECBG:0", 1) + while epics_get("XOMNYI-XEYE-RECBG:0") == 1: + time.sleep(0.5) + print("waiting for background frame...") umv(dev.fsamx, fsamx_in) time.sleep(0.5)