Script execution

This commit is contained in:
sfop
2016-06-06 16:07:35 +02:00
parent 4d012b719d
commit c5c2bcf191

View File

@@ -1,31 +1,64 @@
# 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")
bpm_x = ai1 # Channel("SINEG01-DBPM340:X1")
bpm_y = ai2 # Channel("SINEG01-DBPM340:Y1")
# 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.2)
sleep(0.5)
n = caget(mag + ":I-COMP")
I1 = 2.0
I2 = 15.0
I1 = 20.0
I2 = 150.0
dI = 1.0
# Switch off magnets
mag = [ "SINEG01-MCRX120",
"SINEG01-MCRY120"]
"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:
ch = (m + ":I-SET")
caput(ch, 0.0)
caput(m + ":I-SET", 0.0)
for m in mag:
ccr(m)
r = lscan(I_set, [I_read, bpm_x, bpm_y], I1, I2, dI, before_read = ccr("SINEG01-MSOL130"))
# Disable laser delay
#caput("SIN-CVME-TIMAST-TMA:LaserDelayControl", 0)
plot(r.getReadable(2), xdata=r.getReadable(1), title = "Centroid excursion")
set_return(r.print())
# 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, passes = 2, zigzag = True)
# 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")
# save the entry in the logbook
msg = str(r)
msg = msg + "\nFile: " + get_context().path
msg = msg + "\n\n" + r.print()