This commit is contained in:
2016-05-19 13:56:39 +02:00
commit ca1d73c31d
43 changed files with 752 additions and 0 deletions

View File

@@ -0,0 +1,34 @@
#Tool to align the laser on the cathode.
# S. Bettoni, A. Gobbo, D. Voulot
#10/05/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.
#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")
#I save the entry in the logbook

View File

@@ -0,0 +1,37 @@
#Tool to align the laser on the cathode.
# S. Bettoni, A. Gobbo, D. Voulot
#10/05/2016
from operator import sub
#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
#caput("shutter:state", Closed)
start_I = 0.001 #20
end_I = 0.005 #150
step_I = 0.001 #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)
p = plot(y, xdata=x, title = "CM")
yerr = 0.1
xerr = 0.5
#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)

View File

@@ -0,0 +1,52 @@
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()