Files
x05la/script/local.py
gac-x05la 2a65e100ea Sessions
2021-05-20 15:42:59 +02:00

85 lines
2.8 KiB
Python

###################################################################################################
# Deployment specific global definitions - executed after startup.py
###################################################################################################
import ch.psi.fda.ProcessorFDA as ProcessorFDA
import ch.psi.pshell.crlogic.CrlogicPositioner as CrlogicPositioner
import ch.psi.pshell.crlogic.CrlogicSensor as CrlogicSensor
import ch.psi.pshell.epics.ChannelDouble as ChannelDouble
import ch.psi.pshell.epics.ChannelDoubleArray as ChannelDoubleArray
import ch.psi.pshell.epics.ChannelInteger as ChannelInteger
import ch.psi.pshell.epics.ChannelIntegerArray as ChannelIntegerArray
crlogic_config = {}
crlogic_config["class"] = "ch.psi.pshell.crlogic.CrlogicScan"
#crlogic_config["prefix"] = "X10DA-ES1-CRL"
#crlogic_config["ioc"] = "X10DA-VME-ES1"
#crlogic_config["integrationTime"] = 0.2
#crlogic_config["additionalBacklash"] = 0.01
run("CPython/wrapper")
DETECTORS={ \
'Eiger4m': {"path":"X05LA-ES1-EIGER1:cam1:FilePath", "enabled": False}, \
'XRayEye': {"path":"X05LA-ES2-GIGE01:TIFF1:FilePath", "enabled": False} \
}
###################################################################################################
# EPICS utilities
###################################################################################################
def caget_str(ch):
return ''.join((chr(i) if i else "") for i in caget(ch))
def caput_str(ch, val):
ret = [ord(c) for c in val]
ret = ret + ([0] * (256-len(ret)))
ret = to_array(ret, 'b')
caput(ch, ret)
###################################################################################################
# FDA utilities
###################################################################################################
def run_fda(file_name, arguments={}):
"""
Run FDA loop
"""
ProcessorFDA().execute(file_name,arguments)
###################################################################################################
# System callbaks
###################################################################################################
def on_command_started(info):
pass
def on_command_finished(info):
pass
def on_change_data_path(path):
if path is not None:
print "Data path: " + str(path)
raw_data_folder = path + "/raw_data"
os.makedirs(raw_data_folder)
#with open(raw_data_folder + "/test.txt", "w") as f:
# f.write("Success")
for name, info in DETECTORS.items():
log(name + " enabled = " + str(info["enabled"]))
if info["enabled"]:
channel_path = info["path"]
caput_str(channel_path, raw_data_folder + "/" + name)
def on_session_started(id):
pass
def on_session_finished(id):
pass