Script execution

This commit is contained in:
voulot_d
2017-01-09 15:55:50 +01:00
parent 1e722ae6a5
commit 5fa9e8f490
+22 -7
View File
@@ -1,7 +1,23 @@
import ch.psi.pshell.epics.ControlledVariable as ControlledVariable
if get_context().source != CommandSource.ui:
prefix = args[0] + "-RSYS"
latency = 0.05
if get_context().source == CommandSource.ui:
prefix = "SINSB04-RSYS"
start = -170.0
stop = 180.0
step = 10.0
else:
prefix = args[0]
start = caget("PSHELL:scanstart")
stop = caget("PSHELL:scanstop")
step = caget("PSHELL:scanstep")
print "Prefix = ", prefix
print "Start = ", start
print "Stop = ", stop
print "Step = ", step
start = caget(prefix + ":SET-SCAN-START")
stop = caget(prefix + ":SET-SCAN-STOP")
@@ -9,18 +25,18 @@ step = caget(prefix + ":SET-SCAN-STEP")
lat = caget(prefix + ":SET-SCAN-WAIT-TIME")
nb = caget(prefix + ":SET-NUM-AVERAGE")
bpm_ch = caget(prefix + ":DBPM")
disp = caget(bpm_ch + ":DISP")
disp = caget(bpm_ch + ":DISPERSION")
energy0 = caget(bpm_ch + ":ENERGY")
rf_phase_var = ControlledVariable("Phase", prefix + ":SET-VSUM-PHASE", prefix + ":SET-VSUM-PHASE")
rf_phase_var = ControlledVariable("Phase", prefix + ":SET-VSUM-PHASE-SIM", prefix + ":SET-VSUM-PHASE-SIM")
rf_phase_var.config.minValue =-45.0
rf_phase_var.config.maxValue = 360.0
rf_phase_var.config.resolution = 0.5
rf_phase_var.initialize()
rf_ampl_rbk = Channel(prefix + ":GET-VSUM-AMPLT", type = 'd', alias='Amplitude Readback')
rf_ampl_rbk = Channel(prefix + ":GET-VSUM-AMPLT-SIM", type = 'd', alias='Amplitude Readback')
rf_ampl_rbk.write(1.0)
rf_power_rbk = Channel(prefix + ":GET-KLY-POWER", type = 'd', alias='Power Readback')
rf_power_rbk = Channel(prefix + ":GET-KLY-POWER-SIM", type = 'd', alias='Power Readback')
bpm_x = Channel(bpm_ch + ":X1", type = 'd', alias='BPM-X')
@@ -46,7 +62,6 @@ try:
energy = [x/1000.0/disp*energy0 for x in r.getReadable(1)]
caput(prefix + ":GET-ENERGY-ARRAY", to_array(energy,'d'))
caput(prefix + ":GET-PHASE-ARRAY", to_array(rf_phase,'d'))
phase_fit_max = None
try: