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

45 lines
1.3 KiB
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 and set rep. rate
if tds == "SATMA02":
caput("SIN-TIMAST-TMA:Bunch-2-OnDelay-Sel", 1)
caput("SIN-TIMAST-TMA:Beam-Apply-Cmd.PROC", 1)
caput("SIN-TIMAST-TMA:Bunch-2-Freq-Sel", 6) # 10 Hz
else :
caput("SIN-TIMAST-TMA:Beam-RF-OnDelay-Sel", 1)
caput("SIN-TIMAST-TMA:Beam-Apply-Cmd.PROC", 1)
caput("SIN-TIMAST-TMA:Bunch-1-Freq-Sel", 10) # 1 Hz
caput("SIN-TIMAST-TMA:Bunch-2-Freq-Sel", 10) # 1 Hz
# set mode and coll.
gap_init = []
if tds == "SINDI01":
caput("S10CB01-RSYS:REQUIRED-OP", 0)
caput("S10CB02-RSYS:REQUIRED-OP", 0)
caput("S10DI01-MBND100:P-SET", 297.0)
time.sleep(10.0)
if tds == "S30CB14":
caput("SARMA02-MBNP100:REQUEST", 1)
gap_init.append(caget("SARCL02-VCOL290:GAP"))
caputq("SARCL02-VCOL290:GAP", 8.0)
# switch BLMs off
blm = tds_data[tds]["BLM"]
for i in range(len(blm)):
caput(blm[i] + ":B1_ROI_ACTIVE_OP", 0)
caput(blm[i] + ":B2_ROI_ACTIVE_OP", 0)
# set optics
quads = tds_data[tds]["quads"]
k1l_meas = tds_data[tds]["K1L-meas"]
i_set_init = []
for i in range(len(quads)):
i_set_init.append(caget(quads[i] + ":I-SET"))
caput(quads[i] + ":K1L-SET", k1l_meas[i])