Skip to content
Snippets Groups Projects
pydeviceCRL.cmd 2.2 KiB
Newer Older
mwyman's avatar
mwyman committed
################################################################################
# PyDevice Support for Transfocator
################################################################################

mwyman's avatar
mwyman committed
# Next two lines set up some testing tools for energy -- can be commented out 
epicsEnvSet("MONOE","testMonoE")
dbLoadRecords("${TOP}/db/energyTestTools.db","P=$(PREFIX), MONOE=$(MONOE), IDENERGY=testIDE")

mwyman's avatar
mwyman committed
# CRL DBs and defining substitution file to get stack properties
mwyman's avatar
mwyman committed
dbLoadTemplate("substitutions/pyDeviceTfor.substitutions","P=$(PREFIX)")
mwyman's avatar
mwyman committed
pydev("stack_subFile = 'substitutions/pyDeviceTfor.substitutions'")
mwyman's avatar
mwyman committed

mwyman's avatar
mwyman committed
# Import Transfocator class
mwyman's avatar
mwyman committed
pydev("from pyTransfocator_single import singleTF")

mwyman's avatar
mwyman committed
# Set up beam properties -- these may only need to be set up at creation of IOC
# energy	 - energy in keV (can be updated after boot-time)
# L_und      - Undulator length in m
# sigmaH_e   - Sigma electron source size in H direction in m
# sigmaV_e   - Sigma electron source size in V direction in m
# sigmaHp_e  - Sigma electron divergence in H direction in rad
# sigmaVp_e  - Sigma electron divergence in V direction in rad
pydev("b_properties = {'energy': 15, 'L_und':4.7, 'sigmaH_e':14.8e-6, 'sigmaV_e':3.7e-6, 'sigmaHp_e':2.8e-6, 'sigmaVp_e':1.5e-6})
mwyman's avatar
mwyman committed

mwyman's avatar
mwyman committed
# Set up beamline properties -- these may only need to be set up at creation of IOC
#
#
pydev("bl_properties = {'':,'':,'':}

# Set up crl properties -- these are properties common to the stacks
# 
#
#
pydev("crl_properties = {'':,'':,'':}

# Create Transfocator object
pydev("CRL1 = singleTF(beam = b_properties, bl = bl_properties, crl = crl_properties)")
mwyman's avatar
mwyman committed

# Update the next line for the beamline energy
epicsEnvSet("BLE","$(PREFIX)$(MONOE)")
mwyman's avatar
mwyman committed
# DB for Transfocator system
dbLoadRecords(""${TOP}/db/pyDevCRLsingle.db","P=$(PREFIX), N=1, OBJ=CRL1, STACK_THICK=0.050, MIN_THICK=0.003")
mwyman's avatar
mwyman committed

# After iocInit, need to setup attenuation lookup table
mwyman's avatar
mwyman committed
# 	stack_subFile - string holding name/rel. location of substitutions file loaded
mwyman's avatar
mwyman committed
#                     loaded in  dbLoadTemplate
mwyman's avatar
mwyman committed
#   12  - number of lenses in this case
mwyman's avatar
mwyman committed
# 	8.5 - beam energy in keV used for the initial lookup table setup -- can be updated
#          after startup
mwyman's avatar
mwyman committed
doAfterIocInit("pydev('CRL1.setupLookupTable(stack_subFile, 12, energy = 8.5)')")