Files
sf-op/script/Tools/BunchLengthRestore.py
2025-08-13 10:42:02 +02:00

38 lines
963 B
Python

#Parameters
is_panel = get_exec_pars().source != CommandSource.ui # run from panel
if is_panel:
tds = args[0]
else:
tds = "S30CB14"
run("Tools/BunchLengthTDSdata.py")
# stop the beam
if tds == "SATMA02":
caput("SIN-TIMAST-TMA:Bunch-2-OnDelay-Sel", 1)
caput("SIN-TIMAST-TMA:Beam-Apply-Cmd.PROC", 1)
else:
caput("SIN-TIMAST-TMA:Beam-RF-OnDelay-Sel", 1)
caput("SIN-TIMAST-TMA:Beam-Apply-Cmd.PROC", 1)
# collimators
if tds == "S30CB14":
try:
caputq("SARCL02-VCOL290:GAP", gap_init[0])
except:
print("gap_init not defined")
# restore nominal optics
quads = tds_data[tds]["quads"]
try:
for i in range(len(quads)):
caput(quads[i] + ":I-SET", i_set_init[i])
caput(quads[i] + ":CYCLE", 2)
except:
print("i_set_init not defined")
#switch BLMs on
blm = tds_data[tds]["BLM"]
for i in range(len(blm)):
caput(blm[i] + ":B1_ROI_ACTIVE_OP", 1)
caput(blm[i] + ":B2_ROI_ACTIVE_OP", 1)