Creation
This commit is contained in:
28
config/config.properties
Normal file
28
config/config.properties
Normal file
@@ -0,0 +1,28 @@
|
||||
#Tue Aug 29 17:25:22 CEST 2017
|
||||
autoSaveScanData=true
|
||||
createSessionFiles=false
|
||||
dataLayout=default
|
||||
dataPath={data}/{year}_{month}/{date}/{date}_{time}_{name}
|
||||
dataProvider=h5
|
||||
dataScanFlushRecords=false
|
||||
dataScanPreserveTypes=false
|
||||
dataScanReleaseRecords=false
|
||||
dataServerPort=-1
|
||||
hostName=null
|
||||
instanceName=
|
||||
logDaysToLive=-1
|
||||
logLevel=Info
|
||||
logLevelConsole=Off
|
||||
logPath={logs}/{date}_{time}
|
||||
scanStreamerPort=-1
|
||||
serverEnabled=false
|
||||
serverPort=8080
|
||||
simulation=false
|
||||
terminalEnabled=false
|
||||
terminalPort=3579
|
||||
userAuthenticator=
|
||||
userManagement=false
|
||||
versionTrackingEnabled=true
|
||||
versionTrackingLogin={context}/svcusr-hlapp_robot
|
||||
versionTrackingManual=false
|
||||
versionTrackingRemote=git@git.psi.ch\:pshell_config/sf-ph.git
|
||||
6
config/devices.properties
Normal file
6
config/devices.properties
Normal file
@@ -0,0 +1,6 @@
|
||||
dispatcher=ch.psi.pshell.bs.Dispatcher|https://dispatcher-api.psi.ch/sf|||
|
||||
cam_server=ch.psi.pshell.bs.PipelineServer|sf-daqsync-01:8889|||
|
||||
pbpg_mx=ch.psi.pshell.epics.Motor|SARFE10-PBPG050:MOTOR_X|||true
|
||||
pbpg_my=ch.psi.pshell.epics.Motor|SARFE10-PBPG050:MOTOR_Y|||true
|
||||
adc_xh1=ch.psi.pshell.epics.ChannelInteger|SARFE10-PBPG050:HAMP-014-x-h1-DATA-SUM|||true
|
||||
adc_yh2=ch.psi.pshell.epics.ChannelInteger|SARFE10-PBPG050:HAMP-011-y-h2-DATA-SUM|||true
|
||||
11
config/jcae.properties
Normal file
11
config/jcae.properties
Normal file
@@ -0,0 +1,11 @@
|
||||
#Tue Aug 29 17:00:35 CEST 2017
|
||||
ch.psi.jcae.ContextFactory.addressList=172.26.0.255 172.26.2.255 172.26.8.255 172.26.16.255 172.26.24.255 172.26.32.255 172.26.40.255 172.26.120.255
|
||||
ch.psi.jcae.ContextFactory.serverPort=
|
||||
ch.psi.jcae.ContextFactory.maxArrayBytes=50000000
|
||||
ch.psi.jcae.ChannelFactory.retries=1
|
||||
ch.psi.jcae.ChannelFactory.timeout=1250
|
||||
ch.psi.jcae.impl.DefaultChannelService.retries=4
|
||||
ch.psi.jcae.impl.DefaultChannelService.timeout=1000
|
||||
ch.psi.jcae.ContextFactory.autoAddressList=true
|
||||
ch.psi.jcae.ContextFactory.useShellVariables=true
|
||||
ch.psi.jcae.ContextFactory.addLocalBroadcastInterfaces=false
|
||||
18
config/setup.properties
Normal file
18
config/setup.properties
Normal file
@@ -0,0 +1,18 @@
|
||||
#Tue Aug 29 16:56:43 CEST 2017
|
||||
configFile={config}/config.properties
|
||||
configFileDevices={config}/devices.properties
|
||||
configFilePlugins={config}/plugins.properties
|
||||
configFileTasks={config}/tasks.properties
|
||||
configPath={home}/config
|
||||
contextPath={outp}/context
|
||||
dataPath={outp}/data
|
||||
devicesPath={home}/devices
|
||||
extensionsPath={home}/extensions
|
||||
imagesPath={outp}/images
|
||||
libraryPath={script}; {script}/Lib
|
||||
logPath={outp}/log
|
||||
pluginsPath={home}/plugins
|
||||
scriptPath={home}/script
|
||||
scriptType=py
|
||||
sessionsPath={outp}/sessions
|
||||
wwwPath={home}/www
|
||||
24
devices/cam_server.properties
Normal file
24
devices/cam_server.properties
Normal file
@@ -0,0 +1,24 @@
|
||||
#Tue Aug 29 17:10:09 CEST 2017
|
||||
colormap=Flame
|
||||
colormapAutomatic=true
|
||||
colormapMax=NaN
|
||||
colormapMin=NaN
|
||||
flipHorizontally=false
|
||||
flipVertically=false
|
||||
grayscale=false
|
||||
invert=false
|
||||
rescaleFactor=1.0
|
||||
rescaleOffset=0.0
|
||||
roiHeight=-1
|
||||
roiWidth=-1
|
||||
roiX=0
|
||||
roiY=0
|
||||
rotation=0.0
|
||||
rotationCrop=false
|
||||
scale=1.0
|
||||
spatialCalOffsetX=-50.03909304143862
|
||||
spatialCalOffsetY=-50.048875855327466
|
||||
spatialCalScaleX=-1.0
|
||||
spatialCalScaleY=-1.0
|
||||
spatialCalUnits=mm
|
||||
transpose=false
|
||||
6
devices/dispatcher.properties
Normal file
6
devices/dispatcher.properties
Normal file
@@ -0,0 +1,6 @@
|
||||
#Tue Aug 29 17:27:27 CEST 2017
|
||||
disableCompression=false
|
||||
dropIncomplete=false
|
||||
keepListeningOnStop=false
|
||||
parallelHandlerProcessing=true
|
||||
socketType=DEFAULT
|
||||
15
devices/pbpg_mx.properties
Normal file
15
devices/pbpg_mx.properties
Normal file
@@ -0,0 +1,15 @@
|
||||
#Tue Aug 29 17:00:42 CEST 2017
|
||||
defaultSpeed=1.5
|
||||
estbilizationDelay=0
|
||||
hasEnable=false
|
||||
homingType=None
|
||||
maxSpeed=10.0
|
||||
maxValue=0.8
|
||||
minSpeed=NaN
|
||||
minValue=-0.6
|
||||
offset=0.0
|
||||
precision=3
|
||||
resolution=0.001
|
||||
rotation=false
|
||||
scale=1.0
|
||||
unit=mm
|
||||
15
devices/pbpg_my.properties
Normal file
15
devices/pbpg_my.properties
Normal file
@@ -0,0 +1,15 @@
|
||||
#Tue Aug 29 17:00:42 CEST 2017
|
||||
defaultSpeed=1.5
|
||||
estbilizationDelay=0
|
||||
hasEnable=false
|
||||
homingType=None
|
||||
maxSpeed=10.0
|
||||
maxValue=1.0
|
||||
minSpeed=NaN
|
||||
minValue=-1.4
|
||||
offset=0.0
|
||||
precision=3
|
||||
resolution=0.001
|
||||
rotation=false
|
||||
scale=1.0
|
||||
unit=mm
|
||||
34
script/PbpgPosScan.py
Normal file
34
script/PbpgPosScan.py
Normal file
@@ -0,0 +1,34 @@
|
||||
from mathutils import fit_polynomial
|
||||
from mathutils import PolynomialFunction
|
||||
import math
|
||||
from plotutils import plot_function
|
||||
print "Starting"
|
||||
|
||||
|
||||
#Creating averaging devices
|
||||
av_adc_xh1 = create_averager(adc_xh1, count = 10, interval = -1, name = "av_adc_xh1")
|
||||
av_adc_xh2 = create_averager(adc_yh2, count = 10, interval = -1, name = "av_adc_xh2")
|
||||
av_adc_xh2.monitored = True
|
||||
|
||||
#The actuals scan
|
||||
r=lscan(pbpg_mx, [av_adc_xh1, av_adc_xh2], 0.0, 0.5, 10, latency = 0.0)
|
||||
|
||||
#Fitting
|
||||
values = to_array(r.getReadable(0), 'd')
|
||||
positions = r.getPositions(0)
|
||||
pars_polynomial = (a0, a1, a2) = fit_polynomial(values, positions, 2)
|
||||
|
||||
#Writing metadata to data file
|
||||
path = get_exec_pars().scanPath
|
||||
set_attribute(path, "a0", a0)
|
||||
set_attribute(path, "a1", a1)
|
||||
set_attribute(path, "a2", a2)
|
||||
|
||||
#Plotting fit and writing fitting parameters
|
||||
outp = "a0="+ ("%0.4f" % a0) + "a1="+ ("%0.4f" % a1) + "a2="+ ("%0.4f" % a2)
|
||||
print outp
|
||||
p = get_plots()[0]
|
||||
p.addText((min(positions) + max(positions))/2, max(values), outp, Color.BLACK)
|
||||
plot_function(p, PolynomialFunction(pars_polynomial), "Fit",positions, show_points = False, show_lines = True, color = Color.BLUE)
|
||||
|
||||
|
||||
3
script/local.groovy
Normal file
3
script/local.groovy
Normal file
@@ -0,0 +1,3 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Deployment specific global definitions - executed after startup.groovy
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
4
script/local.js
Normal file
4
script/local.js
Normal file
@@ -0,0 +1,4 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Deployment specific global definitions - executed after startup.js
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
99
script/local.py
Normal file
99
script/local.py
Normal file
@@ -0,0 +1,99 @@
|
||||
###################################################################################################
|
||||
# Deployment specific global definitions - executed after startup.py
|
||||
###################################################################################################
|
||||
|
||||
#Device pool customization
|
||||
pbpg_mx.setTrustedWrite(False)
|
||||
pbpg_my.setTrustedWrite(False)
|
||||
|
||||
|
||||
#Utilities
|
||||
def fit(ydata, xdata = None):
|
||||
"""
|
||||
Gaussian fit
|
||||
"""
|
||||
if xdata is None:
|
||||
xdata = frange(0, len(ydata), 1)
|
||||
#ydata = to_list(ydata)
|
||||
#xdata = to_list(xdata)
|
||||
max_y= max(ydata)
|
||||
index_max = ydata.index(max_y)
|
||||
max_x= xdata[index_max]
|
||||
print "Max index:" + str(index_max),
|
||||
print " x:" + str(max_x),
|
||||
print " y:" + str(max_y)
|
||||
gaussians = fit_gaussians(ydata, xdata, [index_max,])
|
||||
(norm, mean, sigma) = gaussians[0]
|
||||
p = plot([ydata],["data"],[xdata], title="Fit" )[0]
|
||||
fitted_gaussian_function = Gaussian(norm, mean, sigma)
|
||||
scale_x = [float(min(xdata)), float(max(xdata)) ]
|
||||
points = max((len(xdata)+1), 100)
|
||||
resolution = (scale_x[1]-scale_x[0]) / points
|
||||
fit_y = []
|
||||
fit_x = frange(scale_x[0],scale_x[1],resolution, True)
|
||||
for x in fit_x:
|
||||
fit_y.append(fitted_gaussian_function.value(x))
|
||||
p.addSeries(LinePlotSeries("fit"))
|
||||
p.getSeries(1).setData(fit_x, fit_y)
|
||||
|
||||
if abs(mean - xdata[index_max]) < ((scale_x[0] + scale_x[1])/2):
|
||||
print "Mean -> " + str(mean)
|
||||
p.addMarker(mean, None, "Mean="+str(round(norm,2)), Color.MAGENTA.darker())
|
||||
return (norm, mean, sigma)
|
||||
else:
|
||||
p.addMarker(max_x, None, "Max="+str(round(max_x,2)), Color.GRAY)
|
||||
print "Invalid gaussian fit: " + str(mean)
|
||||
return (None, None, None)
|
||||
|
||||
|
||||
def elog(title, message, attachments = [], author = None, category = "Info", domain = "", logbook = "SwissFEL commissioning data", encoding=1):
|
||||
"""
|
||||
Add entry to ELOG.
|
||||
"""
|
||||
if author is None:
|
||||
author = "pshell" #get_context().user.name
|
||||
typ = "pshell"
|
||||
entry = ""
|
||||
|
||||
cmd = 'G_CS_ELOG_add -l "' + logbook + '" '
|
||||
cmd = cmd + '-a "Author=' + author + '" '
|
||||
cmd = cmd + '-a "Type=' + typ + '" '
|
||||
cmd = cmd + '-a "Entry=' + entry + '" '
|
||||
cmd = cmd + '-a "Title=' + title + '" '
|
||||
cmd = cmd + '-a "Category=' + category + '" '
|
||||
cmd = cmd + '-a "Domain=' + domain + '" '
|
||||
for attachment in attachments:
|
||||
cmd = cmd + '-f "' + attachment + '" '
|
||||
cmd = cmd + '-n ' + str(encoding)
|
||||
cmd = cmd + ' "' + message + '"'
|
||||
#print cmd
|
||||
#os.system (cmd)
|
||||
#print os.popen(cmd).read()
|
||||
import subprocess
|
||||
proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, shell=True)
|
||||
(out, err) = proc.communicate()
|
||||
if (err is not None) and err!="":
|
||||
raise Exception(err)
|
||||
print out
|
||||
|
||||
|
||||
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()
|
||||
|
||||
#Machine utilities
|
||||
def is_timing_ok():
|
||||
return caget("SIN-TIMAST-TMA:SOS-COUNT-CHECK") == 0
|
||||
|
||||
def get_repetition_rate():
|
||||
return caget("SIN-TIMAST-TMA:Evt-15-Freq-I")
|
||||
|
||||
Reference in New Issue
Block a user