Script execution

This commit is contained in:
sfop
2016-06-15 14:49:06 +02:00
parent d9212ac49c
commit bb5b3489f1

View File

@@ -22,26 +22,43 @@ bpm_y = Channel("SINEG01-DBPM340:Y1")
cam_x = Channel("SINEG01-DSCR190:profile.X_stats.com", alias = "cam_x")
cam_y = Channel("SINEG01-DSCR190:profile.Y_stats.com", alias = "cam_y")
profile_x = Channel("SINEG01-DSCR190:profile.X", alias = "profile_x")
profile_y = Channel("SINEG01-DSCR190:profile.Y", alias = "profile_y")
cam_raw_data = Channel("SINEG01-DSCR190:data")
class CameraImage(ReadableMatrix):
def read(self):
raw = cam_raw_data.read()
m = Matrix(mono_to_bidi(raw, self.getHeight(), self.getWidth()))
return m.transpose.getData()
#ret = []
#for i in range (self.getHeight()):
# ret.append(raw[i*self.getWidth() : (i+1)*self.getWidth()])
#return ret
return mono_to_bidi(raw, self.getWidth(), self.getHeight())
def getWidth(self):
return 640
def getHeight(self):
return 480
cam_img = CameraImage()
def getHeight(self):
return 640
class CameraImage(ReadableMatrix):
def read(self):
raw = cam_raw_data.read()
if self.transposed:
return Matrix(mono_to_bidi(raw, self.getHeight(), self.getWidth())).transpose().getData()
return mono_to_bidi(raw, self.getWidth(), self.getHeight())
def getWidth(self):
return self._width
def getHeight(self):
return self._height
cam_img = CameraImage()
cam_img.transposed = True
cam_img._width = len(profile_x.read())
cam_img._height = len(profile_y.read())
def ccr(mag):
@@ -84,8 +101,8 @@ mag = [ "SINEG01-MCRX120","SINEG01-MCRY120",
"SINEG01-MQUA320" ]
for m in mag:
caput(m + ":I-SET", 0.0)
for m in mag:
ccr(m)
#for m in mag:
# ccr(m)
laser_on()
# Scan using the screen
@@ -98,10 +115,12 @@ finally:
laser_off()
# take the result of the scan and do the plots
p = plot(r.getReadable(2), xdata=r.getReadable(1), title = "Centroid excursion")[0]
#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 = str(r)
#msg = msg + "\nFile: " + get_context().path
#msg = msg + "\n\n" + r.print()
elog("Gun solenoid current scan", msg , get_plot_snapshots())
#elog("Gun solenoid current scan", msg , get_plot_snapshots())