Files
sf-op/script/Diagnostics/BLM_ROI_finetune.py
2025-12-15 16:53:16 +01:00

19 lines
722 B
Python

# shift BLM ROI by desired offset in us and reinitialise ioc
blm = "SARCL01-DBLM195"
offset = 0.000 # us
ioc = caget(blm + ":PLL-LOCKED-OP-CALC.INPA").split()[0]
ioc = ioc.split(':')[0]
PIX = 2.33426704 # 1 / (124.8 MHz * 3) = 2.33426704 ns
evr = caget(blm + ":GPAC-DELAY-OP.INPA").split()[0]
delay = caget(evr)
start_b1 = int(caget(blm + ":B1_ROI_START"))
new_start_b1 = int(start_b1 + offset * 1000 / PIX)
print(blm, ioc, delay, offset, start_b1, new_start_b1)
caput(blm + ":B1_ROI_START", new_start_b1)
caput(blm + ":B1_ROI_STOP", new_start_b1 + 18)
caput(blm + ":B2_ROI_START", new_start_b1 + 19)
caput(blm + ":B2_ROI_STOP", new_start_b1 + 37)
print(ioc + ":SYSTEM-INIT.PROC", 1)
caput(ioc + ":SYSTEM-INIT.PROC", 1)