diff --git a/config/devices.properties b/config/devices.properties
index fd33537..3ada176 100755
--- a/config/devices.properties
+++ b/config/devices.properties
@@ -2,7 +2,7 @@ virtual_accelerator_set=ch.psi.pshell.epics.ChannelDouble|VA-SINBC01-MCRX070:I-S
virtual_accelerator_read=ch.psi.pshell.epics.ChannelDouble|VA-SINBC01-DBPM100:X1|||true
gun_solenoid=ch.psi.pshell.epics.Positioner|SINEG01-MSOL130:I-SET SINEG01-MSOL130:I-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
+SINSB01_phase=ch.psi.pshell.epics.Positioner|VA-SINSB01-RSYS100:SET-BEAM-PHASE VA-SINSB01-RSYS100:GET-BEAM-PHASE|||true
dispatcher=ch.psi.pshell.bs.Dispatcher|https://dispatcher-api.psi.ch/sf|||
stream=ch.psi.pshell.bs.Stream|dispatcher|||true
#ref10=ch.psi.pshell.bs.Scalar|stream SINEG01-RLLE-REF10:SIG-PHASE-AVG 10|||
diff --git a/devices/CurrentCamera.properties b/devices/CurrentCamera.properties
index 7b4cf6c..adb6120 100644
--- a/devices/CurrentCamera.properties
+++ b/devices/CurrentCamera.properties
@@ -1,16 +1,16 @@
-#Tue Jul 18 09:35:41 CEST 2017
+#Tue Aug 08 18:00:57 CEST 2017
colormap=Flame
-colormapAutomatic=false
-colormapMax=1164.0
-colormapMin=-67.0
+colormapAutomatic=true
+colormapMax=12000.0
+colormapMin=0.0
flipHorizontally=false
flipVertically=false
grayscale=false
-imageHeight=1680
-imageWidth=1744
+imageHeight=1200
+imageWidth=1246
invert=false
-regionStartX=433
-regionStartY=241
+regionStartX=304
+regionStartY=8
rescaleFactor=1.0
rescaleOffset=0.0
roiHeight=-1
@@ -21,9 +21,9 @@ rotation=0.0
rotationCrop=false
scale=1.0
serverURL=localhost\:10000
-spatialCalOffsetX=-774.4676788150659
-spatialCalOffsetY=-530.483585305347
-spatialCalScaleX=-8.510638040502267
-spatialCalScaleY=-8.23581667712135
+spatialCalOffsetX=-861.4939970777481
+spatialCalOffsetY=-820.4883730911062
+spatialCalScaleX=-18.90359092620482
+spatialCalScaleY=-19.37984500632817
spatialCalUnits=mm
transpose=false
diff --git a/devices/SINSB01_phase.properties b/devices/SINSB01_phase.properties
index af191ca..3367de0 100755
--- a/devices/SINSB01_phase.properties
+++ b/devices/SINSB01_phase.properties
@@ -1,8 +1,9 @@
-#Wed Jan 06 16:18:41 CET 2016
+#Fri Jul 21 15:09:14 CEST 2017
maxValue=360.0
minValue=0.0
offset=0.0
precision=3
resolution=NaN
+rotation=false
scale=1.0
unit=Degree
diff --git a/devices/WireScanner motor.properties b/devices/WireScanner motor.properties
index b054992..d48df13 100644
--- a/devices/WireScanner motor.properties
+++ b/devices/WireScanner motor.properties
@@ -1,5 +1,5 @@
-#Thu Jul 13 13:13:16 CEST 2017
-defaultSpeed=6000.0
+#Fri Jul 28 09:51:47 CEST 2017
+defaultSpeed=5000.0
estbilizationDelay=0
hasEnable=false
homingType=None
diff --git a/devices/camtool.properties b/devices/camtool.properties
index 3867237..364519f 100644
--- a/devices/camtool.properties
+++ b/devices/camtool.properties
@@ -1,4 +1,4 @@
-#Tue Jul 18 08:47:04 CEST 2017
+#Thu Jul 27 16:54:25 CEST 2017
colormap=Flame
colormapAutomatic=true
colormapMax=578.797
@@ -18,9 +18,9 @@ roiY=0
rotation=0.0
rotationCrop=false
scale=1.0
-spatialCalOffsetX=-445.47188964206686
-spatialCalOffsetY=-406.4957195962868
-spatialCalScaleX=-18.903590601802758
-spatialCalScaleY=-19.379844656211844
+spatialCalOffsetX=-861.4939970777481
+spatialCalOffsetY=-820.4883730911062
+spatialCalScaleX=-18.90359092620482
+spatialCalScaleY=-19.37984500632817
spatialCalUnits=mm
transpose=false
diff --git a/devices/image.properties b/devices/image.properties
index 724868d..09d5673 100644
--- a/devices/image.properties
+++ b/devices/image.properties
@@ -1,8 +1,8 @@
-#Fri Aug 26 10:47:14 CEST 2016
+#Fri Jul 21 15:08:25 CEST 2017
flipHorizontally=false
flipVertically=false
-grayscale=false
-invert=false
+grayscale=true
+invert=true
rescaleFactor=1.0
rescaleOffset=0.0
roiHeight=-1
diff --git a/plugins/GunScan.form b/plugins/GunScan.form
index 2b38801..02ad08d 100644
--- a/plugins/GunScan.form
+++ b/plugins/GunScan.form
@@ -38,7 +38,7 @@
-
+
@@ -170,7 +170,7 @@
-
+
@@ -241,18 +241,15 @@
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
@@ -280,7 +277,7 @@
-
+
@@ -289,13 +286,13 @@
-
+
-
+
@@ -304,7 +301,7 @@
-
+
diff --git a/plugins/GunScan.java b/plugins/GunScan.java
index 00e4feb..68837b5 100644
--- a/plugins/GunScan.java
+++ b/plugins/GunScan.java
@@ -82,7 +82,7 @@ public class GunScan extends Panel {
spinnerStep.setModel(new javax.swing.SpinnerNumberModel(1.0d, 0.05d, 10.0d, 0.05d));
spinnerStep.setPreferredSize(new java.awt.Dimension(64, 20));
- labelStep.setText("Step:");
+ labelStep.setText("Step size:");
spinnerStart.setModel(new javax.swing.SpinnerNumberModel(0.0d, -360.0d, 360.0d, 1.0d));
spinnerStart.setPreferredSize(new java.awt.Dimension(64, 20));
@@ -158,31 +158,29 @@ public class GunScan extends Panel {
panelBeamPars.setBorder(javax.swing.BorderFactory.createTitledBorder("Beam Parameters"));
- spinnerDispersion.setModel(new javax.swing.SpinnerNumberModel(-0.32d, -100.0d, 100.0d, 0.01d));
+ spinnerDispersion.setModel(new javax.swing.SpinnerNumberModel(-0.387d, -10.0d, 10.0d, 0.001d));
spinnerDispersion.setPreferredSize(new java.awt.Dimension(64, 20));
- labelEnergy.setText("Energy:");
+ labelEnergy.setText("p (MeV/c):");
- spinnerEnergy.setModel(new javax.swing.SpinnerNumberModel(7.1d, 0.0d, 100.0d, 0.1d));
+ spinnerEnergy.setModel(new javax.swing.SpinnerNumberModel(7.1d, 0.0d, 10.0d, 0.01d));
spinnerEnergy.setPreferredSize(new java.awt.Dimension(64, 20));
- labelDispersion.setText("Dispersion:");
+ labelDispersion.setText("Disp. (m):");
javax.swing.GroupLayout panelBeamParsLayout = new javax.swing.GroupLayout(panelBeamPars);
panelBeamPars.setLayout(panelBeamParsLayout);
panelBeamParsLayout.setHorizontalGroup(
panelBeamParsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelBeamParsLayout.createSequentialGroup()
- .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addGroup(panelBeamParsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
- .addGroup(panelBeamParsLayout.createSequentialGroup()
- .addComponent(labelEnergy)
- .addGap(0, 0, 0)
- .addComponent(spinnerEnergy, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
- .addGroup(panelBeamParsLayout.createSequentialGroup()
- .addComponent(labelDispersion)
- .addGap(0, 0, 0)
- .addComponent(spinnerDispersion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
+ .addContainerGap(19, Short.MAX_VALUE)
+ .addGroup(panelBeamParsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(labelDispersion, javax.swing.GroupLayout.Alignment.TRAILING)
+ .addComponent(labelEnergy))
+ .addGap(4, 4, 4)
+ .addGroup(panelBeamParsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
+ .addComponent(spinnerEnergy, javax.swing.GroupLayout.DEFAULT_SIZE, 73, Short.MAX_VALUE)
+ .addComponent(spinnerDispersion, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addContainerGap())
);
panelBeamParsLayout.setVerticalGroup(
@@ -232,7 +230,7 @@ public class GunScan extends Panel {
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(buttonAbort)
.addGap(15, 15, 15)))
- .addComponent(plot, javax.swing.GroupLayout.DEFAULT_SIZE, 531, Short.MAX_VALUE)
+ .addComponent(plot, javax.swing.GroupLayout.DEFAULT_SIZE, 527, Short.MAX_VALUE)
.addContainerGap())
);
layout.setVerticalGroup(
diff --git a/plugins/SchottkyScan.form b/plugins/SchottkyScan.form
index 0120c53..98749cd 100644
--- a/plugins/SchottkyScan.form
+++ b/plugins/SchottkyScan.form
@@ -184,7 +184,7 @@
-
+
diff --git a/plugins/SchottkyScan.java b/plugins/SchottkyScan.java
index 9d8fb8e..9902642 100644
--- a/plugins/SchottkyScan.java
+++ b/plugins/SchottkyScan.java
@@ -113,7 +113,7 @@ public class SchottkyScan extends Panel {
spinnerStop.setModel(new javax.swing.SpinnerNumberModel(180.0d, -180.0d, 360.0d, 1.0d));
labelStep.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
- labelStep.setText("Step:");
+ labelStep.setText("Step size:");
labelStop.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
labelStop.setText("Stop:");
diff --git a/script/Diagnostics/DLACScan.py b/script/Diagnostics/DLACScan.py
index c959175..cb81540 100644
--- a/script/Diagnostics/DLACScan.py
+++ b/script/Diagnostics/DLACScan.py
@@ -9,22 +9,22 @@ run("Devices/Elements")
run("Diagnostics/sig_process_wrapper")
BPM_SENSORS = [("x","X1"), ("y","Y1"), ("q","Q1")] #(logic name sufix, channel sufix)
-TRAVEL_SPEED = 1.0
+TRAVEL_SPEED = 0.001
#Paramter parsing
prefix = args[0] if is_panel else "SINDI02-DLAC055"
-scan_type = args[1] if is_panel else "Shrom1"
-scan_range = args[2] if is_panel else [-0.5, 0.5]
-cycles = args[3] if is_panel else 3
-velocity = args[4] if is_panel else 0.1
+scan_type = args[1] if is_panel else "Shrom3"
+scan_range = args[2] if is_panel else [-0.12, 0.12]
+cycles = args[3] if is_panel else 1
+velocity = args[4] if is_panel else 0.00001
bpms = args[5] if is_panel else ["SINDI02-DBPM040", "SINDI02-DBPM080"]
blms = args[6] if is_panel else ["SINDI02-DBLM085", "S10DI01-DBLM045"]
-bkgrd = args[7] if is_panel else 0 #Number of beam synchronous messages
+bkgrd = args[7] if is_panel else 5 #Number of beam synchronous messages
plt = args[8] if is_panel else plot(None, title = "DLAC Scan")[0]
do_elog = True if is_panel else False
print "DLAC scan parameters: ", prefix, scan_type, scan_range, cycles, velocity, bpms, blms, bkgrd
-
+center_pos = 199.484
scan_type_index = DLAC_POSITIONS.index(scan_type)
if scan_type_index<0:
raise Exception("Bad sample position name")
@@ -49,11 +49,12 @@ else:
motor = ch.psi.pshell.epics.Motor("DLAC motor", prefix + ":MOTOR_Y1")
motor.config.resolution = 0.001 #In-position band
motor.monitored = True
+motor.setPrecision(7)
motor.initialize()
add_device(motor, True)
motor.setSpeed(TRAVEL_SPEED)
park_pos = caget (prefix + ":P0_U0_SP")
-center_pos = caget (prefix + ":P" + str(scan_type_index) + "_U0_SP")
+# center_pos = caget (prefix + ":P" + str(scan_type_index) + "_U0_SP")
#List of stream channels
@@ -144,10 +145,12 @@ try:
cur_cycle = i+1
set_exec_pars(group="Cycle_" + str(cur_cycle), reset=True)
motor.setSpeed(TRAVEL_SPEED)
- motor.move(center_pos + scan_range[0] )
+ motor.move(center_pos + scan_range[0] )
+ #time.sleep(1.0)
motor.setSpeed(velocity)
destination = center_pos + scan_range[1]
motor.moveAsync(destination)
+ # time.sleep(1.0)
#if (i%2) == 0:
# motor.moveAsync(center_pos + scan_range[1])
diff --git a/script/RFscan/GunScan.py b/script/RFscan/GunScan.py
index 0fb97b3..19b9306 100644
--- a/script/RFscan/GunScan.py
+++ b/script/RFscan/GunScan.py
@@ -11,8 +11,8 @@ if get_exec_pars().source == CommandSource.ui:
nb = 3
lat = 0.3
disp = -0.32
- energy0 = 7.1
- plt = plot(None, title="Output")[0]
+ p0 = 7.1
+ plt = plot(None, title="Output")[0]
else:
start = args[0]
stop = args[1]
@@ -20,20 +20,20 @@ else:
nb = int(args[3])
lat = args[4]
disp = args[5]
- energy0 = args[6]
+ p0 = args[6]
plt = args[7]
-A = energy0 / disp / 1e6
-B = energy0
+A = p0 / disp / 1e6
+B = p0
#Plot setup
plt.clear()
plt.setStyle(plt.Style.ErrorY)
-plt.addSeries(LinePlotErrorSeries("Energy"))
-plt.addSeries(LinePlotErrorSeries("Energy Spread", None, 2))
+plt.addSeries(LinePlotErrorSeries("Momentum"))
+plt.addSeries(LinePlotErrorSeries("Momentum Spread", None, 2))
plt.getAxis(plt.AxisId.X).setLabel("Gun Beam Phase (deg)")
-plt.getAxis(plt.AxisId.Y).setLabel("Energy (MeV)")
-plt.getAxis(plt.AxisId.Y2).setLabel("Energy Spread (MeV)")
+plt.getAxis(plt.AxisId.Y).setLabel("Momentum (MeV/c)")
+plt.getAxis(plt.AxisId.Y2).setLabel("Momentum Spread (MeV/c)")
plt.setLegendVisible(True)
#Creating Phase positioner
@@ -43,12 +43,12 @@ if dry_run:
else:
phase = Positioner("Phase", "SINEG01-RSYS:SET-BEAM-PHASE", "SINEG01-RSYS:GET-BEAM-PHASE")
camera_name = "SINBD01-DSCR010"
-
+
phase.config.minValue = -180.0
phase.config.maxValue = 180.0
phase.config.precision = 3
phase.config.resolution = 0.01
-phase.config.rotation = False
+phase.config.rotation = False
phase.config.save()
phase.initialize()
phase0 = phase.read()
@@ -70,11 +70,11 @@ dx_averager.monitored=True # not blocking, will return last nb values
def after_sample(record, scan):
global A, B
x_pos_mean, x_pos_stdev = record.values[0].mean, record.values[0].stdev
- x_width_mean, x_width_stdev = record.values[1].mean, record.values[1].stdev
- E_mean, E_stdev = A * x_pos_mean + B, abs(A) * x_pos_stdev
- dE_mean, dE_stdev = abs(A) * x_width_mean, abs(A) * x_width_stdev
- plt.getSeries(0).appendData(record.positions[0], E_mean, E_stdev)
- plt.getSeries(1).appendData(record.positions[0], dE_mean, dE_stdev)
+ x_width_mean, x_width_stdev = record.values[1].mean, record.values[1].stdev
+ p_mean, p_stdev = A * x_pos_mean + B, abs(A) * x_pos_stdev
+ dp_mean, dp_stdev = abs(A) * x_width_mean, abs(A) * x_width_stdev
+ plt.getSeries(0).appendData(record.positions[0], p_mean, p_stdev)
+ plt.getSeries(1).appendData(record.positions[0], dp_mean, dp_stdev)
#The scan loop
try:
@@ -87,13 +87,13 @@ finally:
camtool.stop() # stops camtool but does not close it camtool is a global object
#Saving metadata
-E = [A * val.mean + B for val in r.getReadable(0)]
-dE = [abs(A) * val.mean for val in r.getReadable(1)]
-save_dataset(get_exec_pars().group + "/E", E)
-save_dataset(get_exec_pars().group + "/dE", dE)
+p = [A * val.mean + B for val in r.getReadable(0)]
+dp = [abs(A) * val.mean for val in r.getReadable(1)]
+save_dataset(get_exec_pars().group + "/p", p)
+save_dataset(get_exec_pars().group + "/dp", dp)
if do_elog:
- if get_option("Generated data file:\n" + get_exec_pars().path +"\n\n" + "Save to ELOG?", "YesNo") == "Yes":
+ if get_option("Generated data file:\n" + get_exec_pars().path +"\n\n" + "Save to ELOG?", "YesNo") == "Yes":
Laser = str(caget("SLGTV-LMTO-M055:MOT-KNOWN-POS"))
log_msg = "Data file: " + get_exec_pars().path + "\n\n"
log_msg = log_msg + "Laser: " + Laser + "\n"
@@ -108,5 +108,5 @@ if do_elog:
log_msg = log_msg + "Charge: %0.2f" % caget("SINEG01-DICT215:B1_CHARGE-OP") + " pC \n"
sleep(0.1) #Give some time to plot to be finished - it is not sync with acquisition
file_name = os.path.abspath(get_context().setup.getContextPath() + "/GunScanPlot.png")
- plt.saveSnapshot(file_name , "png")
+ plt.saveSnapshot(file_name , "png")
elog("Gun scan", log_msg, [file_name,])
diff --git a/script/RFscan/SchottkyScan.py b/script/RFscan/SchottkyScan.py
index 1f7cade..f10aa0c 100644
--- a/script/RFscan/SchottkyScan.py
+++ b/script/RFscan/SchottkyScan.py
@@ -55,9 +55,9 @@ rph.monitored=True
rph0 = rph.read()
#Record callback: uptate of output plot
-def after_sample(record, scan):
- if plt is not None:
- plt.getSeries(0).appendData(record.positions[0], record.values[1].mean, record.values[1].stdev)
+def after_sample(record, scan):
+ if plt is not None:
+ plt.getSeries(0).appendData(record.positions[0], record.values[1].mean, record.values[1].stdev)
try:
rph_averager = create_averager(rph, nb, 0.1) # Set polling time to -1 for BS data to get all messages
@@ -98,5 +98,5 @@ finally:
#Setting the return value
index_max = charge.index(max(charge))
-bph_ref_guess = (start + stop)/2
+bph_ref_guess = 0.0
set_return([bph_ref_guess])
diff --git a/script/test/SchottkyScan.py b/script/test/SchottkyScan.py
new file mode 100644
index 0000000..937d44c
--- /dev/null
+++ b/script/test/SchottkyScan.py
@@ -0,0 +1,102 @@
+import ch.psi.pshell.epics.Positioner as Positioner
+import ch.psi.pshell.epics.ChannelDouble as ChannelDouble
+
+dry_run = True
+
+if get_exec_pars().source == CommandSource.ui:
+ start = -20
+ stop = 150.0
+ step = 5.0
+ nb = 3
+ lat = 0.250
+ plt = None
+else:
+ start = args[0]
+ stop = args[1]
+ step = args[2]
+ nb = int(args[3])
+ lat = args[4]
+ plt = args[5]
+
+if plt is not None:
+ plt.clear()
+ plt.addSeries(LinePlotErrorSeries("Values"))
+ plt.getAxis(plt.AxisId.X).setLabel("Gun Beam Phase (deg)")
+ plt.getAxis(plt.AxisId.Y).setLabel("SINEG01-DICT215:B1_CHARGE")
+
+if dry_run:
+ bph = Positioner("Beam phase", "SINEG01-RSYS:SET-BEAM-PHASE-SIM", "SINEG01-RSYS:SET-BEAM-PHASE-SIM")
+ rph = ChannelDouble('RF phase', "SINEG01-RSYS:SET-VSUM-PHASE-SIM")
+ q = ChannelDouble("Charge", "SINEG01-DICT215:B1_CHARGE-SIM")
+ q.initialize()
+ q.monitored=True
+else:
+ bph = Positioner("Beam phase", "SINEG01-RSYS:SET-BEAM-PHASE", "SINEG01-RSYS:GET-BEAM-PHASE")
+ rph = ChannelDouble('RF phase', "SINEG01-RSYS:SET-VSUM-PHASE")
+ #st = Stream("ICTstream", dispatcher)
+ #q = st.addScalar("Charge", "SINEG01-DICT215:B1_CHARGE", 1, 0)
+ #st.initialize()
+ #st.start()
+ #st.waitValueChange(10000)
+ q = ChannelDouble("Charge", "SINEG01-DICT215:B1_CHARGE")
+ q.initialize()
+ q.monitored=True
+
+bph.config.minValue = -360.0
+bph.config.maxValue = 360.0
+bph.config.precision = 3
+bph.config.rotation = False
+bph.config.resolution = 0.01
+bph.config.save()
+bph.initialize()
+rph.initialize()
+rph.monitored=True
+
+rph0 = rph.read()
+
+#Record callback: uptate of output plot
+def after_sample(record, scan):
+ if plt is not None:
+ plt.getSeries(0).appendData(record.positions[0], record.values[1].mean, record.values[1].stdev)
+
+try:
+ rph_averager = create_averager(rph, nb, 0.1) # Set polling time to -1 for BS data to get all messages
+ q_averager = create_averager(q, nb, 0.1)
+ q_averager.monitored=True
+ r = lscan(bph, (rph_averager, q_averager), start, stop, step, latency=lat, after_read = after_sample)
+ beamphase = r.getPositions(0)
+ rfphase = [val.mean for val in r.getReadable(0)]
+ rfphaserms = [val.stdev for val in r.getReadable(0)]
+ charge = [val.mean for val in r.getReadable(1)]
+ chargerms = [val.stdev for val in r.getReadable(1)]
+finally:
+ rph.write(rph0)
+ bph.close()
+ rph.close()
+ q.close()
+
+##Elog entry
+# Laser = str(caget("SLGTV-LMTO-M055:MOT-KNOWN-POS"))
+# log_msg = "Data file: " + get_exec_pars().path + "\n\n"
+# log_msg = log_msg + "Laser: " + Laser + "\n"
+# if Laser == "Alcor":
+# log_msg = log_msg + "Energy plate: %0.2f" % caget("SLGTH01-LMRM-M074:MOT.RBV") + " deg \n"
+# else:
+# log_msg = log_msg + "Energy plate: %0.2f" % caget("SLGJG-LMRM-M031:MOT.RBV") + " deg \n"
+# if caget("SLGTV-LMTO-M053:MOT-ACT-POS") == "IRIS":
+# log_msg = log_msg + "Collimator: IRIS %0.2f" % caget("SLGTV-LAPP:SIZE-GET") + " mm \n"
+# else:
+# log_msg = log_msg + "Collimator: " + str(caget("SLGTV-LMTO-M053:MOT-ACT-POS")) + "\n"
+# log_msg = log_msg + "Charge: %0.2f" % caget("SINEG01-DICT215:B1_CHARGE-OP") + " pC \n"
+# attachments = []
+# if plt is not None:
+# sleep(0.1) #Give some time to plot to be finished - it is not sync with acquisition
+# file_name = os.path.abspath(get_context().setup.getContextPath() + "/SchottkyScanPlot.png")
+# plt.saveSnapshot(file_name , "png")
+# attachments = [file_name]
+# elog("Schottky scan", log_msg, attachments)
+
+#Setting the return value
+index_max = charge.index(max(charge))
+bph_ref_guess = 0.0
+set_return([bph_ref_guess])
diff --git a/script/test/didier.py b/script/test/didier.py
new file mode 100644
index 0000000..7d0c3b6
--- /dev/null
+++ b/script/test/didier.py
@@ -0,0 +1,33 @@
+import ch.psi.pshell.epics.ChannelDouble as ChannelDouble
+
+t = ChannelDouble("fine delay (ns)", "SINEG01-DICT215:Pul1-Delay-SP-SIM")
+q = ChannelDouble("charge (pC)", "SINEG01-DICT215:AL1-ICT-CHARGE-SIM")
+V = ChannelDouble("DC output (V)", "SINEG01-DICT215:AL1-ICT-VOLTAGE-SIM")
+t.initialize()
+q.initialize()
+V.initialize()
+
+t0 = t.read()
+
+start = 0.0
+stop = 10.0
+step = 0.1
+nb = 2
+lat = 0.080
+
+
+try:
+ q_averager = create_averager(q, nb, lat)
+ V_averager = create_averager(V, nb, lat)
+ V_averager.monitored=True
+ r = lscan(t, (q_averager, V_averager), start, stop, step, latency=lat)
+ delay = r.getPositions(0)
+ charge = [val.mean for val in r.getReadable(0)]
+ chargerms = [val.stdev for val in r.getReadable(0)]
+ volt = [val.mean for val in r.getReadable(1)]
+ voltrms = [val.stdev for val in r.getReadable(1)]
+finally:
+ t.write(t0)
+ t.close()
+ q.close()
+ V.close()