Script execution
This commit is contained in:
@@ -23,34 +23,27 @@ phase.config.maxValue = 180.0
|
||||
phase.config.resolution = 0.25
|
||||
phase.initialize()
|
||||
|
||||
#my_camtool = Camtool("localhost:10000")
|
||||
|
||||
#Testing if camtool server is up:
|
||||
#camtool.getCameras()
|
||||
|
||||
#
|
||||
check_camtool()
|
||||
camtool.start("SINBD01-DSCR010")
|
||||
|
||||
#x = Channel("SINEG01-DSCR190:X-SIM", type = 'd', alias='SCR-X')
|
||||
#dx = Channel("SINEG01-DSCR190:DX-SIM", type = 'd', alias='SCR-DX')
|
||||
x = CamtoolValue("gr_x_fit_mean")
|
||||
dx = CamtoolValue("gr_x_fit_standard_deviation")
|
||||
#x = CamtoolValue("gr_x_com_egu")
|
||||
#dx = CamtoolValue("gr_x_rms_egu")
|
||||
while camtool.stream.getChild("gr_x_fit_mean") == None:
|
||||
time.sleep(0.1)
|
||||
|
||||
|
||||
x = camtool.stream.getChild("gr_x_fit_mean")
|
||||
dx = camtool.stream.getChild("gr_x_fit_standard_deviation")
|
||||
|
||||
|
||||
try:
|
||||
xb = create_averager(x, nb, 0.100)
|
||||
set_device_alias(xb, "gr_x_fit_mean")
|
||||
dxb = create_averager(dx, nb, 0.100)
|
||||
set_device_alias(dxb, "gr_x_fit_standard_deviation")
|
||||
xb = create_averager(x, nb, -1)
|
||||
dxb = create_averager(dx, nb, -1)
|
||||
dxb.monitored=True # not blocking, will return last nb values
|
||||
r = lscan(phase, [xb, dxb], start, stop, step , latency=lat)
|
||||
rf_phase = r.getPositions(0)
|
||||
E = [energy0 * (1 + val.mean / 1e6 / disp) for val in r.getReadable(0)]
|
||||
dE = [energy0 * (val.mean / 1e6 / disp) for val in r.getReadable(1)]
|
||||
finally:
|
||||
phase.close()
|
||||
#my_camtool.close()
|
||||
|
||||
p = plot(None, title="Output")[0]
|
||||
p.clear()
|
||||
@@ -59,4 +52,3 @@ p.addSeries(LinePlotSeries("Energy spread"))
|
||||
p.getSeries(0).setData(to_array(rf_phase, 'd'), E)
|
||||
p.getSeries(1).setData(to_array(rf_phase, 'd'), dE)
|
||||
p.setLegendVisible(True)
|
||||
#plot((E, dE), xdata = rf_phase, title="Phase scan")
|
||||
|
||||
Reference in New Issue
Block a user