diff --git a/script/Alignment/Gun_solenoid_alignment_dv.py b/script/Alignment/Gun_solenoid_alignment_dv.py index 4b5c17b..e127ace 100644 --- a/script/Alignment/Gun_solenoid_alignment_dv.py +++ b/script/Alignment/Gun_solenoid_alignment_dv.py @@ -1,21 +1,23 @@ -#Tool to align the laser on the cathode. +# Tool to align the solenoid on the gun. # S. Bettoni, A. Gobbo, D. Voulot -#30/05/2016 +# 30/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. +# 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 = Channel("SINEG01-MSOL130:I-SET") +I_set = Channel("SINEG01-MSOL130:I-SET") +I = Channel("SINEG01-MSOL130:I-READ") cam_x, cam_y = ... # some camtool command / channel? bpm_x = Channel("SINEG01-DBPM340:X1") bpm_y = Channel("SINEG01-DBPM340:Y1") -def CheckI(): +def CheckCurrent(): n = 1 while n > 0: + sleep(0.2) n = caget("SINEG01-MSOL130:I-COMP") I1 = 20.0 @@ -35,20 +37,20 @@ caput("SINEG01-MCRY180:I-SET", 0.0) # Disable laser delay caput("SIN-CVME-TIMAST-TMA:LaserDelayControl", 0) -#Scan using the screen -#r = lscan(I, [cam_x, cam_y], I1, I2, dI, passes = 2, zigzag = True, before_read = CheckI) -#Scan using the BPM -r = lscan(I, [bpm_x, bpm_y], I1, I2, dI, passes = 2, zigzag = True, before_read = CheckI) +# Scan using the screen +#r = lscan(I_set, [I, cam_x, cam_y], I1, I2, dI, passes = 2, zigzag = True, before_read = CheckCurrent) +# Scan using the BPM +r = lscan(I_set, [I, bpm_x, bpm_y], I1, I2, dI, passes = 2, zigzag = True, before_read = CheckCurrent) # Enable laser delay caput("SIN-CVME-TIMAST-TMA:LaserDelayControl", 1) -#I take the result of the scan and I do the plots -x = r.getReadable(0) -y = r.getReadable(1) +# take the result of the scan and do the plots +x = r.getReadable(1) +y = r.getReadable(2) plot(y, xdata=x, title = "CM") -#I save the entry in the logbook +# save the entry in the logbook msg = str(r) msg = msg + "\nFile: " + get_context().path msg = msg + "\n\n" + r.print() diff --git a/script/Alignment/Laser_gun_alignment_dv.py b/script/Alignment/Laser_gun_alignment_dv.py new file mode 100644 index 0000000..9f0c7a3 --- /dev/null +++ b/script/Alignment/Laser_gun_alignment_dv.py @@ -0,0 +1,53 @@ +# Tool to align the laser on the cathode. +# S. Bettoni, A. Gobbo, D. Voulot +# 30/05/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 = 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") + +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) + +# Scan using the screen +#r = lscan(phi_set, [phi, cam_x, cam_y], phi1, phi2, dphi, passes = 2, zigzag = True, before_read = CheckCurrent) +# 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) + +# take the result of the scan and do the plots +x = r.getReadable(1) +y = r.getReadable(2) +plot(y, xdata=x, title = "CM") + +# 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())