Files
sf-op/script/test/test_didier.py
2025-01-14 16:18:27 +01:00

33 lines
1.2 KiB
Python

import ch.psi.pshell.epics.Positioner as Positioner
import ch.psi.pshell.epics.ChannelDouble as ChannelDouble
station = "STEST01" # define param locally
bpm_ch = "SARCL02-DBPM110"
bpm_field = "X1"
run("RFscan/phase_scan_data.py")
x_bpm = ChannelDouble("BPM-X averager", bpm_ch + ":" + bpm_field)
start = caget(station + "-RSYS:SET-SCAN-START")
end = caget(station + "-RSYS:SET-SCAN-STOP")
step = caget(station + "-RSYS:SET-SCAN-STEP")
lat = caget(station + "-RSYS:SET-SCAN-WAIT-TIME")
nb = caget(station + "-RSYS:SET-NUM-AVERAGE")
disp = caget(bpm_ch + ":DISPERSION-OP")
p0 = caget(bpm_list[bpm_ch]["mbnd"] + ":P-READ")
energy0 = p0 - 0.511
A, B = energy0 / (disp * 1000), energy0
phase = Positioner("Phase", station + "-RSYS:SET-VSUM-PHASE", station + "-RSYS:GET-VSUM-PHASE")
phase.config.minValue = -90.0
phase.config.maxValue = 360.0
phase.config.precision = 4
phase.config.resolution = 0.3
phase.config.rotation = True
phase.initialize()
show_panel(phase)
V = ChannelDouble(station + " Amplitude", station + "-RSYS:GET-VSUM-AMPLT")
P = ChannelDouble(station + " Klystron Power", station + "-RSYS:GET-KLY-POWER-GATED")
V.initialize()
P.initialize()
x_bpm.initialize()
phase0 = phase.read()
print(phase0)