Script execution
This commit is contained in:
@@ -8,20 +8,32 @@
|
||||
# change the current of the gun soleoid
|
||||
# look at the centroid position (BPM or screen) downstream of the gun.
|
||||
|
||||
I_set = Channel("SINEG01-MSOL130:I-SET");
|
||||
I_get = Channel("SINEG01-MSOL130:I-READ")
|
||||
I_set = Channel("SINEG01-MSOL130:I-SET", alias = "I_set");
|
||||
I_get = Channel("SINEG01-MSOL130:I-READ", alias = "I_get")
|
||||
# cam_x, cam_y = ... # some camtool command / channel?
|
||||
bpm_x = Channel("SINEG01-DBPM340:X1")
|
||||
bpm_y = Channel("SINEG01-DBPM340:Y1")
|
||||
|
||||
cam_x = Channel("SINEG01-DSCR190:profile.X_stats.com")
|
||||
cam_y = Channel("SINEG01-DSCR190:profile.Y_stats.com")
|
||||
cam_x = Channel("SINEG01-DSCR190:profile.X_stats.com", alias = "cam_x")
|
||||
cam_y = Channel("SINEG01-DSCR190:profile.Y_stats.com", alias = "cam_y")
|
||||
cam_raw_data = Channel("SINEG01-DSCR190:data")
|
||||
|
||||
set_device_alias(I_set, "I_set")
|
||||
set_device_alias(I_get, "I_get")
|
||||
set_device_alias(cam_x, "cam_x")
|
||||
set_device_alias(cam_y, "cam_y")
|
||||
|
||||
class CameraImage(ReadableMatrix):
|
||||
def read(self):
|
||||
raw = cam_raw_data.read()
|
||||
ret = []
|
||||
for i in range (self.getHeight()):
|
||||
ret.append(raw[i*self.getWidth() : (i+1)*self.getWidth()])
|
||||
return ret
|
||||
|
||||
def getWidth(self):
|
||||
return 480
|
||||
|
||||
def getHeight(self):
|
||||
return 640
|
||||
|
||||
cam_img = CameraImage()
|
||||
|
||||
|
||||
def ccr(mag):
|
||||
@@ -50,6 +62,7 @@ def run_pipeline():
|
||||
I1 = 20.0
|
||||
I2 = 150.0
|
||||
dI = 1.0
|
||||
settling_time = 0.0
|
||||
|
||||
# Switch off magnets
|
||||
mag = [ "SINEG01-MCRX120","SINEG01-MCRY120",
|
||||
@@ -72,15 +85,15 @@ laser_on()
|
||||
# Scan using the BPM
|
||||
try:
|
||||
#r = lscan(I_set, [I_get, cam_x, cam_y], I1, I2, dI, 1.0, before_read = ccr)
|
||||
r = lscan(I_set, [I_get, cam_x, cam_y, cam_raw_data], I1, I2, dI, 1.0)
|
||||
r = lscan(I_set, [I_get, cam_x, cam_y, cam_img], I1, I2, dI, settling_time)
|
||||
finally:
|
||||
laser_off()
|
||||
|
||||
# take the result of the scan and do the plots
|
||||
plot(r.getReadable(2), xdata=r.getReadable(1), title = "Centroid excursion")
|
||||
p = plot(r.getReadable(2), xdata=r.getReadable(1), title = "Centroid excursion")[0]
|
||||
|
||||
# save the entry in the logbook
|
||||
msg = str(r)
|
||||
msg = msg + "\nFile: " + get_context().path
|
||||
msg = msg + "\n\n" + r.print()
|
||||
#msg = msg + "\n\n" + r.print()
|
||||
elog("Gun solenoid current scan", msg , get_plot_snapshots())
|
||||
|
||||
Reference in New Issue
Block a user