From 101be44c1eac3c973db2a0c9b196961c893fd2c9 Mon Sep 17 00:00:00 2001 From: sfop Date: Tue, 21 Jun 2016 11:42:51 +0200 Subject: [PATCH] Closedown --- config/devices.properties | 1 - script/Alignment/Gun_solenoid_alignment.py | 2 +- script/Alignment/Laser_gun_alignment.py | 31 +++++++++++----------- script/test/MultiplePlot.py | 9 ++++--- 4 files changed, 22 insertions(+), 21 deletions(-) diff --git a/config/devices.properties b/config/devices.properties index 19c0e8a..f583ed0 100755 --- a/config/devices.properties +++ b/config/devices.properties @@ -1,5 +1,4 @@ gun_solenoid=ch.psi.pshell.epics.Positioner|SINEG01-MSOL130:I-SET SINEG01-MSOL130:I-READ|||true -SINEG01-DBPM340=ch.psi.pshell.epics.Positioner|SINEG01-DBPM340:X1 SINEG01-DBPM340:Y1|Read||true gun_phase=ch.psi.pshell.epics.Positioner|SINEG01-RSYS:SET-BEAM-PHASE SINEG01-RSYS:GET-BEAM-PHASE|||true #SINSB01_phase=ch.psi.pshell.epics.Positioner|VA-SINSB01-RSYS100:SET-BEAM-PHASE VA-SINSB01-RSYS100:GET-BEAM-PHASE|||true #BC1_energy=ch.psi.pshell.epics.ChannelDouble|VA-SINBC02-DBPM140:ENERGY|Read||true diff --git a/script/Alignment/Gun_solenoid_alignment.py b/script/Alignment/Gun_solenoid_alignment.py index 0a375c8..19ed3ad 100755 --- a/script/Alignment/Gun_solenoid_alignment.py +++ b/script/Alignment/Gun_solenoid_alignment.py @@ -12,7 +12,7 @@ import org.apache.commons.math3.linear.Array2DRowRealMatrix as Matrix import ch.psi.utils.Convert.toBidimensional as mono_to_bidi - +import datetime I1 = 20.0 I2 = 50.0 diff --git a/script/Alignment/Laser_gun_alignment.py b/script/Alignment/Laser_gun_alignment.py index d75628b..e32417f 100755 --- a/script/Alignment/Laser_gun_alignment.py +++ b/script/Alignment/Laser_gun_alignment.py @@ -7,15 +7,12 @@ # 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_get = Channel("SINEG01-RSYS:GET-BEAM-PHASE") +cam_x = Channel("SINEG01-DSCR190:profile.X_stats.com", alias = "cam_x") +cam_y = Channel("SINEG01-DSCR190:profile.Y_stats.com", alias = "cam_y") bpm_x = Channel("SINEG01-DBPM340:X1", alias = "bpm_x") bpm_y = Channel("SINEG01-DBPM340:Y1", alias = "bpm_y") -cam_x = Channel("SINEG01-DSCR190:profile.X_stats.com", alias = "cam_x") -cam_y = Channel("SINEG01-DSCR190:profile.Y_stats.com", alias = "cam_y") - def ccr(mag): n = 1 while n > 0: @@ -23,14 +20,13 @@ def ccr(mag): n = caget(mag + ":I-COMP") def laser_on(): caput("SIN-TIMAST-TMA:Beam-Las-Delay-Sel", 0) - def laser_off(): caput("SIN-TIMAST-TMA:Beam-Las-Delay-Sel", 1) phi1 = 20.0 -phi2 = 150.0 +phi2 = 30.0 dphi = 1.0 -settling_time = 0.5 +settling_time = 0.1 # Switch off magnets mag = [ "SINEG01-MCRX120","SINEG01-MCRY120", @@ -47,18 +43,23 @@ for m in mag: for m in mag: ccr(m) +def br(): + pass +def ar(): + pass + laser_on() -# Scan using the screen -#r = lscan(phi_set, [phi_get, cam_x, cam_y], phi1, phi2, dphi, 0.5) -# Scan using the BPM -r = lscan(phi_set, [phi_get, bpm_x, bpm_y], phi1, phi2, dphi, settling_time) -laser_off() +try: + r = lscan(gun_phase, [bpm_x, bpm_y], phi1, phi2, dphi, settling_time, before_read = br, after_read = ar) +finally: + laser_off() # take the result of the scan and do the plots -plot(r.getReadable(2), xdata=r.getReadable(1), title = "Centroid excursion") +plot(r.getReadable(1), xdata=r.getReadable(0), title = "Centroid excursion") +#add_convex_hull_plot ("Centroid excursion", r.getReadable(0),r.getReadable(1), "Name") # 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()) +elog("Gun laser alignment", msg , get_plot_snapshots()) diff --git a/script/test/MultiplePlot.py b/script/test/MultiplePlot.py index c405b07..7418a45 100644 --- a/script/test/MultiplePlot.py +++ b/script/test/MultiplePlot.py @@ -7,8 +7,9 @@ for step in range(1,5): for i in range(50): x.append(random.random() * 100 / step) y.append(random.random() * 100/ step) - add_convex_hull_plot ("test", x,y,"Step " + str(step), (-50,150), (-50,150)) + print step + add_convex_hull_plot ("test", x,y,"Step " + str(step), False, (-50,150), (-50,150)) -#x = [317.86916703765246, 318.2215338763623, 317.5688250452771, 318.74843805712953, 315.77042681965906, 319.8600058760031, 318.2215338763623, 318.2215338763623, 318.74843805712953, 318.11687837407675, 319.8600058760031] -#y = [226.71039474501808, 222.34863253627455, 226.4631572933208, 226.81240897796238, 230.7042858871591, 227.4796142397247, 222.34863253627455, 222.34863253627455, 226.81240897796238, 230.7042858871591, 227.4796142397247] -#add_convex_hull_plot ("test", x,y,"X") \ No newline at end of file +x = [317.86916703765246, 318.2215338763623, 317.5688250452771, 318.74843805712953, 315.77042681965906, 319.8600058760031, 318.2215338763623, 318.2215338763623, 318.74843805712953, 318.11687837407675, 319.8600058760031] +y = [226.71039474501808, 222.34863253627455, 226.4631572933208, 226.81240897796238, 230.7042858871591, 227.4796142397247, 222.34863253627455, 222.34863253627455, 226.81240897796238, 230.7042858871591, 227.4796142397247] +add_convex_hull_plot ("test", x,y,"X") \ No newline at end of file