Files
sf-rf/script/Alignment/Laser_gun_alignment.py
2016-05-27 14:34:49 +02:00

37 lines
1.2 KiB
Python
Executable File

#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)