This commit is contained in:
root
2017-12-05 09:01:44 +01:00
parent dd236b2356
commit a2928d0eb3
19 changed files with 1339 additions and 933 deletions
+12 -2
View File
@@ -286,6 +286,16 @@ def get_wire_scanners_blms(wire_scan):
ret.append(None)
return ret
#for w in get_wire_scanners():
# print w, get_wire_scanners_blms(w)
def get_camera_type(camera_name):
if "LCAM" in camera_name: return "LASER"
if "DSCR" in camera_name or \
"DSRM" in camera_name or \
"DLAC" in camera_name: return "ELECTRONS"
if "PROF" in camera_name or \
"PPRM" in camera_name or \
"PSSS" in camera_name or \
"PSCR" in camera_name or \
"PSRD" in camera_name: return "PHOTONICS"
return "UNKNOWN"
+4 -1
View File
@@ -18,6 +18,7 @@ bpms = args[5] if is_panel else get_wire_scanners_bpms(prefix)
blms = args[6] if is_panel else get_wire_scanners_blms(prefix)
bkgrd = args[7] if is_panel else 10
plt = args[8] if is_panel else plot(None, title = "Wire Scan")[0]
save_raw = args[9] if is_panel else False
do_elog = True if is_panel else True
print "WireScan parameters: ", prefix, scan_type, scan_range, cycles, velocity, bpms, blms, bkgrd
@@ -47,10 +48,12 @@ for i in range (len(blms)):
plt.addSeries(series)
series.setLinesVisible(False)
series.setPointSize(2)
if save_raw:
channels.append (("blm" + str(i+1) + "_raw" , blms[i] + ":LOSS_SIGNAL_RAW"))
for i in range (len(bpms)):
for sensor in BPM_SENSORS:
channels.append (("bpm" + str(i+1) + "_" + sensor[0], bpms[i] + ":" + sensor[1]))
#Metadata
set_attribute("/", "Wire Scanner", prefix)
set_attribute("/", "Scan Type", scan_type)
+3
View File
@@ -151,3 +151,6 @@ if do_elog:
file_name = os.path.abspath(get_context().setup.getContextPath() + "/GunEnergyScanPlot.png")
plt.saveSnapshot(file_name , "png")
elog("Gun Energy Scan", log_msg, [file_name,])
set_return(ph_dp_min)
+24
View File
@@ -0,0 +1,24 @@
dry_run = False
do_elog = True
if get_exec_pars().source == CommandSource.ui:
bph_ref_user = 19.0
plt = None
else:
bph_ref_user = args[0]
plt = args[1]
phase_offset_old = caget("SINEG01-RSYS:SET-VSUM-PHASE-OFFSET-BASE")
phase_offset_new = 90 - bph_ref_user + phaseOffset_old
if not dry_run:
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: %0.2f" % phase_offset_new + " deg (was %0.2f" % phase_offset_old + " deg)\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() + "/GunEnergyScanSet.png")
plt.saveSnapshot(file_name , "png")
attachments = [file_name]
elog("Set gun phase", log_msg, attachments)
show_message("Success setting phase reference")
+10 -5
View File
@@ -1,10 +1,16 @@
import json
import java.math.BigInteger as BigInteger
import org.python.core.PyLong as PyLong
import org.python.core.PyFloat as PyFloat
import traceback
import datetime
run("Devices/Elements")
def get_processing_parameters(stream_value):
return json.loads(stream_value.getValue("processing_parameters"))
def _create_tables(paths, stream_value, data_type, shape):
def _create_tables(paths, stream_value, data_type, shape, images):
root = paths["root"]
create_dataset(paths["image"], data_type, dimensions = [images, shape[0], shape[1]])
create_dataset(paths["pid"], 'l', dimensions = [images])
@@ -60,7 +66,7 @@ def _append_frame(paths, stream_value, index, data_type, shape):
print "Saved frame: ", index
def _write_metadata(paths, camera, images = 1, interval = -1):
def _write_metadata(paths, camera, images, interval):
root = paths["root"]
set_attribute(root, "Camera", camera)
set_attribute(root, "Images", images)
@@ -90,9 +96,8 @@ def save_camera_data(server, images = 1, interval = -1, root = "/camera1", paral
for i in range(images):
print i
if i==0:
_create_tables(paths, stream_value, data_type, shape)
_write_metadata(paths, camera, images, interval)
_create_tables(paths, stream_value, data_type, shape, images)
_write_metadata(paths, camera, images, interval)
start = time.time()
stream_value = server.stream.take()
if parallel:
-5
View File
@@ -1,10 +1,5 @@
import ch.psi.pshell.imaging.ImageBuffer as ImageBuffer
import java.math.BigInteger as BigInteger
import org.python.core.PyLong as PyLong
import org.python.core.PyFloat as PyFloat
import json
import traceback
import datetime
import ch.psi.pshell.bs.PipelineServer as PipelineServer
import ch.psi.pshell.imaging.Colormap as Colormap
-13
View File
@@ -58,19 +58,6 @@ def is_timing_ok():
def get_repetition_rate():
return caget("SIN-TIMAST-TMA:Evt-15-Freq-I")
def bsget(channel):
"""
"""
st = Stream(None, dispatcher)
try:
st.addScalar(channel, channel, 10, 0)
st.initialize()
st.start();
st.waitValueNot(None, 5000)
return st.getValue(channel)
finally:
st.close()
###################################################################################################
+3 -5
View File
@@ -2,7 +2,7 @@ dry_run = True
do_elog = True
if get_exec_pars().source == CommandSource.ui:
bph_ref_user = 0.0
bph_ref_user = 19.0
plt = None
else:
bph_ref_user = args[0]
@@ -13,13 +13,11 @@ if not dry_run:
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 = "SINEG01-RSYS:SET-VSUM-PHASE-OFFSET-BASE: %0.2f" % phase_offset_new + " deg (was %0.2f" % phase_offset_old + " deg)\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")
file_name = os.path.abspath(get_context().setup.getContextPath() + "/GunEnergyScanSet.png")
plt.saveSnapshot(file_name , "png")
attachments = [file_name]
elog("Set gun phase", log_msg, attachments)
+4
View File
@@ -0,0 +1,4 @@
devlist = ['01', '02', '03', '04', '05', '06', '07', '08']
for dev in devlist:
caput("S10CB" + dev + "-RSYS:SET-BEAM-PHASE", 83.5)