This commit is contained in:
voulot_d
2017-08-16 10:56:28 +02:00
parent 6041d01e53
commit 1207513d79
9 changed files with 137 additions and 215 deletions
+3 -3
View File
@@ -1,6 +1,6 @@
#Tue Aug 15 15:35:39 CEST 2017
maxValue=180.0
minValue=-180.0
#Wed Aug 16 08:28:15 CEST 2017
maxValue=360.0
minValue=-360.0
offset=0.0
precision=3
resolution=0.1
+12 -12
View File
@@ -1,16 +1,16 @@
#Tue Aug 15 14:23:53 CEST 2017
colormap=Rainbow
colormapAutomatic=false
colormapMax=700.0
#Wed Aug 16 10:55:57 CEST 2017
colormap=Flame
colormapAutomatic=true
colormapMax=10340.0
colormapMin=0.0
flipHorizontally=false
flipVertically=false
grayscale=false
imageHeight=1680
imageWidth=1744
imageHeight=2160
imageWidth=2560
invert=false
regionStartX=433
regionStartY=241
regionStartX=1
regionStartY=1
rescaleFactor=1.0
rescaleOffset=0.0
roiHeight=-1
@@ -21,9 +21,9 @@ rotation=0.0
rotationCrop=false
scale=1.0
serverURL=localhost\:10000
spatialCalOffsetX=-221.59249098828724
spatialCalOffsetY=-211.50118443104964
spatialCalScaleX=-26.71415910899799
spatialCalScaleY=-27.100271628191805
spatialCalOffsetX=-679.4902638695637
spatialCalOffsetY=-943.6167484359395
spatialCalScaleX=-7.617446976534296
spatialCalScaleY=-7.7745382884033685
spatialCalUnits=mm
transpose=false
+5 -5
View File
@@ -1,4 +1,4 @@
#Tue Aug 15 14:10:23 CEST 2017
#Wed Aug 16 06:32:36 CEST 2017
colormap=Flame
colormapAutomatic=true
colormapMax=578.797
@@ -18,9 +18,9 @@ roiY=0
rotation=0.0
rotationCrop=false
scale=1.0
spatialCalOffsetX=487.729537366548
spatialCalOffsetY=405.94160583941607
spatialCalScaleX=1.0
spatialCalScaleY=1.0
spatialCalOffsetX=-861.4939970777481
spatialCalOffsetY=-820.4883730911062
spatialCalScaleX=-18.90359092620482
spatialCalScaleY=-19.37984500632817
spatialCalUnits=mm
transpose=false
+54 -23
View File
@@ -1,19 +1,14 @@
import ch.psi.pshell.epics.Positioner as Positioner
import ch.psi.pshell.epics.Camtool as Camtool
#Parameters
dry_run = False
do_elog = True
if get_exec_pars().source == CommandSource.ui:
start = 45.0
stop = 55.0
step = 1.0
nb = 3
lat = 0.3
disp = -0.387
p0 = 7.1
plt = plot(None, title="Output")[0]
else:
is_panel = get_exec_pars().source != CommandSource.ui #must be check before run
run("CPython/wrapper")
#Parameters
if is_panel:
start = args[0]
stop = args[1]
step = args[2]
@@ -22,6 +17,15 @@ else:
disp = args[5]
p0 = args[6]
plt = args[7]
else:
start = 44.0
stop = 65.0
step = 1.0
nb = 3
lat = 0.3
disp = -0.387
p0 = 7.1
plt = plot(None, title="Output")[0]
A = p0 / disp / 1e6
B = p0
@@ -38,16 +42,15 @@ plt.setLegendVisible(True)
#Creating Phase positioner
if dry_run:
phase = Positioner("Phase", "SINEG01-RSYS:SET-BEAM-PHASE-SIM", "SINEG01-RSYS:SET-BEAM-PHASE-SIM")
phase = Positioner("Beam phase", "SINEG01-RSYS:SET-BEAM-PHASE-SIM", "SINEG01-RSYS:SET-BEAM-PHASE-SIM")
camera_name = "simulation"
else:
phase = Positioner("Phase", "SINEG01-RSYS:SET-BEAM-PHASE", "SINEG01-RSYS:GET-BEAM-PHASE")
phase = Positioner("Beam 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.minValue = -360.0
phase.config.maxValue = 360.0
phase.config.precision = 3
phase.config.resolution = 0.01
phase.config.resolution = 0.1
phase.config.rotation = False
phase.config.save()
phase.initialize()
@@ -64,11 +67,11 @@ dx = camtool.stream.getChild("x_fit_standard_deviation")
#Creating averagers
x_averager = create_averager(x, nb, -1) # -1 event based, waits for the next value
dx_averager = create_averager(dx, nb, -1)
dx_averager.monitored=True # not blocking, will return last nb values
dx_averager.monitored = True # not blocking, will return last nb values
#Record callback: uptate of output plot
def after_sample(record, scan):
global A, B
global A, B, plt
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
p_mean, p_stdev = A * x_pos_mean + B, abs(A) * x_pos_stdev
@@ -86,12 +89,38 @@ finally:
phase.close()
camtool.stop() # stops camtool but does not close it camtool is a global object
#Saving metadata
ph = r.getPositions(0)
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)
#Fitting and plotting
try:
i_max = p.index(max(p))
i_min = dp.index(min(dp))
min_i, max_i = max(i_max-5, 0), min(i_max+6, len(p))
(ph_p_max, p_max, ph_p_fit, p_fit) = extremum(ph[min_i:max_i], p[min_i:max_i])
min_i, max_i = max(i_min-5, 0), min(i_min+6, len(dp))
(ph_dp_min, dp_min, ph_dp_fit, dp_fit) = extremum(ph[min_i:max_i], dp[min_i:max_i])
plt.addSeries(LinePlotErrorSeries("Momentum Fit", plt.getSeries(0).color))
plt.addSeries(LinePlotErrorSeries("Momentum Spread Fit", plt.getSeries(1).color, 2))
plt.getSeries(2).setData(ph_p_fit, p_fit)
plt.getSeries(3).setData(ph_dp_fit, dp_fit)
plt.getSeries(2).setPointsVisible(False)
plt.getSeries(3).setPointsVisible(False)
plt.addMarker(ph_p_max, plt.AxisId.X, "%3.2f" % ph_p_max, plt.getSeries(0).color)
plt.addMarker(ph_dp_min, plt.AxisId.X, "%3.2f" % ph_dp_min, plt.getSeries(1).color)
except:
raise Exception("Fit failure")
#Saving metadata
save_dataset(get_exec_pars().group + "/p", p)
set_attribute(get_exec_pars().group + "/p", "ph_p_max", ph_p_max)
set_attribute(get_exec_pars().group + "/p", "p_max", p_max)
save_dataset(get_exec_pars().group + "/dp", dp)
set_attribute(get_exec_pars().group + "/dp", "ph_dp_min", ph_dp_min)
set_attribute(get_exec_pars().group + "/dp", "dp_min", dp_min)
#Elog entry
if do_elog:
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"))
@@ -105,7 +134,9 @@ if do_elog:
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"
log_msg = log_msg + "Charge: %0.2f" % caget("SINEG01-DICT215:B1_CHARGE-OP") + " pC at %0.2f" % phase0 + " deg beam phase\n"
log_msg = log_msg + "p-max: %0.2f" % p_max + " MeV/c at %0.2f" % ph_p_max + " deg beam phase\n"
log_msg = log_msg + "dp-min: %0.2f" % dp_min + " MeV/c at %0.2f" % ph_dp_min + " deg beam phase\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() + "/GunEnergyScanPlot.png")
plt.saveSnapshot(file_name , "png")
+31 -29
View File
@@ -2,13 +2,14 @@ import ch.psi.pshell.epics.Positioner as Positioner
import ch.psi.pshell.epics.ChannelDouble as ChannelDouble
dry_run = False
do_elog = True
if get_exec_pars().source == CommandSource.ui:
start = 50.0
stop = 100.0
step = 5.0
nb = 3
lat = 0.300
start = -50.0
stop = 150.0
step = 2.0
nb = 2
lat = 0.120
plt = None
else:
start = args[0]
@@ -26,13 +27,13 @@ if plt is not None:
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")
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")
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()
@@ -52,6 +53,7 @@ bph.initialize()
rph.initialize()
rph.monitored=True
bph0 = bph.read()
rph0 = rph.read()
#Record callback: uptate of output plot
@@ -71,34 +73,34 @@ try:
chargerms = [val.stdev for val in r.getReadable(1)]
finally:
rph.write(rph0)
#bph.write(bph0)
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)
show_message("E-log entry")
if do_elog:
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"
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 at %0.2f" % bph0 + " deg beam phase\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])
+14 -14
View File
@@ -7,21 +7,21 @@ if get_exec_pars().source == CommandSource.ui:
else:
bph_ref_user = args[0]
plt = args[1]
phaseOffset_old = caget('SINEG01-RSYS:SET-VSUM-PHASE-OFFSET-BASE')
phaseOffset_old = caget("SINEG01-RSYS:SET-VSUM-PHASE-OFFSET-BASE")
phaseOffset_new = phaseOffset_old - bph_ref_user
if not dry_run:
caput('SINEG01-RSYS:SET-VSUM-PHASE-OFFSET-BASE', phaseOffset_new)
caput('SINEG01-RSYS:CMD-LOAD-CALIB-BEAM', 1)
caput("SINEG01-RSYS:SET-VSUM-PHASE-OFFSET-BASE", phaseOffset_new)
caput("SINEG01-RSYS:CMD-LOAD-CALIB-BEAM", 1)
if do_elog:
log_msg = "SINEG01-RSYS:SET-VSUM-PHASE-OFFSET-BASE \n"
log_msg = log_msg + "Old: %0.1f" % phaseOffset_old + "deg \n"
log_msg = log_msg + "New: %0.1f" % phaseOffset_new + "deg \n"
log_msg = log_msg + "Charge on-set at %0.1f" % -phaseOffset_new + "deg RF phase (0.0 deg beam phase)\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() + "/SchottkyScanSetPlot.png")
plt.saveSnapshot(file_name , "png")
attachments = [file_name]
elog("Set gun phase", log_msg, attachments)
log_msg = "SINEG01-RSYS:SET-VSUM-PHASE-OFFSET-BASE \n"
log_msg = log_msg + "Old: %0.1f" % phaseOffset_old + " deg \n"
log_msg = log_msg + "New: %0.1f" % phaseOffset_new + " deg \n"
log_msg = log_msg + "Charge on-set at %0.1f" % -phaseOffset_new + " deg RF phase (0.0 deg beam phase)\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() + "/SchottkyScanSetPlot.png")
plt.saveSnapshot(file_name , "png")
attachments = [file_name]
elog("Set gun phase", log_msg, attachments)
show_message("Success setting phase reference")
+4 -2
View File
@@ -2,7 +2,7 @@ import ch.psi.pshell.epics.Positioner as Positioner
import ch.psi.pshell.epics.ChannelDouble as ChannelDouble
dry_run = True
do_elog = True
do_elog = False
if get_exec_pars().source == CommandSource.ui:
station = "STEST01"
@@ -71,6 +71,8 @@ try:
(fit_amplitude, fit_phase_deg, fit_offset, ph_crest, fit_x, fit_y) = hfitoff(energy , rf_phase)
except:
raise Exception("Fit failure")
"""
# This only works when pshell is visible not in server mode to be fixed
plt = plot(None,name="data")[0]
plt.getSeries(0).setData(to_array(rf_phase,'d'), to_array(energy,'d'))
plt.getSeries(0).setPointSize(8)
@@ -79,7 +81,7 @@ try:
plt.getSeries(1).setData(fit_x, fit_y)
plt.getSeries(1).setPointsVisible(False)
plt.setLegendVisible(True)
"""
caput(station + "-RSYS:GET-ONCREST-VSUM-PHASE", ph_crest)
caput(station + "-RSYS:GET-ONCREST-E-GAIN", fit_amplitude)
caput(station + "-RSYS:GET-FIT-PHASE-ARRAY", fit_x)
-112
View File
@@ -1,112 +0,0 @@
import ch.psi.pshell.epics.Positioner as Positioner
import ch.psi.pshell.epics.Camtool as Camtool
#Parameters
dry_run = True
do_elog = False
if get_exec_pars().source == CommandSource.ui:
start = 45.0
stop = 55.0
step = 1.0
nb = 3
lat = 0.3
disp = -0.387
p0 = 7.1
plt = plot(None, title="Output")[0]
else:
start = args[0]
stop = args[1]
step = args[2]
nb = int(args[3])
lat = args[4]
disp = args[5]
p0 = args[6]
plt = args[7]
A = p0 / disp / 1e6
B = p0
#Plot setup
plt.clear()
plt.setStyle(plt.Style.ErrorY)
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("Momentum (MeV/c)")
plt.getAxis(plt.AxisId.Y2).setLabel("Momentum Spread (MeV/c)")
plt.setLegendVisible(True)
#Creating Phase positioner
if dry_run:
phase = Positioner("Phase", "SINEG01-RSYS:SET-BEAM-PHASE-SIM", "SINEG01-RSYS:SET-BEAM-PHASE-SIM")
camera_name = "simulation"
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.save()
phase.initialize()
phase0 = phase.read()
#Camtool setup
kill_camtool()
check_camtool()
camtool.start(camera_name)
wait_camtool_message()
x = camtool.stream.getChild("x_fit_mean")
dx = camtool.stream.getChild("x_fit_standard_deviation")
#Creating averagers
x_averager = create_averager(x, nb, -1) # -1 event based, waits for the next value
dx_averager = create_averager(dx, nb, -1)
dx_averager.monitored=True # not blocking, will return last nb values
#Record callback: uptate of output plot
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
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:
phase.write(start)
time.sleep(1.0)
r = lscan(phase, [x_averager, dx_averager], start, stop, step , latency=lat, after_read = after_sample)
finally:
phase.write(phase0)
phase.close()
camtool.stop() # stops camtool but does not close it camtool is a global object
#Saving metadata
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)
#Elog entry
if do_elog:
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"
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 at %0.2f" % phase0 + " deg beam phase\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() + "/GunEnergyScanPlot.png")
plt.saveSnapshot(file_name , "png")
elog("Gun Energy Scan", log_msg, [file_name,])
+14 -15
View File
@@ -1,11 +1,13 @@
import ch.psi.pshell.epics.Positioner as Positioner
import ch.psi.pshell.epics.Camtool as Camtool
dry_run = False
do_elog = True
is_panel = get_exec_pars().source != CommandSource.ui #must be check before run
run("CPython/wrapper")
#Parameters
dry_run = True
do_elog = False
if is_panel:
start = args[0]
stop = args[1]
@@ -16,8 +18,8 @@ if is_panel:
p0 = args[6]
plt = args[7]
else:
start = 45.0
stop = 55.0
start = 44.0
stop = 65.0
step = 1.0
nb = 3
lat = 0.3
@@ -45,8 +47,8 @@ if dry_run:
else:
phase = Positioner("Beam 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.minValue = -360.0
phase.config.maxValue = 360.0
phase.config.precision = 3
phase.config.resolution = 0.1
phase.config.rotation = False
@@ -91,27 +93,25 @@ ph = r.getPositions(0)
p = [A * val.mean + B for val in r.getReadable(0)]
dp = [abs(A) * val.mean for val in r.getReadable(1)]
#Fitting and plotting
try:
plt.addSeries(LinePlotErrorSeries("Momentum Fit", plt.getSeries(0).color))
plt.addSeries(LinePlotErrorSeries("Momentum Spread Fit", plt.getSeries(1).color, 2))
i_max = p.index(max(p))
i_min = dp.index(min(dp))
min_i, max_i = max(i_max-5, 0), min(i_max+6, len(p))
print min_i, max_i
(ph_p_max, p_max, ph_p_fit, p_fit) = extremum(ph[min_i:max_i], p[min_i:max_i])
min_i, max_i = max(i_min-5, 0), min(i_min+6, len(p))
print min_i, max_i
min_i, max_i = max(i_min-5, 0), min(i_min+6, len(dp))
(ph_dp_min, dp_min, ph_dp_fit, dp_fit) = extremum(ph[min_i:max_i], dp[min_i:max_i])
plt.addSeries(LinePlotErrorSeries("Momentum Fit", plt.getSeries(0).color))
plt.addSeries(LinePlotErrorSeries("Momentum Spread Fit", plt.getSeries(1).color, 2))
plt.getSeries(2).setData(ph_p_fit, p_fit)
plt.getSeries(3).setData(ph_dp_fit, dp_fit)
plt.getSeries(2).setPointsVisible(False)
plt.getSeries(3).setPointsVisible(False)
plt.addMarker(ph_p_max, plt.AxisId.X, "%2.2f" % ph_p_max, plt.getSeries(0).color)
plt.addMarker(ph_dp_min, plt.AxisId.X, "%2.2f" % ph_dp_min, plt.getSeries(1).color)
plt.addMarker(ph_p_max, plt.AxisId.X, "%3.2f" % ph_p_max, plt.getSeries(0).color)
plt.addMarker(ph_dp_min, plt.AxisId.X, "%3.2f" % ph_dp_min, plt.getSeries(1).color)
except:
raise Exception("Fit failure")
#Saving metadata
save_dataset(get_exec_pars().group + "/p", p)
set_attribute(get_exec_pars().group + "/p", "ph_p_max", ph_p_max)
@@ -120,7 +120,6 @@ save_dataset(get_exec_pars().group + "/dp", dp)
set_attribute(get_exec_pars().group + "/dp", "ph_dp_min", ph_dp_min)
set_attribute(get_exec_pars().group + "/dp", "dp_min", dp_min)
#Elog entry
if do_elog:
if get_option("Generated data file:\n" + get_exec_pars().path +"\n\n" + "Save to ELOG?", "YesNo") == "Yes":