Newer
Older
################################################################################
# PyDevice Support for Transfocator
################################################################################
# Next two lines set up some testing tools for energy and slits
epicsEnvSet("IDENERGY","testIDE")
dbLoadRecords("${TOP}/db/energyTestTools.db","P=$(PREFIX), MONOE=$(MONOE), IDENERGY=$(IDENERGY)")
dbLoadRecords("${TOP}/db/slitTestTools.db","P=$(PREFIX), SLITH=testSSH, SLITV=testSSV")
# Setting some variables beamline-dependent PVs
epicsEnvSet('_SLITH',"$(PREFIX)testSSH") # Horizontal size of slit PV before CRL
epicsEnvSet('_SLITV',"$(PREFIX)testSSV") # Vertical size of slit PV before CRL
epicsEnvSet("BLE","$(PREFIX)$(MONOE)") # Beam energy PV at CRL
# CRL DBs and defining substitution file to get stack properties
dbLoadTemplate("substitutions/pyDeviceTfor.substitutions","P=$(PREFIX)")
pydev("stack_subFile = 'substitutions/pyDeviceTfor.substitutions'")
pydev("CRL1 = singleTF(crl_setup = 'crl_setup.toml')")
dbLoadRecords(""${TOP}/db/pyDevCRLsingle.db","P=$(PREFIX), N=$(_N), OBJ=CRL1, KEV=$(BLE), SLITH = $(_SLITH), SLITV = $(_SLITV)")
################################################################################
# After iocInit, need to setup focal size lookup table -- because setting slit
# sizes and energy causes the table to be recalculated, will first disable
# lookup table calc PV, set the slit sizes and energy, calculate the table
# directly via python call, then enable calc PV so future slit/energy changes
# update the lookup table
# Disable calc of lookup table
doAfterIocInit("dbpf('$(PREFIX)CRL$(_N):recalc_enable','0')") # Disable table calc
# Process current slit and energy PV settings
doAfterIocInit("dbpf('$(PREFIX)CRL$(_N):slitSize_H.PROC','1')") # PROC H slit size read and update CRL1 object
doAfterIocInit("dbpf('$(PREFIX)CRL$(_N):slitSize_V.PROC','1')") # PROC V slit size read and update CRL1 object
doAfterIocInit("dbpf('$(PREFIX)CRL$(_N):energy.PROC','1')") # PROC energy read and update CRL1 object
# Calc lookup table via python; later re-calculations started via EPICS (changes to energy, slits)
# stack_subFile - string holding name/rel. location of substitutions file loaded
doAfterIocInit("pydev('CRL1.setupLookupTable(stack_subFile, $(_STACKS)')")
# Enable lookup table calc PV
doAfterIocInit("dbpf('$(PREFIX)CRL$(_N):recalc_enable','1')") # Enable table calc
################################################################################