BEC: added in additooanl functionality and a potential way to do states mimicking workflows - would move to workflows.py
This commit is contained in:
1 parent
a9a6f71005
commit
774f86765c
1 file changed
+34
-4
@@ -18,14 +18,14 @@ class BECClientWorker:
|
||||
self.client = BECClient(config=service_config, name=name)
|
||||
self.client.start()
|
||||
#self.client.config.update_session_with_file("/sls/x10sa/config/bec/production/bec/bec_lib/bec_lib/config_helper.py")
|
||||
self.devs = self.client.device_manager.devices
|
||||
self.dev = self.client.device_manager.devices
|
||||
self.scans = self.client.scans
|
||||
self.macros = self.client.macros
|
||||
self.load_user_macros()
|
||||
self.helper = FrontendProcedureHelper(self.client.connector)
|
||||
|
||||
def run_macro(self, macro_name:str, *args, queue:str = "default", **kwargs):
|
||||
return self.client.proc.run_macro(macro_name, *args, "iln", queue=queue)
|
||||
return self.client.proc.run_macro(macro_name, *args, queue=queue)
|
||||
|
||||
def run_macro_blocked(self, macro_name:str, *args, queue:str = "default", **kwargs):
|
||||
try:
|
||||
@@ -39,7 +39,7 @@ class BECClientWorker:
|
||||
return None
|
||||
|
||||
def show_all_devices(self):
|
||||
return self.devs.show_all
|
||||
return self.dev.show_all
|
||||
|
||||
def list_all_macros(self):
|
||||
return self.macros.list_user_macros()
|
||||
@@ -50,13 +50,43 @@ class BECClientWorker:
|
||||
def shutdown_client(self):
|
||||
self.client.shutdown()
|
||||
|
||||
def common2rse(self):
|
||||
status = self.scans.umv(dev.blight_pos, 0, relative=False)
|
||||
try:
|
||||
SE.blpos.checkpos()
|
||||
except NotImplemented as e:
|
||||
print(f"Backlight position not checked: {e}")
|
||||
print(f"Moved backlight to position {self.dev.blight_pos.read()} with status {status.status}")
|
||||
self.scans.umv(dev.bs_z, 72.0, dev.coll_y, 20.0, dev.scin_y, 20.0, dev.cryo_pos, 1, relative=False)
|
||||
self.scans.umv(dev.bs_pos, 0, relative=False)
|
||||
print(f"Moved everything else to park position with status {status.status}")
|
||||
|
||||
if self.dev.bs_z.read().value != 72.0:# or self.dev.coll_y.read() != 20.0 or self.dev.scin_y.read() != 20.0:
|
||||
print(f"is bs_z correct: {self.dev.bs_z.read().value != 72.0}")# is coll_y correct {self.dev.coll_y.read() != 20.0}, is scin_y correct {self.dev.scin_y.read() != 20.0}")
|
||||
raise Exception("Error: something went wrong")
|
||||
|
||||
def rse2sa(self):
|
||||
self.scans.umv(self.dev.blight_pos, 1, relative=False)
|
||||
self.scans.umv(self.dev.bs_pos, 1, relative = False)
|
||||
|
||||
# def a2e_runner(self, a, *hkl):
|
||||
# return a2e(a, *hkl)
|
||||
|
||||
if __name__ == "__main__":
|
||||
import time
|
||||
service_config = ServiceConfig(redis={"host": "x10sa-bec-001.psi.ch", "port": 6379})
|
||||
client = BECClientWorker(service_config, "default")
|
||||
client.show_all_devices()
|
||||
client.list_all_macros()
|
||||
try:
|
||||
client.run_macro_blocked("a2e", 160, "iln", queue="test")
|
||||
#a=client.a2e_runner(160, "iln")
|
||||
#print(a)
|
||||
#b=client.run_macro_blocked("a2e", 160, "iln", queue="test")
|
||||
#b = client.run_macro_blocked("mono_pitch_scan", False, queue="test")
|
||||
client.rse2sa()
|
||||
time.sleep(10.0)
|
||||
client.common2rse()
|
||||
#print(b)
|
||||
except Exception as e:
|
||||
print(f"Error: {e}")
|
||||
client.shutdown_client()
|
||||
|
||||
Reference in new issue
Block a user