Script execution

This commit is contained in:
voulot_d
2017-01-13 09:03:40 +01:00
parent dc46d38690
commit 262156f855

View File

@@ -16,6 +16,7 @@ nb = caget(prefix + ":SET-NUM-AVERAGE")
bpm_ch = caget(prefix + ":DBPM")
disp = caget(bpm_ch + ":DISPERSION")
energy0 = caget(bpm_ch + ":ENERGY")
#energy0 = caget("SINSB04-RACC100:ENERGY")
rf_phase_var = ControlledVariable("Phase", prefix + ":SET-VSUM-PHASE-SIM", prefix + ":GET-VSUM-PHASE-SIM")
rf_phase_var.config.minValue =-45.0
@@ -26,8 +27,8 @@ rf_phase_var.initialize()
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-SIM", type = 'd', alias='Power Readback')
#bpm_x = Channel(bpm_ch + ":X1-SIMU", type = 'd', alias='BPM-X')
bpm_x = Channel("SINSB04-RSYS:BPM-X1-SIM", type = 'd', alias='BPM-X')
bpm_x = Channel(bpm_ch + ":X1-SIMU", type = 'd', alias='BPM-X')
#bpm_x = Channel("SINSB04-RSYS:BPM-X1-SIM", type = 'd', alias='BPM-X')
caput(prefix + ":GET-FIT-PHASE-ARRAY", to_array([0.0],'d'))
@@ -45,6 +46,7 @@ def after(rec):
arr_energy.append(rec.values[1]/1000.0/disp*energy0)
caput(prefix + ":GET-ENERGY-ARRAY", to_array(arr_energy,'d'))
caput(prefix + ":GET-PHASE-ARRAY", to_array(arr_phase,'d'))
try:
r = lscan(rf_phase_var, [rf_ampl_rbk, bpm_x], start, stop, step , latency=lat, after_read = after)
@@ -80,7 +82,7 @@ print ("------------------------------------")
print ("Valid fit")
energy_gain = energy_max
phase_offset = - phase_fit_max
phase_offset = 90 - phase_fit_max
amplitude_scale = energy_gain / ampl
power_scale = power / math.pow(ampl,2)