Closedown

This commit is contained in:
sfop
2016-06-15 13:39:03 +02:00
parent 4b9934d9cd
commit da1fb85dc0
4 changed files with 138 additions and 209 deletions

View File

@@ -1,34 +1,99 @@
#Tool to align the laser on the cathode.
# Tool to align the solenoid on the gun.
# S. Bettoni, A. Gobbo, D. Voulot
#10/05/2016
# 06/06/2016
#Procedure:
#I switch off all the magnets between the gun solenoid and the screen or BPM used for the measurement
#I change the current of the gun soleoid
#I look at the centroid position (BPM or screen) downstream of the gun.
# Procedure:
# switch off all the magnets between the gun solenoid and the screen or BPM used for the measurement
# 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", 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", alias = "cam_x")
cam_y = Channel("SINEG01-DSCR190:profile.Y_stats.com", alias = "cam_y")
cam_raw_data = Channel("SINEG01-DSCR190:data")
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):
n = 1
while n > 0:
sleep(0.5)
n = caget(mag + ":I-COMP")
def laser_on():
caput("SIN-TIMAST-TMA:Beam-Las-Delay-Sel", 0)
#TO BE PUT THE SIGNAL I-READ IN THE DEVICE DEFINITION GUN SOLENOID
#caput("shutter:state", Closed)
start_I = 0.001 #20
end_I = 0.005 #150
step_I = 0.0001 #1
#Scan using the screen
r = lscan(gun_sol_current, [center_x, center_y], start_I, end_I, step_I, latency = 0.2)
#Scan using the BPM
#r = lscan(gun_sol_current, bpm_1_down_gun, start_I, end_I, step_I, latency = 0.2)
#I take the result of the scan and I do the plots
x = r.getReadable(0)
y = r.getReadable(1)
plot(y, xdata=x, title = "CM")
def laser_off():
caput("SIN-TIMAST-TMA:Beam-Las-Delay-Sel", 1)
def run_pipeline():
caput("camtool...:start")
while !caget("camtool...:done"):
sleep(0.1)
#I save the entry in the logbook
caget("camtool....:data")
#caget("camtool....:X_stats.com")
#caget("camtool....:X_stats.com")
I1 = 20.0
I2 = 150.0
dI = 1.0
settling_time = 0.0
# Switch off magnets
mag = [ "SINEG01-MCRX120","SINEG01-MCRY120",
"SINEG01-MQUA140",
"SINEG01-MQUA150",
"SINEG01-MCRX160","SINEG01-MCRY160",
"SINEG01-MCRX180","SINEG01-MCRY180",
"SINEG01-MCRX200","SINEG01-MCRY200",
"SINEG01-MCRX220","SINEG01-MCRY220",
"SINEG01-MQUA310",
"SINEG01-MQUA320" ]
for m in mag:
caput(m + ":I-SET", 0.0)
#for m in mag:
# ccr(m)
laser_on()
# Scan using the screen
#r = lscan(I_set, [I_read, cam_x, cam_y], I1, I2, dI, 1.0, passes = 2, zigzag = True)
# 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_img], I1, I2, dI, settling_time)
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]
# save the entry in the logbook
msg = str(r)
msg = msg + "\nFile: " + get_context().path
#msg = msg + "\n\n" + r.print()
#elog("Gun solenoid current scan", msg , get_plot_snapshots())

View File

@@ -1,99 +0,0 @@
# Tool to align the solenoid on the gun.
# S. Bettoni, A. Gobbo, D. Voulot
# 06/06/2016
# Procedure:
# switch off all the magnets between the gun solenoid and the screen or BPM used for the measurement
# 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", 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", alias = "cam_x")
cam_y = Channel("SINEG01-DSCR190:profile.Y_stats.com", alias = "cam_y")
cam_raw_data = Channel("SINEG01-DSCR190:data")
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):
n = 1
while n > 0:
sleep(0.5)
n = caget(mag + ":I-COMP")
def laser_on():
caput("SIN-TIMAST-TMA:Beam-Las-Delay-Sel", 0)
def laser_off():
caput("SIN-TIMAST-TMA:Beam-Las-Delay-Sel", 1)
def run_pipeline():
caput("camtool...:start")
while !caget("camtool...:done"):
sleep(0.1)
caget("camtool....:data")
#caget("camtool....:X_stats.com")
#caget("camtool....:X_stats.com")
I1 = 20.0
I2 = 150.0
dI = 1.0
settling_time = 0.0
# Switch off magnets
mag = [ "SINEG01-MCRX120","SINEG01-MCRY120",
"SINEG01-MQUA140",
"SINEG01-MQUA150",
"SINEG01-MCRX160","SINEG01-MCRY160",
"SINEG01-MCRX180","SINEG01-MCRY180",
"SINEG01-MCRX200","SINEG01-MCRY200",
"SINEG01-MCRX220","SINEG01-MCRY220",
"SINEG01-MQUA310",
"SINEG01-MQUA320" ]
for m in mag:
caput(m + ":I-SET", 0.0)
#for m in mag:
# ccr(m)
laser_on()
# Scan using the screen
#r = lscan(I_set, [I_read, cam_x, cam_y], I1, I2, dI, 1.0, passes = 2, zigzag = True)
# 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_img], I1, I2, dI, settling_time)
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]
# save the entry in the logbook
msg = str(r)
msg = msg + "\nFile: " + get_context().path
#msg = msg + "\n\n" + r.print()
#elog("Gun solenoid current scan", msg , get_plot_snapshots())

View File

@@ -1,37 +1,57 @@
#Tool to align the laser on the cathode.
# Tool to align the laser on the cathode.
# S. Bettoni, A. Gobbo, D. Voulot
#10/05/2016
# 06/06/2016
from operator import sub
# Procedure:
# switch off all the magnets between the gun solenoid and the screen or BPM used for the measurement
# change the phase of the gun RF
# look at the centroid position (BPM or screen) downstream of the gun.
phi_set = Channel("SINEG01-RSYS:SET-BEAM-PHASE")
phi_get = Channel("SINEG01-RSYS:GET-BEAM-PHASE")
# cam_x, cam_y = ... # some camtool command / channel?
bpm_x = Channel("SINEG01-DBPM340:X1")
bpm_y = Channel("SINEG01-DBPM340:Y1")
#Procedure:
#I switch off all the magnets between the gun solenoid and the screen or BPM used for the measurement
#I change the current of the gun soleoid
#I look at the centroid position (BPM or screen) downstream of the gun.
#TO BE PUT THE SIGNAL I-READ IN THE DEVICE DEFINITION GUN SOLENOID
def ccr(mag):
n = 1
while n > 0:
sleep(0.5)
n = caget(mag + ":I-COMP")
def laser_on():
caput("SIN-CVME-TIMAST-TMA:LaserDelayControl", 0)
def laser_off():
caput("SIN-CVME-TIMAST-TMA:LaserDelayControl", 1)
#caput("shutter:state", Closed)
phi1 = 20.0
phi2 = 150.0
dphi = 1.0
start_I = 0.001 #20
end_I = 0.005 #150
step_I = 0.001 #1
# Switch off magnets
mag = [ "SINEG01-MCRX120","SINEG01-MCRY120",
"SINEG01-MQUA140",
"SINEG01-MQUA150",
"SINEG01-MCRX160","SINEG01-MCRY160",
"SINEG01-MCRX180","SINEG01-MCRY180",
"SINEG01-MCRX200","SINEG01-MCRY200",
"SINEG01-MCRX220","SINEG01-MCRY220",
"SINEG01-MQUA310",
"SINEG01-MQUA320" ]
for m in mag:
caput(m + ":I-SET", 0.0)
for m in mag:
ccr(m)
#Scan using the screen
r = lscan(gun_sol_current, [center_x, center_y], start_I, end_I, step_I, latency = 0.2)
#Scan using the BPM
#r = lscan(gun_sol_current, bpm_1_down_gun, start_I, end_I, step_I, latency = 0.2)
# Scan using the screen
#r = lscan(phi_set, [phi_get, cam_x, cam_y], phi1, phi2, dphi, 0.5)
# Scan using the BPM
r = lscan(phi_set, [phi_get, bpm_x, bpm_y], phi1, phi2, dphi, 0.5, before_read = laser_on(), after_read = laser_off())
#I take the result of the scan and I do the plots
x = r.getReadable(0)
y = r.getReadable(1)
p = plot(y, xdata=x, title = "CM")
yerr = 0.1
xerr = 0.5
# take the result of the scan and do the plots
plot(r.getReadable(2), xdata=r.getReadable(1), title = "Centroid excursion")
#I save the entry in the logbook
#elog(title, message, attachments = [], author = None, category = "Info", domain = "", logbook = "SwissFEL commissioning data", encoding=1):
#elog("Test Simona", "message", author = "Simona", get_plot_snapshots(), logbook = "SwissFEL commissioning data", encoding=1)
# save the entry in the logbook
msg = str(r)
msg = msg + "\nFile: " + get_context().path
msg = msg + "\n\n" + r.print()
elog("Gun solenoid current scan", msg , get_plot_snapshots())

View File

@@ -1,57 +0,0 @@
# Tool to align the laser on the cathode.
# S. Bettoni, A. Gobbo, D. Voulot
# 06/06/2016
# Procedure:
# switch off all the magnets between the gun solenoid and the screen or BPM used for the measurement
# change the phase of the gun RF
# look at the centroid position (BPM or screen) downstream of the gun.
phi_set = Channel("SINEG01-RSYS:SET-BEAM-PHASE")
phi_get = Channel("SINEG01-RSYS:GET-BEAM-PHASE")
# cam_x, cam_y = ... # some camtool command / channel?
bpm_x = Channel("SINEG01-DBPM340:X1")
bpm_y = Channel("SINEG01-DBPM340:Y1")
def ccr(mag):
n = 1
while n > 0:
sleep(0.5)
n = caget(mag + ":I-COMP")
def laser_on():
caput("SIN-CVME-TIMAST-TMA:LaserDelayControl", 0)
def laser_off():
caput("SIN-CVME-TIMAST-TMA:LaserDelayControl", 1)
phi1 = 20.0
phi2 = 150.0
dphi = 1.0
# Switch off magnets
mag = [ "SINEG01-MCRX120","SINEG01-MCRY120",
"SINEG01-MQUA140",
"SINEG01-MQUA150",
"SINEG01-MCRX160","SINEG01-MCRY160",
"SINEG01-MCRX180","SINEG01-MCRY180",
"SINEG01-MCRX200","SINEG01-MCRY200",
"SINEG01-MCRX220","SINEG01-MCRY220",
"SINEG01-MQUA310",
"SINEG01-MQUA320" ]
for m in mag:
caput(m + ":I-SET", 0.0)
for m in mag:
ccr(m)
# Scan using the screen
#r = lscan(phi_set, [phi_get, cam_x, cam_y], phi1, phi2, dphi, 0.5)
# Scan using the BPM
r = lscan(phi_set, [phi_get, bpm_x, bpm_y], phi1, phi2, dphi, 0.5, before_read = laser_on(), after_read = laser_off())
# take the result of the scan and do the plots
plot(r.getReadable(2), xdata=r.getReadable(1), title = "Centroid excursion")
# save the entry in the logbook
msg = str(r)
msg = msg + "\nFile: " + get_context().path
msg = msg + "\n\n" + r.print()
elog("Gun solenoid current scan", msg , get_plot_snapshots())