Closedown

This commit is contained in:
sfop
2016-06-06 17:09:38 +02:00
parent 7cf9eed753
commit 5ba82b7db7
5 changed files with 79 additions and 189 deletions

View File

@@ -1,6 +1,6 @@
# Tool to align the solenoid on the gun.
# S. Bettoni, A. Gobbo, D. Voulot
# 30/05/2016
# 06/06/2016
# Procedure:
@@ -19,24 +19,23 @@ def ccr(mag):
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)
I1 = 20.0
I2 = 150.0
dI = 1.0
# Switch off magnets
mag = [ "SINEG01-MCRX120",
"SINEG01-MCRY120",
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-MCRX160","SINEG01-MCRY160",
"SINEG01-MCRX180","SINEG01-MCRY180",
"SINEG01-MCRX200","SINEG01-MCRY200",
"SINEG01-MCRX220","SINEG01-MCRY220",
"SINEG01-MQUA310",
"SINEG01-MQUA320" ]
for m in mag:
@@ -44,21 +43,13 @@ for m in mag:
for m in mag:
ccr(m)
# Disable laser delay
caput("SIN-CVME-TIMAST-TMA:LaserDelayControl", 0)
# 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
r = lscan(I_set, [I_read, bpm_x, bpm_y], I1, I2, dI, 1.0, passes = 2, zigzag = True)
# Enable laser delay
caput("SIN-CVME-TIMAST-TMA:LaserDelayControl", 1)
r = lscan(I_set, [I_get, bpm_x, bpm_y], I1, I2, dI, 1.0, before_read = laser_on(), after_read = laser_off())
# take the result of the scan and do the plots
centroid_x = r.getReadable(1)
centroid_y = r.getReadable(2)
plot(centroid_y, xdata=centroid_x, title = "Centroid excursion")
plot(r.getReadable(2), xdata=r.getReadable(1), title = "Centroid excursion")
# save the entry in the logbook
msg = str(r)

View File

@@ -1,53 +0,0 @@
# Tool to align the solenoid on the gun.
# S. Bettoni, A. Gobbo, D. Voulot
# 30/05/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")
I_read = Channel("SINEG01-MSOL130:I-READ")
# cam_x, cam_y = ... # some camtool command / channel?
bpm_x = ai1 # Channel("SINEG01-DBPM340:X1")
bpm_y = ai2 # Channel("SINEG01-DBPM340:Y1")
def ccr(mag):
n = 1
while n > 0:
sleep(0.5)
n = caget(mag + ":I-COMP")
I1 = 2.0
I2 = 5.0
dI = 0.5
# Switch off magnets
mag = [ "SINEG01-MCRX120",
"SINEG01-MCRY120"]
for m in mag:
caput(m + ":I-SET", 0.0)
for m in mag:
ccr(m)
# Disable laser delay
#caput("SIN-CVME-TIMAST-TMA:LaserDelayControl", 0)
# Scan using the screen
#r = lscan(I_set, [I_read, cam_x, cam_y], I1, I2, dI, passes = 2, zigzag = True)
# Scan using the BPM
r = lscan(I_set, [I_read, bpm_x, bpm_y], I1, I2, dI, 1.0)
# Enable laser delay
#caput("SIN-CVME-TIMAST-TMA:LaserDelayControl", 1)
# 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())

View File

@@ -1,9 +1,6 @@
# Tool to align the laser on the cathode.
# S. Bettoni, A. Gobbo, D. Voulot
# 30/05/2016
from operator import sub
# 06/06/2016
# Procedure:
# switch off all the magnets between the gun solenoid and the screen or BPM used for the measurement
@@ -11,40 +8,47 @@ from operator import sub
# look at the centroid position (BPM or screen) downstream of the gun.
phi_set = Channel("SINEG01-RSYS:SET-BEAM-PHASE")
phi = Channel("SINEG01-RSYS:GET-BEAM-PHASE")
cam_x, cam_y = ... # some camtool command / channel?
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
caput("SINEG01-MCRX120:I-SET", 0.0)
caput("SINEG01-MCRY120:I-SET", 0.0)
caput("SINEG01-MQUA140:I-SET", 0.0)
caput("SINEG01-MQUA150:I-SET", 0.0)
caput("SINEG01-MCRX160:I-SET", 0.0)
caput("SINEG01-MCRY160:I-SET", 0.0)
caput("SINEG01-MCRX180:I-SET", 0.0)
caput("SINEG01-MCRY180:I-SET", 0.0)
# Disable laser delay
caput("SIN-CVME-TIMAST-TMA:LaserDelayControl", 0)
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, cam_x, cam_y], phi1, phi2, dphi, passes = 2, zigzag = True, before_read = CheckCurrent)
#r = lscan(phi_set, [phi_get, cam_x, cam_y], phi1, phi2, dphi, 0.5)
# Scan using the BPM
r = lscan(phi_set, [phi, bpm_x, bpm_y], phi1, phi2, dphi, passes = 2, zigzag = True, before_read = CheckCurrent)
# Enable laser delay
caput("SIN-CVME-TIMAST-TMA:LaserDelayControl", 1)
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
x = r.getReadable(1)
y = r.getReadable(2)
plot(y, xdata=x, title = "CM")
plot(r.getReadable(2), xdata=r.getReadable(1), title = "Centroid excursion")
# save the entry in the logbook
msg = str(r)

View File

@@ -1,52 +0,0 @@
import numpy as np
import matplotlib.pyplot as plt
# example data
x = np.arange(0.5, 5.5, 0.5)
y = np.exp(-x)
xerr = 0.1
yerr = 0.2
ls = 'dotted'
fig = plt.figure()
ax = fig.add_subplot(1, 1, 1)
# standard error bars
plt.errorbar(x, y, xerr=xerr, yerr=yerr, ls=ls, color='blue')
# including upper limits
uplims = np.zeros(x.shape)
uplims[[1, 5, 9]] = True
plt.errorbar(x, y + 0.5, xerr=xerr, yerr=yerr, uplims=uplims, ls=ls,
color='green')
# including lower limits
lolims = np.zeros(x.shape)
lolims[[2, 4, 8]] = True
plt.errorbar(x, y + 1.0, xerr=xerr, yerr=yerr, lolims=lolims, ls=ls,
color='red')
# including upper and lower limits
plt.errorbar(x, y + 1.5, marker='o', ms=8, xerr=xerr, yerr=yerr,
lolims=lolims, uplims=uplims, ls=ls, color='magenta')
# including xlower and xupper limits
xerr = 0.2
yerr = np.zeros(x.shape) + 0.2
yerr[[3, 6]] = 0.3
xlolims = lolims
xuplims = uplims
lolims = np.zeros(x.shape)
uplims = np.zeros(x.shape)
lolims[[6]] = True
uplims[[3]] = True
plt.errorbar(x, y + 2.1, marker='o', ms=8, xerr=xerr, yerr=yerr,
xlolims=xlolims, xuplims=xuplims, uplims=uplims, lolims=lolims,
ls='none', mec='blue', capsize=0, color='cyan')
ax.set_xlim((0, 5.5))
ax.set_title('Errorbar upper and lower limits')
plt.show()