Startup
This commit is contained in:
9
config/mail.properties
Normal file
9
config/mail.properties
Normal file
@@ -0,0 +1,9 @@
|
||||
#Mon Oct 23 10:33:20 CEST 2017
|
||||
auth=None
|
||||
from=
|
||||
host=
|
||||
port=0
|
||||
pwd=
|
||||
smsSuffix=@sms.switch.ch
|
||||
to=
|
||||
usr=
|
||||
38
script/Photonics/KValueScan.py
Normal file
38
script/Photonics/KValueScan.py
Normal file
@@ -0,0 +1,38 @@
|
||||
CAMERA = "SARBD01-DSCR110"
|
||||
GAP = "SARUN15-UIND030"
|
||||
SAMPLES = 20
|
||||
TOLERANCE = 0.01
|
||||
TIMEOUT = 10.0
|
||||
|
||||
#shared stream - make sure the camera is running on a screenpanel on the same console!
|
||||
cam_server.start(CAMERA + "_sp1", True)
|
||||
|
||||
intensity = cam_server.stream.getChild("intensity")
|
||||
|
||||
gap = Channel(GAP + ":K_SET", alias = "gap")
|
||||
#readout = Channel(GAP + ":GAP")
|
||||
|
||||
av = create_averager(intensity, SAMPLES, interval = -1, name = None)
|
||||
|
||||
def before(position, scan):
|
||||
caput(GAP + ":GO", 1)
|
||||
start = time.time()
|
||||
# while abs(readout.read() - gap.read()) > TOLERANCE:
|
||||
time.sleep(0.1)
|
||||
# if time.time() - start > TIMEOUT:
|
||||
# raise Exception ("Timeout waiting gap change")
|
||||
|
||||
ret = lscan (gap, av, 1.195, 1.205, 21, latency=1.0, before_read=before)
|
||||
|
||||
|
||||
#run("CPython/wrapper")
|
||||
#xdata = ret.getPositions(0)
|
||||
#ydata = ret.getReadable(0)
|
||||
#(fit_amplitude, fit_phase_deg, fit_offset, ph_crest, fit_x, fit_y) = hfitoff(ydata , xdata)
|
||||
#print fit_amplitude, fit_phase_deg, fit_offset
|
||||
#plt = get_plots()[0]
|
||||
#if plt is not None:
|
||||
# plt.addSeries(LinePlotErrorSeries("fit"))
|
||||
# plt.getSeries(1).setData(fit_x, fit_y)
|
||||
# plt.getSeries(1).setPointsVisible(False)
|
||||
# plt.setLegendVisible(True)
|
||||
38
script/Photonics/PhaseShifterScan.py
Normal file
38
script/Photonics/PhaseShifterScan.py
Normal file
@@ -0,0 +1,38 @@
|
||||
CAMERA = "SARBD01-DSCR110"
|
||||
GAP = "SARUN10-UPHS060"
|
||||
SAMPLES = 20
|
||||
TOLERANCE = 0.01
|
||||
TIMEOUT = 10.0
|
||||
|
||||
#shared stream - make sure the camera is running on a screenpanel on the same console!
|
||||
cam_server.start(CAMERA + "_sp1", True)
|
||||
|
||||
intensity = cam_server.stream.getChild("intensity")
|
||||
|
||||
gap = Channel(GAP + ":GAP_SP", alias = "gap")
|
||||
readout = Channel(GAP + ":GAP")
|
||||
|
||||
av = create_averager(intensity, SAMPLES, interval = -1, name = None)
|
||||
|
||||
def before(position, scan):
|
||||
caput(GAP + ":GO", 1)
|
||||
start = time.time()
|
||||
while abs(readout.read() - gap.read()) > TOLERANCE:
|
||||
time.sleep(0.1)
|
||||
if time.time() - start > TIMEOUT:
|
||||
raise Exception ("Timeout waiting gap change")
|
||||
|
||||
ret = lscan (gap, av, 17.5, 20, 40, latency=1.0, before_read=before)
|
||||
|
||||
|
||||
#run("CPython/wrapper")
|
||||
#xdata = ret.getPositions(0)
|
||||
#ydata = ret.getReadable(0)
|
||||
#(fit_amplitude, fit_phase_deg, fit_offset, ph_crest, fit_x, fit_y) = hfitoff(ydata , xdata)
|
||||
#print fit_amplitude, fit_phase_deg, fit_offset
|
||||
#plt = get_plots()[0]
|
||||
#if plt is not None:
|
||||
# plt.addSeries(LinePlotErrorSeries("fit"))
|
||||
# plt.getSeries(1).setData(fit_x, fit_y)
|
||||
# plt.getSeries(1).setPointsVisible(False)
|
||||
# plt.setLegendVisible(True)
|
||||
55
script/Tools/save_snapshot.py
Normal file
55
script/Tools/save_snapshot.py
Normal file
@@ -0,0 +1,55 @@
|
||||
import ch.psi.pshell.imaging.ImageBuffer as ImageBuffer
|
||||
import java.math.BigInteger as BigInteger
|
||||
import org.python.core.PyLong as PyLong
|
||||
import json
|
||||
|
||||
if get_exec_pars().source == CommandSource.ui:
|
||||
camera_name = "SLG-LCAM-C041"
|
||||
shared = True
|
||||
logbook = "SwissFEL commissioning data"
|
||||
comment = "Test"
|
||||
else:
|
||||
camera_name = args[0]
|
||||
shared = args[1].lower() == "true"
|
||||
logbook = args[2]
|
||||
comment = args[3]
|
||||
|
||||
set_exec_pars(name="camera_snapshot")
|
||||
path = "/image"
|
||||
snapshotFile = None
|
||||
|
||||
if shared:
|
||||
cam_server.start(camera_name + "_sp1", shared)
|
||||
else:
|
||||
cam_server.start(camera_name)
|
||||
|
||||
cam_server.waitNext(10000)
|
||||
|
||||
stream_value = cam_server.stream.take()
|
||||
|
||||
save_dataset(path, cam_server.data.matrix)
|
||||
for id in stream_value.identifiers:
|
||||
val = stream_value.getValue(id)
|
||||
if id == "image":
|
||||
pass
|
||||
elif id == "processing_parameters":
|
||||
val = json.loads(val)
|
||||
for key in val.keys():
|
||||
set_attribute(path, key, "" if val[key] is None else val[key] )
|
||||
elif isinstance(val, PyArray):
|
||||
save_dataset("/"+id, val)
|
||||
elif isinstance(val, PyLong):
|
||||
save_dataset("/"+id, int(val))
|
||||
else:
|
||||
set_attribute(path, id, val)
|
||||
|
||||
set_exec_pars(open = False)
|
||||
#Enforce the same timestamp to data & image files.
|
||||
snapshot_file = get_exec_pars().path+ ".png";
|
||||
ImageBuffer.saveImage(cam_server.output, snapshot_file, "png");
|
||||
|
||||
msg = "Camera: " + camera_name
|
||||
msg += "\nShared: " + str(shared)
|
||||
msg += "\nData file: " + str(get_exec_pars().path)
|
||||
msg += "\nComment: " + str(comment)
|
||||
elog("Camera Snapshot", msg, [snapshot_file,], logbook=logbook)
|
||||
10
script/Tools/save_snapshot_client.py
Normal file
10
script/Tools/save_snapshot_client.py
Normal file
@@ -0,0 +1,10 @@
|
||||
|
||||
def save_snapshot(camera_name = "SLG-LCAM-C041", shared = True, logbook = "SwissFEL commissioning data", comment = ""):
|
||||
import requests
|
||||
base = "http://sf-daq-mgmt:8090/"
|
||||
url = base + "run/Tools/save_snapshot(%s,%s,%s,%s)" % (camera_name, str(shared), logbook, "'" + str(comment) + "'")
|
||||
r = requests.get(url)
|
||||
if r.status_code != 200:
|
||||
raise Exception(r.text)
|
||||
|
||||
save_snapshot()
|
||||
56
script/save_snapshot.py
Normal file
56
script/save_snapshot.py
Normal file
@@ -0,0 +1,56 @@
|
||||
import ch.psi.pshell.imaging.ImageBuffer as ImageBuffer
|
||||
import java.math.BigInteger as BigInteger
|
||||
import org.python.core.PyLong as PyLong
|
||||
import json
|
||||
|
||||
if get_exec_pars().source == CommandSource.ui:
|
||||
camera_name = "SLG-LCAM-C041"
|
||||
shared = True
|
||||
logbook = "SwissFEL commissioning data"
|
||||
comment = "Test"
|
||||
else:
|
||||
camera_name = args[0]
|
||||
shared = args[1].lower == "true"
|
||||
logbook = args[2]
|
||||
comment = args[3]
|
||||
|
||||
|
||||
set_exec_pars(name="camera_snapshot")
|
||||
path = "/image"
|
||||
snapshotFile = None
|
||||
|
||||
if shared:
|
||||
cam_server.start(camera_name + "_sp1", shared)
|
||||
else:
|
||||
cam_server.start(camera_name)
|
||||
|
||||
cam_server.waitNext(10000)
|
||||
|
||||
stream_value = cam_server.stream.take()
|
||||
|
||||
save_dataset(path, cam_server.data.matrix)
|
||||
for id in stream_value.identifiers:
|
||||
val = stream_value.getValue(id)
|
||||
if id == "image":
|
||||
pass
|
||||
elif id == "processing_parameters":
|
||||
val = json.loads(val)
|
||||
for key in val.keys():
|
||||
set_attribute(path, key, "" if val[key] is None else val[key] )
|
||||
elif isinstance(val, PyArray):
|
||||
save_dataset("/"+id, val)
|
||||
elif isinstance(val, PyLong):
|
||||
save_dataset("/"+id, int(val))
|
||||
else:
|
||||
set_attribute(path, id, val)
|
||||
|
||||
set_exec_pars(open = False)
|
||||
#Enforce the same timestamp to data & image files.
|
||||
snapshot_file = get_exec_pars().path+ ".png";
|
||||
ImageBuffer.saveImage(cam_server.output, snapshot_file, "png");
|
||||
|
||||
msg = "Camera: " + camera_name
|
||||
msg += "\nShared: " + str(shared)
|
||||
msg += "\nData file: " + str(get_exec_pars().path)
|
||||
msg += "\nComment: " + str(comment)
|
||||
elog("Camera Snapshot", msg, [snapshot_file,], logbook=logbook)
|
||||
66
script/test/SaveCamera.py
Normal file
66
script/test/SaveCamera.py
Normal file
@@ -0,0 +1,66 @@
|
||||
import ch.psi.pshell.imaging.ImageBuffer as ImageBuffer
|
||||
import java.math.BigInteger as BigInteger
|
||||
import org.python.core.PyLong as PyLong
|
||||
import json
|
||||
|
||||
if get_exec_pars().source == CommandSource.ui:
|
||||
camera_name = "SLG-LCAM-C041"
|
||||
else:
|
||||
camera_name =args[0]
|
||||
|
||||
|
||||
set_exec_pars(name="snapshot")
|
||||
path = "/image"
|
||||
snapshotFile = None
|
||||
|
||||
|
||||
|
||||
|
||||
#cam_server.start(camera_name + "_sp", camera_name + "_sp1")
|
||||
cam_server.start(camera_name + "_sp1", True)
|
||||
cam_server.waitNext(10000)
|
||||
|
||||
stream_value = cam_server.stream.take()
|
||||
|
||||
save_dataset(path, cam_server.data.matrix)
|
||||
for id in stream_value.identifiers:
|
||||
val = stream_value.getValue(id)
|
||||
if id == "image":
|
||||
pass
|
||||
elif id == "processing_parameters":
|
||||
val = json.loads(val)
|
||||
for key in val.keys():
|
||||
set_attribute(path, key, "" if val[key] is None else val[key] )
|
||||
elif isinstance(val, PyArray):
|
||||
save_dataset("/"+id, val)
|
||||
elif isinstance(val, PyLong):
|
||||
save_dataset("/"+id, int(val))
|
||||
else:
|
||||
print id, val
|
||||
set_attribute(path, id, val)
|
||||
|
||||
|
||||
|
||||
#writeFrameMetadata(path, id);
|
||||
|
||||
set_exec_pars(open = False)
|
||||
#Enforce the same timestamp to data & image files.
|
||||
snapshot_file = get_exec_pars().path+ ".png";
|
||||
|
||||
|
||||
#ImageBuffer.saveImage(cam_server.output, snapshot_file, "png");
|
||||
|
||||
"""
|
||||
StringBuilder message = new StringBuilder();
|
||||
message.append("Camera: ").append(cameraName).append(" (").
|
||||
append((server != null) ? "server" : "direct").append(")").append("\n");
|
||||
message.append("Screen: ").append(String.valueOf(valueScreen.getLabel().getText())).append("\n");
|
||||
message.append("Filter: ").append(String.valueOf(valueFilter.getLabel().getText())).append("\n");
|
||||
message.append("Data file: ").append(getContext().getExecutionPars().getPath()).append("\n");
|
||||
message.append("Comment: ").append(textComment.getText()).append("\n");
|
||||
if ((fitOv != null) && (fitOv.length > 5)) {
|
||||
Overlays.Text text = (Overlays.Text) fitOv[5];
|
||||
message.append(text.getText()).append("\n");
|
||||
}
|
||||
elog((String) comboLogbook.getSelectedItem(), "ScreenPanel Snapshot", message.toString(), new String[]{snapshotFile});
|
||||
"""
|
||||
Reference in New Issue
Block a user