Sep.2025
This commit is contained in:
@@ -1,13 +1,16 @@
|
||||
#Tue Jul 13 11:02:20 CEST 2021
|
||||
#Thu Sep 04 11:18:13 CEST 2025
|
||||
autoSaveScanData=true
|
||||
simulation=false
|
||||
xscanCrlogicChannel=null
|
||||
dataScanSaveOutput=false
|
||||
userAuthenticator=
|
||||
dataScanSaveScript=false
|
||||
notifiedTasks=
|
||||
parallelInitialization=false
|
||||
fdaSerialization=false
|
||||
dataTransferPath=
|
||||
saveConsoleSessionFiles=false
|
||||
xscanAppendSuffix=true
|
||||
hostName=
|
||||
disableEmbeddedAttributes=false
|
||||
serverPort=8080
|
||||
@@ -16,17 +19,24 @@ dataPath={data}/{year}_{month}/{date}/{date}_{time}_{name}
|
||||
serverEnabled=false
|
||||
depthDimension=0
|
||||
logLevel=Info
|
||||
dataLayout=default
|
||||
dataLayout=sf
|
||||
disableDataFileLogs=false
|
||||
dataScanSaveTimestamps=false
|
||||
sessionHandling=Off
|
||||
terminalEnabled=false
|
||||
notificationLevel=Off
|
||||
terminalPort=3579
|
||||
dataTransferUser=
|
||||
versionTrackingLogin={context}/svcusr-hlapp_robot
|
||||
xscanContinuousUpdate=false
|
||||
versionTrackingLogin=auto
|
||||
noBytecodeFiles=false
|
||||
versionTrackingRemote=git@git.psi.ch\:pshell_config/satesf.git
|
||||
versionTrackingRemote=https\://gitea.psi.ch/pshell_config/satesf.git
|
||||
dataScanLazyTableCreation=false
|
||||
pythonHome=
|
||||
xscanMoveTimeout=600
|
||||
commandExecutionEvents=false
|
||||
logDaysToLive=30
|
||||
xscanCrlogicSimulated=false
|
||||
logLevelConsole=Off
|
||||
filePermissionsConfig=Public
|
||||
scanStreamerPort=-1
|
||||
@@ -37,12 +47,16 @@ userManagement=false
|
||||
instanceName=FU
|
||||
dataServerPort=-1
|
||||
hideServerMessages=false
|
||||
dataScanReleaseRecords=false
|
||||
dataScanPreserveTypes=false
|
||||
dataScanReleaseRecords=true
|
||||
dataScanPreserveTypes=true
|
||||
dataScanFlushRecords=false
|
||||
logPath={logs}/{date}_{time}
|
||||
filePermissionsLogs=Protected
|
||||
filePermissionsScripts=Group
|
||||
filePermissionsLogs=Public
|
||||
filePermissionsScripts=Public
|
||||
xscanCrlogicPrefix=null
|
||||
filePermissionsData=Default
|
||||
xscanCrlogicAbortable=true
|
||||
createSessionFiles=false
|
||||
dataProvider=h5
|
||||
xscanCrlogicIoc=null
|
||||
saveCommandStatistics=false
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#Tue Jul 13 10:47:57 CEST 2021
|
||||
#Thu Mar 02 09:41:37 CET 2023
|
||||
ch.psi.jcae.ContextFactory.addressList=
|
||||
ch.psi.jcae.ContextFactory.serverPort=
|
||||
ch.psi.jcae.ContextFactory.maxArrayBytes=50000000
|
||||
|
||||
@@ -0,0 +1,137 @@
|
||||
{
|
||||
"fontShellPanel" : {
|
||||
"name" : "Monospaced",
|
||||
"style" : 0,
|
||||
"size" : 13
|
||||
},
|
||||
"fontShellCommand" : {
|
||||
"name" : "SansSerif",
|
||||
"style" : 0,
|
||||
"size" : 13
|
||||
},
|
||||
"fontOutput" : {
|
||||
"name" : "Monospaced",
|
||||
"style" : 0,
|
||||
"size" : 13
|
||||
},
|
||||
"fontEditor" : {
|
||||
"name" : "Monospaced",
|
||||
"style" : 0,
|
||||
"size" : 13
|
||||
},
|
||||
"fontPlotLabel" : {
|
||||
"name" : "SansSerif",
|
||||
"style" : 0,
|
||||
"size" : 11
|
||||
},
|
||||
"fontPlotTick" : {
|
||||
"name" : "SansSerif",
|
||||
"style" : 0,
|
||||
"size" : 10
|
||||
},
|
||||
"fontPlotTitle" : {
|
||||
"name" : "SansSerif",
|
||||
"style" : 1,
|
||||
"size" : 13
|
||||
},
|
||||
"fontTerminal" : {
|
||||
"name" : "Monospaced",
|
||||
"style" : 0,
|
||||
"size" : 14
|
||||
},
|
||||
"tabSize" : 4,
|
||||
"contentWidth" : 0,
|
||||
"editorBackground" : null,
|
||||
"editorForeground" : null,
|
||||
"simpleEditor" : false,
|
||||
"hideEditorLineNumbers" : false,
|
||||
"hideEditorContextMenu" : false,
|
||||
"consoleLocation" : "Left",
|
||||
"dataPanelLocation" : "Status",
|
||||
"openDataFilesInDocTab" : false,
|
||||
"noVariableEvaluationPropagation" : false,
|
||||
"processingScripts" : [ ],
|
||||
"asyncViewersUpdate" : false,
|
||||
"asyncHistoryPlotsUpdate" : false,
|
||||
"scanPlotDisabled" : false,
|
||||
"scanTableDisabled" : false,
|
||||
"cachedDataPanel" : false,
|
||||
"dataExtensions" : "",
|
||||
"dataSubFiles" : "",
|
||||
"hideFileName" : false,
|
||||
"showEmergencyStop" : false,
|
||||
"showHomingButtons" : false,
|
||||
"showJogButtons" : false,
|
||||
"hideScanPanel" : false,
|
||||
"hideOutputPanel" : false,
|
||||
"showXScanFileBrowser" : false,
|
||||
"showQueueBrowser" : false,
|
||||
"backgroundRendering" : false,
|
||||
"showImageStatusBar" : true,
|
||||
"persistRendererWindows" : false,
|
||||
"defaultRendererColormap" : "Grayscale",
|
||||
"linePlot" : "ch.psi.pshell.plot.LinePlotJFree",
|
||||
"matrixPlot" : "ch.psi.pshell.plot.MatrixPlotJFree",
|
||||
"surfacePlot" : "null",
|
||||
"timePlot" : "ch.psi.pshell.plot.TimePlotJFree",
|
||||
"plotsDetached" : false,
|
||||
"plotsHidden" : false,
|
||||
"plotLayout" : "Vertical",
|
||||
"quality" : "High",
|
||||
"defaultPlotColormap" : "Temperature",
|
||||
"markerSize" : 2,
|
||||
"plotBackground" : null,
|
||||
"gridColor" : null,
|
||||
"outlineColor" : null,
|
||||
"disableOffscreenBuffer" : false,
|
||||
"defaultPanels" : [ {
|
||||
"deviceClassName" : "ch.psi.pshell.epics.Scaler",
|
||||
"panelClassName" : "ch.psi.pshell.swing.ScalerPanel"
|
||||
}, {
|
||||
"deviceClassName" : "ch.psi.pshell.epics.Scienta",
|
||||
"panelClassName" : "ch.psi.pshell.swing.ScientaPanel"
|
||||
}, {
|
||||
"deviceClassName" : "ch.psi.pshell.device.Motor",
|
||||
"panelClassName" : "ch.psi.pshell.swing.MotorPanel"
|
||||
}, {
|
||||
"deviceClassName" : "ch.psi.pshell.device.MasterPositioner",
|
||||
"panelClassName" : "ch.psi.pshell.swing.MasterPositionerPanel"
|
||||
}, {
|
||||
"deviceClassName" : "ch.psi.pshell.device.ProcessVariable",
|
||||
"panelClassName" : "ch.psi.pshell.swing.ProcessVariablePanel"
|
||||
}, {
|
||||
"deviceClassName" : "ch.psi.pshell.device.MotorGroup",
|
||||
"panelClassName" : "ch.psi.pshell.swing.MotorGroupPanel"
|
||||
}, {
|
||||
"deviceClassName" : "ch.psi.pshell.device.DiscretePositioner",
|
||||
"panelClassName" : "ch.psi.pshell.swing.DiscretePositionerPanel"
|
||||
}, {
|
||||
"deviceClassName" : "ch.psi.pshell.device.Camera",
|
||||
"panelClassName" : "ch.psi.pshell.swing.CameraPanel"
|
||||
}, {
|
||||
"deviceClassName" : "ch.psi.pshell.device.Slit",
|
||||
"panelClassName" : "ch.psi.pshell.swing.SlitPanel"
|
||||
}, {
|
||||
"deviceClassName" : "ch.psi.pshell.device.HistogramGenerator",
|
||||
"panelClassName" : "ch.psi.pshell.swing.HistogramGeneratorPanel"
|
||||
}, {
|
||||
"deviceClassName" : "ch.psi.pshell.bs.Stream",
|
||||
"panelClassName" : "ch.psi.pshell.swing.StreamPanel"
|
||||
}, {
|
||||
"deviceClassName" : "ch.psi.pshell.bs.StreamChannel",
|
||||
"panelClassName" : "ch.psi.pshell.swing.StreamChannelPanel"
|
||||
}, {
|
||||
"deviceClassName" : "ch.psi.pshell.camserver.CamServerStream",
|
||||
"panelClassName" : "ch.psi.pshell.swing.CamServerStreamPanel"
|
||||
}, {
|
||||
"deviceClassName" : "ch.psi.pshell.camserver.CamServerService",
|
||||
"panelClassName" : "ch.psi.pshell.swing.CamServerServicePanel"
|
||||
}, {
|
||||
"deviceClassName" : "ch.psi.pshell.device.ReadonlyRegister$ReadonlyRegisterArray",
|
||||
"panelClassName" : "ch.psi.pshell.swing.DeviceValueChart"
|
||||
}, {
|
||||
"deviceClassName" : "ch.psi.pshell.device.ReadonlyRegister$ReadonlyRegisterMatrix",
|
||||
"panelClassName" : "ch.psi.pshell.swing.DeviceValueChart"
|
||||
} ],
|
||||
"scriptPopupDialog" : "None"
|
||||
}
|
||||
+12
-10
@@ -1,23 +1,25 @@
|
||||
#Tue Jul 13 10:19:02 CEST 2021
|
||||
#Tue Aug 16 17:06:20 CEST 2022
|
||||
scriptPath={home}/script
|
||||
sessionsPath={outp}/sessions
|
||||
pluginsPath={home}/plugins
|
||||
configFileDevices={config}/devices.properties
|
||||
consoleSessionsPath={sessions}/console
|
||||
libraryPath={script}; {script}/Lib
|
||||
contextPath={outp}/context
|
||||
configFilePlugins={config}/plugins.properties
|
||||
xscanPath={script}
|
||||
queuePath={script}
|
||||
extensionsPath={home}/extensions
|
||||
configPath={home}/config
|
||||
configFileSessions={config}/sessions.properties
|
||||
userSessionsPath={sessions}/user
|
||||
dataPath={outp}/data
|
||||
devicesPath={home}/devices
|
||||
configFileVariables={config}/variables.properties
|
||||
configFileSettings={config}/settings.properties
|
||||
wwwPath={home}/www
|
||||
logPath={outp}/log
|
||||
imagesPath={outp}/images
|
||||
configFile={config}/config.properties
|
||||
scriptType=py
|
||||
configFileTasks={config}/tasks.properties
|
||||
pluginsPath={home}/plugins
|
||||
consoleSessionsPath={sessions}/console
|
||||
libraryPath={script}; {script}/Lib
|
||||
contextPath={outp}/context
|
||||
configFilePlugins={config}/plugins.properties
|
||||
devicesPath={home}/devices
|
||||
configFileSettings={config}/settings.properties
|
||||
imagesPath={outp}/images
|
||||
scriptType=py
|
||||
|
||||
@@ -1,2 +1,4 @@
|
||||
#Tue Jul 13 10:26:28 CEST 2021
|
||||
#Thu Aug 14 17:54:29 CEST 2025
|
||||
LastRunDate=230706
|
||||
DaySequentialNumber=0
|
||||
FileSequentialNumber=38
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
#Fri Jan 28 13:02:14 CET 2022
|
||||
spatialCalOffsetY=NaN
|
||||
spatialCalOffsetX=NaN
|
||||
colormapLogarithmic=false
|
||||
scale=1.0
|
||||
grayscale=false
|
||||
spatialCalScaleX=NaN
|
||||
spatialCalScaleY=NaN
|
||||
colormapMax=NaN
|
||||
rescaleOffset=0.0
|
||||
roiWidth=-1
|
||||
colormap=Grayscale
|
||||
invert=false
|
||||
colormapMin=NaN
|
||||
rotation=0.0
|
||||
rotationCrop=false
|
||||
rescaleFactor=1.0
|
||||
spatialCalUnits=mm
|
||||
flipVertically=false
|
||||
roiHeight=-1
|
||||
flipHorizontally=false
|
||||
colormapAutomatic=false
|
||||
roiY=0
|
||||
roiX=0
|
||||
transpose=false
|
||||
@@ -0,0 +1,25 @@
|
||||
#Mon Jan 16 16:00:16 CET 2023
|
||||
spatialCalOffsetY=NaN
|
||||
spatialCalOffsetX=NaN
|
||||
colormapLogarithmic=false
|
||||
scale=1.0
|
||||
grayscale=false
|
||||
spatialCalScaleX=NaN
|
||||
spatialCalScaleY=NaN
|
||||
colormapMax=NaN
|
||||
rescaleOffset=0.0
|
||||
roiWidth=-1
|
||||
colormap=Grayscale
|
||||
invert=false
|
||||
colormapMin=NaN
|
||||
rotation=0.0
|
||||
rotationCrop=false
|
||||
rescaleFactor=1.0
|
||||
spatialCalUnits=mm
|
||||
flipVertically=false
|
||||
roiHeight=-1
|
||||
flipHorizontally=false
|
||||
colormapAutomatic=false
|
||||
roiY=0
|
||||
roiX=0
|
||||
transpose=false
|
||||
@@ -1,21 +1,27 @@
|
||||
#Tue Jul 13 10:41:25 CEST 2021
|
||||
spatialCalOffsetY=-50.11933174224343
|
||||
spatialCalOffsetX=-50.11933174224343
|
||||
#Thu Sep 04 11:18:24 CEST 2025
|
||||
00=
|
||||
spatialCalOffsetY=5.000000083214129
|
||||
spatialCalOffsetX=97.00000825529783
|
||||
colormapLogarithmic=false
|
||||
scale=1.0
|
||||
grayscale=false
|
||||
spatialCalScaleX=-1.0
|
||||
spatialCalScaleY=-1.0
|
||||
colormapMax=255.0
|
||||
iY=0
|
||||
spatialCalScaleX=-41.322312446489725
|
||||
spatialCalScaleY=-41.32231376540493
|
||||
colormapMax=40.0
|
||||
rescaleOffset=0.0
|
||||
roiWidth=-1
|
||||
colormap=Flame
|
||||
colormap=Grayscale
|
||||
imageWidth=2528
|
||||
invert=false
|
||||
colormapMin=0.0
|
||||
rotation=0.0
|
||||
rotationCrop=false
|
||||
rescaleFactor=1.0
|
||||
imageHeight=162
|
||||
spatialCalUnits=mm
|
||||
0=
|
||||
1=
|
||||
flipVertically=false
|
||||
roiHeight=-1
|
||||
flipHorizontally=false
|
||||
@@ -23,3 +29,5 @@ colormapAutomatic=true
|
||||
roiY=0
|
||||
roiX=0
|
||||
transpose=false
|
||||
regionStartX=33
|
||||
regionStartY=1000
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
#Tue May 23 15:34:25 CEST 2023
|
||||
spatialCalOffsetY=-50.08912655971479
|
||||
spatialCalOffsetX=-50.01953888237593
|
||||
colormapLogarithmic=false
|
||||
scale=1.0
|
||||
grayscale=false
|
||||
spatialCalScaleX=-1.0
|
||||
spatialCalScaleY=-1.0
|
||||
colormapMax=7.0
|
||||
rescaleOffset=0.0
|
||||
roiWidth=-1
|
||||
colormap=Temperature
|
||||
invert=false
|
||||
colormapMin=0.0
|
||||
rotation=0.0
|
||||
rotationCrop=false
|
||||
rescaleFactor=1.0
|
||||
spatialCalUnits=mm
|
||||
flipVertically=false
|
||||
roiHeight=-1
|
||||
flipHorizontally=false
|
||||
colormapAutomatic=true
|
||||
roiY=0
|
||||
roiX=0
|
||||
transpose=false
|
||||
@@ -0,0 +1,11 @@
|
||||
#Mon Jan 30 10:57:25 CET 2023
|
||||
minValue=NaN
|
||||
unit=null
|
||||
offset=0.0
|
||||
maxValue=NaN
|
||||
rotation=false
|
||||
precision=-1
|
||||
sign_bit=0
|
||||
scale=1.0
|
||||
description=null
|
||||
resolution=NaN
|
||||
@@ -1,11 +1,11 @@
|
||||
#Tue Jul 13 10:38:24 CEST 2021
|
||||
spatialCalOffsetY=NaN
|
||||
spatialCalOffsetX=NaN
|
||||
#Wed Dec 08 16:50:32 CET 2021
|
||||
spatialCalOffsetY=-50.10141987829615
|
||||
spatialCalOffsetX=-50.075987841945285
|
||||
colormapLogarithmic=false
|
||||
scale=1.0
|
||||
grayscale=false
|
||||
spatialCalScaleX=NaN
|
||||
spatialCalScaleY=NaN
|
||||
spatialCalScaleX=-1.0
|
||||
spatialCalScaleY=-1.0
|
||||
colormapMax=NaN
|
||||
rescaleOffset=0.0
|
||||
roiWidth=-1
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
#Tue Jul 13 10:39:33 CEST 2021
|
||||
#Tue Nov 28 10:33:39 CET 2023
|
||||
sendStrategy=complete_all
|
||||
keepListeningOnStop=false
|
||||
disableCompression=false
|
||||
sendBuildChannelConfig=at_startup
|
||||
parallelHandlerProcessing=true
|
||||
analizeHeader=false
|
||||
sendAwaitFirstMessage=false
|
||||
headerReservingAllocator=false
|
||||
socketType=DEFAULT
|
||||
validationInconsistency=keep_as_is
|
||||
byteBufferAllocator=false
|
||||
mappingIncomplete=fill_null
|
||||
sendSyncTimeout=0
|
||||
sendStrategy=complete_all
|
||||
sendAwaitFirstMessage=false
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
#Tue Jul 13 11:39:18 CEST 2021
|
||||
spatialCalOffsetY=NaN
|
||||
spatialCalOffsetX=NaN
|
||||
colormapLogarithmic=false
|
||||
scale=1.0
|
||||
grayscale=false
|
||||
spatialCalScaleX=NaN
|
||||
spatialCalScaleY=NaN
|
||||
colormapMax=NaN
|
||||
rescaleOffset=0.0
|
||||
roiWidth=-1
|
||||
colormap=Grayscale
|
||||
invert=false
|
||||
colormapMin=NaN
|
||||
rotation=0.0
|
||||
rotationCrop=false
|
||||
rescaleFactor=1.0
|
||||
spatialCalUnits=mm
|
||||
flipVertically=false
|
||||
roiHeight=-1
|
||||
flipHorizontally=false
|
||||
colormapAutomatic=false
|
||||
roiY=0
|
||||
roiX=0
|
||||
transpose=false
|
||||
@@ -0,0 +1,7 @@
|
||||
|
||||
channel_x = Channel('S10BD01-DBPM020:X1')
|
||||
channel_y = Channel('SINSB01-RSYS:SET-BEAM-PHASE')
|
||||
|
||||
|
||||
av = create_averager(channel_x, 10, 0.1)
|
||||
#lscan(channel_y, av, 70., 90., 20, latency=0.5)
|
||||
@@ -0,0 +1,61 @@
|
||||
N_POSITION_BAND = 10.0
|
||||
|
||||
|
||||
# EInkommentieren fuer Messungen Mit PSCR136
|
||||
# Auskommentieren fuer Messungen Mit PCEL
|
||||
#
|
||||
cam_server.start("SATES21-CAMS-PATT1", True)
|
||||
cam_server.stream.waitCacheChange(-1)
|
||||
i= cam_server.stream.getChild("x_fwhm")
|
||||
i_avg = create_averager(i, 30, interval = -1)
|
||||
|
||||
|
||||
# muss auskommentiert bleiben
|
||||
#Keithley = Channel("SATOP31-CSSU-PCEL1381:READOUT",'d', monitored ='True')
|
||||
|
||||
#_avg = create_averager(Keithley, 5, interval = -1)
|
||||
|
||||
def beam_ok():
|
||||
I0 = caget ("SATFE10-PEPG046:PHOTON-ENERGY-PER-PULSE-AVG")
|
||||
if I0 > 100:
|
||||
return "Yes"
|
||||
else :
|
||||
return "No"
|
||||
|
||||
|
||||
def before_sampling(rec):
|
||||
while beam_ok() == "No":
|
||||
time.sleep(0.1)
|
||||
print(".")
|
||||
|
||||
def after_sampling(rec):
|
||||
if beam_ok() == "No":
|
||||
rec.invalidate()
|
||||
|
||||
|
||||
i0 = Channel("SATFE10-PEPG046:PHOTON-ENERGY-PER-PULSE-AVG",'d')
|
||||
|
||||
|
||||
class VLSSGM(RegisterBase):
|
||||
def doWrite(self, value):
|
||||
caput ("SATOP11-OSGM087:SetEnergy", value)
|
||||
time.sleep(0.2)
|
||||
cawait('SATOP11-OSGM087:MOVING', 1, timeout = 20.0, type = 'i')
|
||||
def doRead(self):
|
||||
return caget("SATOP11-OSGM087:photonenergy")
|
||||
|
||||
athos = VLSSGM()
|
||||
athos.initialize()
|
||||
|
||||
#lscan( athos, [i0,i_avg], 520.0, 540, 1.0, 0.5, setpoints=True,zigzag=True) # Scans mit PSCR136
|
||||
#lscan( athos, [i0,K_avg], 833.5, 837, 0.05, 0.5, setpoints=True,zigzag=True) # Scans mit PCEL
|
||||
|
||||
|
||||
|
||||
#caput ("ATHOS:SetEnergy", 680.0)
|
||||
tscan( [i_avg], 10, 1 , passes=1)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
add_device(Stream("st", "sf-daqsync-15.psi.ch:9006", SocketType.PULL), True)
|
||||
st.start()
|
||||
show_panel(st)
|
||||
|
||||
bscan(st, 10, -1, save=False, lazy=True)
|
||||
@@ -0,0 +1,15 @@
|
||||
CAMERA = "SATES30-RIXS-CAM01"
|
||||
CAMERA = "SATES31-CAMS187-RIXS1"
|
||||
CAMERA = "SATES30-CAMS182-GIGE5"
|
||||
CAMERA_URL = caget(CAMERA + ":BSREADCONFIG").replace("tcp://daq", "tcp://")
|
||||
#CAMERA_URL ="tcp://129.1.247.78:8199"
|
||||
print CAMERA_URL
|
||||
|
||||
st1 = Stream("st1", CAMERA_URL, SocketType.PULL)
|
||||
#st1.debug=True
|
||||
st1.initialize()
|
||||
st1.start()
|
||||
st1.waitCacheChange(1000)
|
||||
|
||||
show_panel(st1)
|
||||
#add_device(st1.getChildren()[0], True)
|
||||
@@ -0,0 +1,30 @@
|
||||
CAMERA = "SATES30-RIXS-CAM01"
|
||||
CAMERA_URL = caget(CAMERA + ":BSREADCONFIG").replace("tcp://daq", "tcp://")
|
||||
SAMPLES = 3
|
||||
TIMEOUT = 10.0
|
||||
CHANNEL_IMG = CAMERA+":FPICTURE"
|
||||
|
||||
|
||||
add_device(Stream("cs", CAMERA_URL, SocketType.PULL), True)
|
||||
#image = cs.addMatrix(CAMERA+":FPICTURE")
|
||||
cs.createMatrix = True
|
||||
cs.start()
|
||||
cs.waitCacheChange(3000)
|
||||
|
||||
|
||||
image = cs.getChild(CHANNEL_IMG)
|
||||
add_device(image, True)
|
||||
|
||||
|
||||
PLOT_TYPES={CHANNEL_IMG:"ch.psi.pshell.plot.MatrixPlotRenderer"}
|
||||
#bscan(cs, 5, None)
|
||||
|
||||
|
||||
|
||||
bscan(cs, SAMPLES, TIMEOUT, enabled_plots=[cs])
|
||||
#add_device(st1.getChildren()[0], True)
|
||||
|
||||
|
||||
|
||||
mscan(image, image, SAMPLES, TIMEOUT, plot_types=PLOT_TYPES)
|
||||
tscan (image, 3, 1.0, plot_types=PLOT_TYPES)
|
||||
@@ -0,0 +1,19 @@
|
||||
#Add device: will be visible in Device tab -> device panel is opened double clicking the device name.
|
||||
#In the device panel you can plot data double-clicking each chanel.
|
||||
add_device (Stream("st", cam_server.getStream("SATES30-RIXS-CAM01_proc"), SocketType.PULL), True)
|
||||
st.start()
|
||||
|
||||
#Open the panel programatically
|
||||
show_panel(st)
|
||||
|
||||
#Saves and displays 5 messages
|
||||
bscan(st, 5)
|
||||
|
||||
#Saves and displays messages for 3 seconds, plotting arrays as line plots (1d)
|
||||
bscan(st, -1, 3.0, line_plots=list(st.getChildren()))
|
||||
|
||||
#Just saves the stream, no display (Good idea if 100Hz)
|
||||
bscan(st, -1, 3.0, display=False)
|
||||
|
||||
#Just displays the stream, no saving
|
||||
bscan(st, 5, -1, save=False, line_plots=list(st.getChildren()))
|
||||
@@ -0,0 +1,214 @@
|
||||
#include "module.c"
|
||||
#include <unistd.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
#include <math.h>
|
||||
|
||||
|
||||
const char *CHANNEL_NAMES[] = {"EVENT_NUM", "EVENT_I", "EVENT_J", "EVENT_CHARGE", "EVENT_ETA_X", "EVENT_ETA_Y", "EVENT_I_INTERP", "EVENT_J_INTERP"};
|
||||
|
||||
|
||||
const int MAX_NUM_EVENTS= 100; // max number of events per frame
|
||||
const int EVENT_CHANNELS = 7;
|
||||
|
||||
|
||||
struct events_double func_ph_1d_double( double *frame, int i_dim, int j_dim, double *th_m);
|
||||
//struct decl.
|
||||
struct events_double {
|
||||
double **evnt_ijc;
|
||||
int evnt_num;
|
||||
};
|
||||
|
||||
|
||||
|
||||
//def process_image(image, pulse_id, timestamp, x_axis, y_axis, parameters, bsdata=None):
|
||||
PyObject *process(PyObject *self, PyObject *args)
|
||||
{
|
||||
PyArrayObject *image;
|
||||
long pulse_id;
|
||||
PyObject /*double*/ *timestamp;
|
||||
long seconds, nanos;
|
||||
PyArrayObject *x_axis;
|
||||
PyArrayObject *y_axis;
|
||||
PyObject *pars;
|
||||
PyObject *bsdata;
|
||||
|
||||
//if (!PyArg_ParseTuple(args, "OldOOO|O", &image, &pulse_id, ×tamp, &x_axis, &y_axis, &pars, &bsdata))
|
||||
if ( !PyArg_ParseTuple(args, "OlOOOO|O", &image, &pulse_id, ×tamp, &x_axis, &y_axis, &pars, &bsdata) ||
|
||||
!PyArg_ParseTuple(timestamp, "ll", &seconds, &nanos) )
|
||||
return NULL;
|
||||
|
||||
if (pulse_id < 0) {
|
||||
PyErr_SetString(moduleErr, "Invalid Pulse ID");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
//Acessing image
|
||||
int element_size = image->descr->elsize;
|
||||
int dims = image->nd;
|
||||
int size_x = image->dimensions[1];
|
||||
int size_y = image->dimensions[0];
|
||||
unsigned short* img_data = (unsigned short*)image->data;
|
||||
|
||||
|
||||
int i,j,l;
|
||||
int i_dim=size_y;
|
||||
int j_dim=size_x;
|
||||
|
||||
double *threshold = malloc(i_dim*j_dim*sizeof(double));
|
||||
for(i=0; i<i_dim;i++) {
|
||||
for(j=0;j<j_dim;j++) {
|
||||
threshold[i*j_dim+j]=10.0;
|
||||
}
|
||||
}
|
||||
//background (all matrices are indexed in 1d)
|
||||
double *background = malloc(i_dim*j_dim*sizeof(double));
|
||||
for(i=0; i<i_dim;i++) {
|
||||
for(j=0;j<j_dim;j++) {
|
||||
background[i*j_dim+j]=210.0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
double *frameBKsub = malloc(i_dim*j_dim*sizeof(double));
|
||||
for(i=0; i<i_dim;i++) {
|
||||
for(j=0;j<j_dim;j++) {
|
||||
frameBKsub[i*j_dim+j]=(double)img_data[i*j_dim+j] - background[i*j_dim+j];
|
||||
}
|
||||
}
|
||||
struct events_double evns1d = func_ph_1d_double( frameBKsub, i_dim, j_dim, threshold);
|
||||
|
||||
//Create return dictionary
|
||||
PyObject *ret = PyDict_New();
|
||||
PyObject* camera_name = PyDict_GetItemString(pars, "camera_name");
|
||||
const char * camera_name_str = PyUnicode_AsUTF8(camera_name);
|
||||
char channel_name[200];
|
||||
//PyDict_SetItemString(ret, "camera_name", camera_name);
|
||||
sprintf(channel_name, "%s:%s",camera_name_str, CHANNEL_NAMES[0]);
|
||||
PyDict_SetItemString(ret, channel_name, PyLong_FromLong(evns1d.evnt_num));
|
||||
for (int i=0; i<EVENT_CHANNELS; i++){
|
||||
sprintf(channel_name, "%s:%s",camera_name_str, CHANNEL_NAMES[i+1]);
|
||||
npy_intp arr_dims[1] = {MAX_NUM_EVENTS};
|
||||
PyObject *parr =PyArray_SimpleNewFromData(1, arr_dims, NPY_FLOAT64, evns1d.evnt_ijc);
|
||||
PyDict_SetItemString(ret, channel_name, parr);
|
||||
}
|
||||
for (l = 0; l < EVENT_CHANNELS; l++) {
|
||||
free(evns1d.evnt_ijc[l]);
|
||||
}
|
||||
free(evns1d.evnt_ijc);
|
||||
free(frameBKsub);
|
||||
free(background);
|
||||
free(threshold);
|
||||
return ret;
|
||||
}
|
||||
|
||||
struct events_double func_ph_1d_double( double *frame, int i_dim, int j_dim, double *th_m)
|
||||
{
|
||||
//int th= 50;
|
||||
int i, j, l=0, m=0, n=0, evt_m_i=0, evt_i=0 ;
|
||||
int dist_i, dist_j;
|
||||
double charge_evt;
|
||||
int th;
|
||||
|
||||
double **evt_p= (double**)malloc(EVENT_CHANNELS * sizeof(double*));
|
||||
for (l = 0; l < EVENT_CHANNELS; l++) {
|
||||
evt_p[l] = (double*)malloc(MAX_NUM_EVENTS * sizeof(double));}
|
||||
|
||||
/*Counter variables for the loop*/
|
||||
double charge = 0;
|
||||
double eta_x = 0;
|
||||
double eta_y = 0;
|
||||
double i_interp = 0;
|
||||
double j_interp = 0;
|
||||
double C[]= { 4.37805097e-03, 2.43266401e-01, -7.81479328e+00, 7.70533057e+01, -2.37906124e+02, 3.42988113e+02, -2.35979731e+02, 6.24074562e+01};
|
||||
double D[]= {-2.05180773e-04, 4.35314696e-01, -1.32557223e+01, 1.19990373e+02, -3.80696758e+02, 5.81427096e+02, -4.30789104e+02, 1.23894761e+02};
|
||||
|
||||
for(i=0; i<i_dim-1; i++) {
|
||||
if (evt_i>=MAX_NUM_EVENTS){
|
||||
break;
|
||||
}
|
||||
for(j=0;j<j_dim-1;j++) {
|
||||
if (evt_i>=MAX_NUM_EVENTS){
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
// 2x2 version
|
||||
charge = frame[i*j_dim+j]+frame[(i+1)*j_dim+j] + frame[i*j_dim+(j+1)]+frame[(i+1)*j_dim+j+1];
|
||||
|
||||
//pixel by pixel threshold
|
||||
th = th_m[i*j_dim +j];
|
||||
|
||||
//check if charge above threshold
|
||||
if(charge>th) {
|
||||
eta_x = (frame[(i+1)*j_dim + j ]+frame[(i+1)*j_dim + (j+1)])/charge;
|
||||
eta_y = (frame[ i*j_dim + (j+1)]+frame[(i+1)*j_dim + (j+1)])/charge;
|
||||
i_interp = i + (C[0] + C[1]*eta_x+ C[2]*pow(eta_x,2) + C[3]*pow(eta_x,3) + C[4]*pow(eta_x,4)+ C[5]*pow(eta_x,5) + C[6]*pow(eta_x,6) + C[7]*pow(eta_x,7));
|
||||
j_interp = j + (D[0] + D[1]*eta_y+ D[2]*pow(eta_y,2) + D[3]*pow(eta_y,3) + D[4]*pow(eta_y,4)+ D[5]*pow(eta_y,5) + D[6]*pow(eta_y,6) + D[7]*pow(eta_y,7));
|
||||
|
||||
// 1st case: first event
|
||||
if(evt_i==0){
|
||||
evt_p[0][evt_i] = i;
|
||||
evt_p[1][evt_i] = j;
|
||||
evt_p[2][evt_i] = charge;
|
||||
evt_p[3][evt_i] = eta_x;
|
||||
evt_p[4][evt_i] = eta_y;
|
||||
evt_p[5][evt_i] = i_interp; //
|
||||
evt_p[6][evt_i] = j_interp; //
|
||||
evt_i++;
|
||||
|
||||
} else {
|
||||
// 2nd case: not 1st event. we check if it is a neighbourg of the previos events and if charge is larger
|
||||
n=0;
|
||||
evt_m_i = evt_i;
|
||||
for(m=0; m<evt_m_i; m++) {
|
||||
dist_i = abs(evt_p[0][evt_i-1-m] - i); //fix here
|
||||
dist_j = abs(evt_p[1][evt_i-1-m] - j);
|
||||
charge_evt = evt_p[2][evt_i-1-m];
|
||||
|
||||
if( dist_i< 2 && dist_j<2) {
|
||||
if(charge_evt < charge) {
|
||||
//2nd case: not 1st event, but neigboor of previos event, this event has more charge
|
||||
evt_p[0][evt_i-1-m] = i;
|
||||
evt_p[1][evt_i-1-m] = j;
|
||||
evt_p[2][evt_i-1-m] = charge;
|
||||
evt_p[3][evt_i-1-m] = eta_x;
|
||||
evt_p[4][evt_i-1-m] = eta_y;
|
||||
evt_p[5][evt_i-1-m] = i_interp;
|
||||
evt_p[6][evt_i-1-m] = j_interp;
|
||||
} else {
|
||||
//3d case not 1st event, but neigboor of previos event, this event has less charge
|
||||
}
|
||||
|
||||
} else {
|
||||
// not a neighbor of the m event
|
||||
|
||||
n++;
|
||||
|
||||
//now we check if it is not a neighborg of any previous event
|
||||
if((n)==evt_i) {
|
||||
|
||||
evt_p[0][evt_i] = i;
|
||||
evt_p[1][evt_i] = j;
|
||||
evt_p[2][evt_i] = charge;
|
||||
evt_p[3][evt_i] = eta_x;
|
||||
evt_p[4][evt_i] = eta_y;
|
||||
evt_p[5][evt_i] = i_interp; //
|
||||
evt_p[6][evt_i] = j_interp; //
|
||||
evt_i++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
struct events_double events_i_d;
|
||||
events_i_d.evnt_ijc = evt_p;
|
||||
events_i_d.evnt_num = evt_i;
|
||||
return events_i_d;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user