This commit is contained in:
gobbo_a
2025-01-14 16:18:27 +01:00
parent 8beeb7dbc7
commit 7a0da7c48c
80 changed files with 1698 additions and 590 deletions

View File

@@ -1,4 +1,4 @@
#Thu May 04 15:07:35 CEST 2023
#Fri May 24 11:38:19 CEST 2024
xscanMoveTimeout=600
autoSaveScanData=true
simulation=false
@@ -30,32 +30,33 @@ userManagement=false
disableEmbeddedAttributes=false
instanceName=OP
dataServerPort=-1
serverPort=8090
hideServerMessages=false
serverPort=8090
versionTrackingEnabled=true
dataPath={data}/{year}/{month}/{day}/{date}_{time}_{name}
serverEnabled=true
depthDimension=0
dataScanReleaseRecords=false
depthDimension=0
dataScanPreserveTypes=false
logLevel=Fine
dataScanFlushRecords=false
logPath={logs}/{date}_{time}
filePermissionsLogs=Public
logPath={logs}/{date}_{time}
dataLayout=sf
disableDataFileLogs=false
dataScanSaveTimestamps=false
sessionHandling=Off
deviceUpdateStrategyFile={config}/update.properties
terminalEnabled=false
notificationLevel=Off
filePermissionsScripts=Public
notificationLevel=Off
terminalPort=3579
xscanCrlogicPrefix=null
tasksFile={config}/tasks.properties
dataTransferUser=null
filePermissionsData=Default
xscanCrlogicAbortable=true
xscanContinuousUpdate=false
xscanCrlogicAbortable=true
createSessionFiles=false
versionTrackingLogin={context}/svcusr-hlapp_robot
noBytecodeFiles=false
@@ -63,4 +64,5 @@ versionTrackingRemote=git@git.psi.ch\:pshell_config/sf-op.git
dataProvider=default
xscanCrlogicIoc=null
dataScanLazyTableCreation=false
pythonHome=
saveCommandStatistics=false

View File

@@ -37,7 +37,7 @@
"fontTerminal" : {
"name" : "Monospaced",
"style" : 0,
"size" : 14
"size" : 12
},
"tabSize" : 4,
"contentWidth" : 0,
@@ -46,7 +46,7 @@
"simpleEditor" : false,
"hideEditorLineNumbers" : false,
"hideEditorContextMenu" : false,
"consoleLocation" : "Document",
"consoleLocation" : "Left",
"dataPanelLocation" : null,
"openDataFilesInDocTab" : false,
"noVariableEvaluationPropagation" : false,
@@ -93,6 +93,9 @@
}, {
"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"
@@ -109,10 +112,22 @@
"deviceClassName" : "ch.psi.pshell.device.Slit",
"panelClassName" : "ch.psi.pshell.swing.SlitPanel"
}, {
"deviceClassName" : "ch.psi.pshell.device.ReadonlyRegister$ReadonlyRegisterArray",
"panelClassName" : "ch.psi.pshell.swing.DeviceValueChart"
"deviceClassName" : "ch.psi.pshell.device.HistogramGenerator",
"panelClassName" : "ch.psi.pshell.swing.HistogramGeneratorPanel"
}, {
"deviceClassName" : "ch.psi.pshell.device.ReadonlyRegister$ReadonlyRegisterMatrix",
"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",
"panelClassName" : "ch.psi.pshell.swing.DeviceValueChart"
} ],
"scriptPopupDialog" : "None"

View File

@@ -1,4 +1,4 @@
#Thu Aug 17 14:59:44 CEST 2023
LastRunDate=230817
FileSequentialNumber=10016
DaySequentialNumber=5
#Mon Jan 13 17:07:30 CET 2025
LastRunDate=250113
FileSequentialNumber=13116
DaySequentialNumber=4

View File

@@ -1,4 +1,6 @@
#Thu Aug 17 15:16:51 CEST 2023
#Mon Jan 13 15:40:25 CET 2025
\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000=
\u0000\u0000\u0000\u0000\u0000=
\u0000\u0000\u0000=
\u0000\u0000=
\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000=
@@ -8,30 +10,28 @@
\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000=
\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000=
\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000=
\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000=
\u0000\u0000\u0000\u0000\u0000=
colormapLogarithmic=false
spatialCalScaleX=-12.508648760497415
spatialCalScaleY=-12.345679012345679
spatialCalScaleX=-1.0
spatialCalScaleY=-1.0
serverURL=null
rescaleOffset=0.0
roiWidth=-1
colormap=Flame
imageWidth=1744
invert=false
colormapMin=NaN
colormapMin=72.0
rotationCrop=false
roiHeight=-1
colormapAutomatic=false
colormapAutomatic=true
roiY=0
roiX=0
spatialCalOffsetY=-523.4304458333334
spatialCalOffsetX=-865.4470498186071
spatialCalOffsetY=-50.00000000000001
spatialCalOffsetX=-50.0
scale=1.0
regionStart=
grayscale=false
rtY=1
colormapMax=NaN
colormapMax=3000.0
spat=
rotation=0.0
rescaleFactor=1.0

View File

@@ -1,15 +1,19 @@
#Thu Jul 13 13:32:57 CEST 2017
defaultSpeed=1.0
estbilizationDelay=0
hasEnable=false
homingType=None
maxSpeed=1.0
maxValue=346.0
minSpeed=0.05
minValue=130.0
#Wed Sep 11 09:24:49 CEST 2024
offset=0.0
maxValue=346.0
precision=5
resolution=8.0E-4
rotation=false
scale=1.0
description=null
estbilizationDelay=0
maxSpeed=1.0
resolution=8.0E-4
homingType=None
startRetries=1
minValue=130.0
unit=mm
defaultSpeed=1.0
hasEnable=false
sign_bit=0
monitorByPosition=false
minSpeed=0.05

View File

@@ -0,0 +1,25 @@
#Thu Nov 14 10:39:29 CET 2024
colormapLogarithmic=false
spatialCalScaleX=-35.21126970307918
spatialCalScaleY=-48.38709738725674
rescaleOffset=0.0
roiWidth=-1
colormap=Flame
invert=false
colormapMin=3138.731
rotationCrop=false
roiHeight=-1
colormapAutomatic=false
roiY=0
roiX=0
spatialCalOffsetY=-99.00000232640186
spatialCalOffsetX=-173.99999471338924
scale=1.0
grayscale=false
colormapMax=11709.881
rotation=0.0
rescaleFactor=1.0
spatialCalUnits=null
flipVertically=false
flipHorizontally=false
transpose=false

View File

@@ -1,8 +1,8 @@
#Mon May 01 20:02:47 CEST 2023
#Mon Sep 11 08:15:49 CEST 2023
minValue=-90.0
unit=deg
offset=0.0
maxValue=270.0
maxValue=360.0
rotation=true
precision=4
sign_bit=0

View File

@@ -1,15 +1,16 @@
#Sun Jul 03 07:32:46 CEST 2022
#Mon Jan 13 16:51:03 CET 2025
offset=0.0
maxValue=140000.0
maxValue=68500.0
precision=1
rotation=false
scale=1.0
description=PPMAC motor record
estbilizationDelay=0
maxSpeed=2000.0
resolution=0.1
homingType=None
startRetries=1
minValue=-56400.0
minValue=-57027.0
unit=um
defaultSpeed=2000.0
hasEnable=false

View File

@@ -1,11 +1,11 @@
#Thu Aug 17 14:27:37 CEST 2023
spatialCalOffsetY=-50.048828125
spatialCalOffsetX=-50.03909304143862
#Mon Dec 09 10:29:03 CET 2024
spatialCalOffsetY=-819.9999871547424
spatialCalOffsetX=-861.0000211619925
colormapLogarithmic=false
scale=1.0
grayscale=false
spatialCalScaleX=-1.0
spatialCalScaleY=-1.0
spatialCalScaleX=-18.90359092620482
spatialCalScaleY=-19.37984500632817
colormapMax=NaN
rescaleOffset=0.0
roiWidth=-1

View File

@@ -1,16 +1,17 @@
#Fri Jun 16 10:34:26 CEST 2023
#Fri Oct 20 12:06:55 CEST 2023
sendStrategy=complete_all
dropIncomplete=false
keepListeningOnStop=false
disableCompression=false
parallelHandlerProcessing=true
sendBuildChannelConfig=at_startup
analizeHeader=false
sendAwaitFirstMessage=false
headerReservingAllocator=false
socketType=DEFAULT
validationInconsistency=adjust_global
byteBufferAllocator=false
alignmentRetries=20
mappingIncomplete=fill_null
sendIncompleteMessages=true
sendSyncTimeout=0
sendStrategy=complete_all
sendAwaitFirstMessage=false
headerReservingAllocator=false
alignmentRetries=20

View File

@@ -23,36 +23,49 @@
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="1" attributes="0">
<Component id="panelOutput" max="32767" attributes="0"/>
<Group type="102" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="buttonPrepare" alignment="0" min="-2" max="-2" attributes="0"/>
<Group type="102" alignment="0" attributes="0">
<Component id="buttonStart" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" max="-2" attributes="0"/>
<Component id="buttonAbort" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="panelScanPars" min="-2" max="-2" attributes="0"/>
<Component id="buttonPrepare" alignment="0" min="-2" max="-2" attributes="0"/>
<Group type="102" alignment="0" attributes="0">
<Component id="buttonStart" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" max="-2" attributes="0"/>
<Component id="buttonAbort" min="-2" max="-2" attributes="0"/>
</Group>
<Component id="buttonRestore" alignment="0" min="-2" max="-2" attributes="0"/>
<Group type="102" alignment="0" attributes="0">
<Group type="103" groupAlignment="0" max="-2" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Component id="buttonSetPhase" min="-2" max="-2" attributes="0"/>
<EmptySpace min="0" pref="0" max="-2" attributes="0"/>
<Component id="spinnerPhase" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="55" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<Component id="labelUserCalib" min="-2" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
<Component id="jRadioButtonUserCalib" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
</Group>
<Component id="panelScanPars" alignment="0" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="plot21" pref="475" max="32767" attributes="0"/>
<Component id="plot11" max="32767" attributes="0"/>
<Component id="spinnerPhase" min="-2" pref="92" max="-2" attributes="0"/>
<Component id="spinnerUserCalib" min="-2" pref="92" max="-2" attributes="0"/>
</Group>
</Group>
</Group>
<EmptySpace max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
<Group type="103" groupAlignment="0" max="-2" attributes="0">
<Component id="plot12" pref="438" max="32767" attributes="0"/>
<Component id="plot11" pref="390" max="32767" attributes="0"/>
<Component id="plot21" max="32767" attributes="0"/>
</Group>
<EmptySpace max="32767" attributes="0"/>
<Group type="103" groupAlignment="0" max="-2" attributes="0">
<Component id="plot12" pref="390" max="32767" attributes="0"/>
<Component id="plot22" max="32767" attributes="0"/>
</Group>
<EmptySpace min="-2" pref="28" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<Component id="panelOutput" min="-2" max="-2" attributes="0"/>
<EmptySpace min="0" pref="483" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
@@ -61,36 +74,48 @@
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Component id="panelScanPars" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="buttonPrepare" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="buttonSetPhase" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="spinnerPhase" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="buttonStart" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="buttonAbort" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<Group type="102" alignment="0" attributes="0">
<Group type="102" attributes="0">
<Group type="103" groupAlignment="1" max="-2" attributes="0">
<Component id="plot11" max="32767" attributes="0"/>
<Component id="plot12" max="32767" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<EmptySpace min="0" pref="0" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" max="-2" attributes="0">
<Component id="plot22" max="32767" attributes="0"/>
<Component id="plot21" max="32767" attributes="0"/>
</Group>
<EmptySpace min="0" pref="3" max="32767" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<Component id="panelScanPars" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="1" attributes="0">
<Group type="102" attributes="0">
<Component id="buttonPrepare" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="buttonSetPhase" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="spinnerPhase" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="buttonStart" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="buttonAbort" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Component id="buttonRestore" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="labelUserCalib" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="spinnerUserCalib" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<Component id="jRadioButtonUserCalib" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="32767" attributes="0"/>
</Group>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Component id="panelOutput" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="19" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
@@ -111,42 +136,71 @@
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="0" pref="0" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="labelStop" alignment="1" min="-2" max="-2" attributes="0"/>
<Component id="labelStart" alignment="1" min="-2" max="-2" attributes="0"/>
<Component id="labelSamples" alignment="1" min="-2" max="-2" attributes="0"/>
<Component id="labelStep" alignment="1" min="-2" max="-2" attributes="0"/>
<Group type="102" alignment="1" attributes="0">
<Group type="103" groupAlignment="1" attributes="0">
<Component id="labelThreshold" min="-2" max="-2" attributes="0"/>
<Component id="labelLatency" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="-2" pref="2" max="-2" attributes="0"/>
<Group type="102" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="labelStation" min="-2" max="-2" attributes="0"/>
<Component id="labelBunch" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="labelScreen" alignment="0" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="spinnerStation" max="32767" attributes="0"/>
<Component id="spinnerBunch" max="32767" attributes="0"/>
<Component id="spinnerScreen" alignment="0" max="32767" attributes="0"/>
</Group>
</Group>
<Group type="102" alignment="0" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="labelSamples" alignment="1" min="-2" max="-2" attributes="0"/>
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="1" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="labelStop" min="-2" max="-2" attributes="0"/>
<Component id="labelStart" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
</Group>
<Component id="labelStep" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="labelLatency" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="labelThreshold" alignment="0" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="-2" pref="124" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" max="-2" attributes="0">
<Component id="spinnerLatency" alignment="0" max="32767" attributes="0"/>
<Component id="spinnerSamples" alignment="0" max="32767" attributes="0"/>
<Component id="spinnerStep" alignment="0" max="32767" attributes="0"/>
<Component id="spinnerStop" alignment="0" max="32767" attributes="0"/>
<Component id="spinnerStart" alignment="0" max="32767" attributes="0"/>
<Component id="spinnerThreshold" alignment="1" max="32767" attributes="0"/>
</Group>
</Group>
<Component id="labelStation" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="labelBunch" alignment="1" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" max="-2" attributes="0">
<Component id="spinnerStart" alignment="0" max="32767" attributes="0"/>
<Component id="spinnerStation" alignment="0" max="32767" attributes="0"/>
<Component id="spinnerBunch" alignment="0" max="32767" attributes="0"/>
<Component id="spinnerThreshold" alignment="0" max="32767" attributes="0"/>
<Component id="spinnerLatency" alignment="0" max="32767" attributes="0"/>
<Component id="spinnerSamples" alignment="0" max="32767" attributes="0"/>
<Component id="spinnerStep" alignment="0" max="32767" attributes="0"/>
<Component id="spinnerStop" alignment="0" max="32767" attributes="0"/>
</Group>
<EmptySpace max="32767" attributes="0"/>
<EmptySpace min="0" pref="0" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="spinnerStation" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="labelStation" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace pref="11" max="32767" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="spinnerBunch" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="labelBunch" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="spinnerScreen" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="labelScreen" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="spinnerStart" alignment="3" min="-2" max="-2" attributes="0"/>
@@ -178,15 +232,6 @@
<Component id="spinnerThreshold" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="spinnerStation" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="labelStation" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="32767" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="spinnerBunch" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="labelBunch" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
</Group>
</DimensionLayout>
@@ -229,7 +274,7 @@
<Component class="javax.swing.JSpinner" name="spinnerSamples">
<Properties>
<Property name="model" type="javax.swing.SpinnerModel" editor="org.netbeans.modules.form.editors2.SpinnerModelEditor">
<SpinnerModel initial="10" maximum="100" minimum="1" numberType="java.lang.Integer" stepSize="1" type="number"/>
<SpinnerModel initial="5" maximum="100" minimum="1" numberType="java.lang.Integer" stepSize="1" type="number"/>
</Property>
</Properties>
</Component>
@@ -260,7 +305,7 @@
<Component class="javax.swing.JSpinner" name="spinnerThreshold">
<Properties>
<Property name="model" type="javax.swing.SpinnerModel" editor="org.netbeans.modules.form.editors2.SpinnerModelEditor">
<SpinnerModel initial="7000" maximum="50000" minimum="0" numberType="java.lang.Integer" stepSize="1" type="number"/>
<SpinnerModel initial="250" maximum="50000" minimum="0" numberType="java.lang.Integer" stepSize="1" type="number"/>
</Property>
</Properties>
</Component>
@@ -279,6 +324,9 @@
</SpinnerModel>
</Property>
</Properties>
<Events>
<EventHandler event="stateChanged" listener="javax.swing.event.ChangeListener" parameters="javax.swing.event.ChangeEvent" handler="spinnerStationStateChanged"/>
</Events>
</Component>
<Component class="javax.swing.JSpinner" name="spinnerBunch">
<Properties>
@@ -295,6 +343,25 @@
<Property name="text" type="java.lang.String" value="Bunch:"/>
</Properties>
</Component>
<Component class="javax.swing.JSpinner" name="spinnerScreen">
<Properties>
<Property name="model" type="javax.swing.SpinnerModel" editor="org.netbeans.modules.form.editors2.SpinnerModelEditor">
<SpinnerModel type="list">
<ListItem value="SARCL01-DSCR170"/>
<ListItem value="SARCL02-DSCR280"/>
<ListItem value="SATBD01-DSCR120"/>
<ListItem value="SATBD02-DSCR050"/>
<ListItem value="SINDI02-DSCR075"/>
<ListItem value="simulation"/>
</SpinnerModel>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="labelScreen">
<Properties>
<Property name="text" type="java.lang.String" value="Screen:"/>
</Properties>
</Component>
</SubComponents>
</Container>
<Component class="ch.psi.pshell.plot.LinePlotJFree" name="plot11">
@@ -355,7 +422,7 @@
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="jTextAreaOutput" max="32767" attributes="0"/>
<Component id="jTextAreaOutput" pref="621" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
@@ -363,7 +430,7 @@
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Component id="jTextAreaOutput" pref="142" max="32767" attributes="0"/>
<Component id="jTextAreaOutput" pref="134" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
@@ -396,5 +463,31 @@
<Property name="title" type="java.lang.String" value=""/>
</Properties>
</Component>
<Component class="javax.swing.JButton" name="buttonRestore">
<Properties>
<Property name="text" type="java.lang.String" value="Restore"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="RestoreActionPerformed"/>
</Events>
<AuxValues>
<AuxValue name="JavaCodeGenerator_SerializeTo" type="java.lang.String" value="BunchLength_buttonRestore"/>
</AuxValues>
</Component>
<Component class="javax.swing.JLabel" name="labelUserCalib">
<Properties>
<Property name="text" type="java.lang.String" value="User calib. (mm/deg):"/>
<Property name="toolTipText" type="java.lang.String" value=""/>
</Properties>
</Component>
<Component class="javax.swing.JRadioButton" name="jRadioButtonUserCalib">
</Component>
<Component class="javax.swing.JSpinner" name="spinnerUserCalib">
<Properties>
<Property name="model" type="javax.swing.SpinnerModel" editor="org.netbeans.modules.form.editors2.SpinnerModelEditor">
<SpinnerModel initial="1.0" maximum="100.0" minimum="0.01" numberType="java.lang.Double" stepSize="0.1" type="number"/>
</Property>
</Properties>
</Component>
</SubComponents>
</Form>

View File

@@ -2,6 +2,7 @@
* Copyright (c) 2014-2017 Paul Scherrer Institute. All rights reserved.
*/
import ch.psi.pshell.core.Context;
import ch.psi.pshell.plot.LinePlot;
import ch.psi.pshell.plot.LinePlotSeries;
import ch.psi.pshell.ui.Panel;
@@ -9,7 +10,10 @@ import ch.psi.utils.State;
import ch.psi.utils.swing.SwingUtils;
import java.awt.Color;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.script.ScriptException;
import javax.swing.JSpinner;
/**
@@ -36,6 +40,7 @@ public class BunchLength extends Panel {
buttonAbort.setEnabled(state.isProcessing());
boolean enabled = (state == State.Ready);
buttonPrepare.setEnabled(enabled);
buttonRestore.setEnabled(enabled);
buttonSetPhase.setEnabled(enabled);
buttonStart.setEnabled(enabled);
spinnerStart.setEnabled(enabled);
@@ -46,6 +51,10 @@ public class BunchLength extends Panel {
spinnerThreshold.setEnabled(enabled);
spinnerStation.setEnabled(enabled);
spinnerBunch.setEnabled(enabled);
spinnerScreen.setEnabled(enabled);
spinnerPhase.setEnabled(enabled);
jRadioButtonUserCalib.setEnabled(enabled);
spinnerUserCalib.setEnabled(enabled);
}
@Override
@@ -56,6 +65,43 @@ public class BunchLength extends Panel {
@Override
protected void doUpdate() {
}
void updateDefaults() throws Exception{
this.run("Tools/BunchLengthTDSdata.py", null, true);
String station=spinnerStation.getValue().toString();
Map tdsData = (Map)this.getGlobalVar("tds_data");
Map stationData = (Map)tdsData.get(station);
Map defaults = (Map)stationData.getOrDefault("DEFAULTS", new HashMap());
Number start = (Number)defaults.getOrDefault("Start", null);
Number stop = (Number)defaults.getOrDefault("Stop", null);
Number step = (Number)defaults.getOrDefault("Step", null);
Number nb = (Number)defaults.getOrDefault("Nb", null);
Number lat = (Number)defaults.getOrDefault("Lat", null);
Number thr = (Number)defaults.getOrDefault("Thr", null);
String scr = (String)defaults.getOrDefault("Scr", null);
if (start!=null){
spinnerStart.setValue(start);
}
if (stop!=null){
spinnerStop.setValue(stop);
}
if (step!=null){
spinnerStep.setValue(step);
}
if (nb!=null){
spinnerSamples.setValue(nb);
}
if (lat!=null){
spinnerLatency.setValue(lat);
}
if (thr!=null){
spinnerThreshold.setValue(thr);
}
if (scr!=null){
spinnerScreen.setValue(scr);
}
}
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
@@ -78,6 +124,8 @@ public class BunchLength extends Panel {
spinnerStation = new javax.swing.JSpinner();
spinnerBunch = new javax.swing.JSpinner();
labelBunch = new javax.swing.JLabel();
spinnerScreen = new javax.swing.JSpinner();
labelScreen = new javax.swing.JLabel();
plot11 = new ch.psi.pshell.plot.LinePlotJFree();
buttonStart = new javax.swing.JButton();
buttonAbort = new javax.swing.JButton();
@@ -89,6 +137,10 @@ public class BunchLength extends Panel {
plot21 = new ch.psi.pshell.plot.LinePlotJFree();
plot12 = new ch.psi.pshell.plot.LinePlotJFree();
plot22 = new ch.psi.pshell.plot.LinePlotJFree();
buttonRestore = new javax.swing.JButton();
labelUserCalib = new javax.swing.JLabel();
jRadioButtonUserCalib = new javax.swing.JRadioButton();
spinnerUserCalib = new javax.swing.JSpinner();
setPreferredSize(new java.awt.Dimension(737, 445));
@@ -106,7 +158,7 @@ public class BunchLength extends Panel {
labelSamples.setText("Nb samples:");
spinnerSamples.setModel(new javax.swing.SpinnerNumberModel(10, 1, 100, 1));
spinnerSamples.setModel(new javax.swing.SpinnerNumberModel(5, 1, 100, 1));
labelLatency.setText("Latency:");
@@ -116,50 +168,80 @@ public class BunchLength extends Panel {
labelThreshold.setText("Threshold:");
spinnerThreshold.setModel(new javax.swing.SpinnerNumberModel(7000, 0, 50000, 1));
spinnerThreshold.setModel(new javax.swing.SpinnerNumberModel(250, 0, 50000, 1));
labelStation.setText("TDS Station:");
spinnerStation.setModel(new javax.swing.SpinnerListModel(new String[] {"S30CB14", "SATMA02", "SINDI01"}));
spinnerStation.addChangeListener(new javax.swing.event.ChangeListener() {
public void stateChanged(javax.swing.event.ChangeEvent evt) {
spinnerStationStateChanged(evt);
}
});
spinnerBunch.setModel(new javax.swing.SpinnerListModel(new String[] {"Bunch1", "Bunch2"}));
labelBunch.setText("Bunch:");
spinnerScreen.setModel(new javax.swing.SpinnerListModel(new String[] {"SARCL01-DSCR170", "SARCL02-DSCR280", "SATBD01-DSCR120", "SATBD02-DSCR050", "SINDI02-DSCR075", "simulation"}));
labelScreen.setText("Screen:");
javax.swing.GroupLayout panelScanParsLayout = new javax.swing.GroupLayout(panelScanPars);
panelScanPars.setLayout(panelScanParsLayout);
panelScanParsLayout.setHorizontalGroup(
panelScanParsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(panelScanParsLayout.createSequentialGroup()
.addGap(0, 0, 0)
.addGroup(panelScanParsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(panelScanParsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(labelStop, javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(labelStart, javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(labelSamples, javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(labelStep, javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelScanParsLayout.createSequentialGroup()
.addGroup(panelScanParsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(labelThreshold)
.addComponent(labelLatency))
.addGap(2, 2, 2)))
.addComponent(labelStation)
.addComponent(labelBunch, javax.swing.GroupLayout.Alignment.TRAILING))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(panelScanParsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(spinnerStart)
.addComponent(spinnerStation)
.addComponent(spinnerBunch)
.addComponent(spinnerThreshold)
.addComponent(spinnerLatency)
.addComponent(spinnerSamples)
.addComponent(spinnerStep)
.addComponent(spinnerStop))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGroup(panelScanParsLayout.createSequentialGroup()
.addGroup(panelScanParsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(labelStation)
.addComponent(labelBunch)
.addComponent(labelScreen))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(panelScanParsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(spinnerStation)
.addComponent(spinnerBunch)
.addComponent(spinnerScreen)))
.addGroup(panelScanParsLayout.createSequentialGroup()
.addGroup(panelScanParsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(panelScanParsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(labelSamples, javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(panelScanParsLayout.createSequentialGroup()
.addGap(1, 1, 1)
.addGroup(panelScanParsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(labelStop)
.addComponent(labelStart))))
.addComponent(labelStep)
.addComponent(labelLatency)
.addComponent(labelThreshold))
.addGap(124, 124, 124)
.addGroup(panelScanParsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(spinnerLatency)
.addComponent(spinnerSamples)
.addComponent(spinnerStep)
.addComponent(spinnerStop)
.addComponent(spinnerStart)
.addComponent(spinnerThreshold, javax.swing.GroupLayout.Alignment.TRAILING))))
.addGap(0, 0, 0))
);
panelScanParsLayout.setVerticalGroup(
panelScanParsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(panelScanParsLayout.createSequentialGroup()
.addContainerGap()
.addGroup(panelScanParsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(spinnerStation, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(labelStation))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 11, Short.MAX_VALUE)
.addGroup(panelScanParsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(spinnerBunch, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(labelBunch))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(panelScanParsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(spinnerScreen, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(labelScreen))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(panelScanParsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(spinnerStart, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(labelStart))
@@ -183,14 +265,7 @@ public class BunchLength extends Panel {
.addGroup(panelScanParsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(labelThreshold)
.addComponent(spinnerThreshold, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(panelScanParsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(spinnerStation, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(labelStation))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(panelScanParsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(spinnerBunch, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(labelBunch)))
.addContainerGap())
);
plot11.setTitle("");
@@ -237,13 +312,13 @@ public class BunchLength extends Panel {
panelOutputLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(panelOutputLayout.createSequentialGroup()
.addContainerGap()
.addComponent(jTextAreaOutput)
.addComponent(jTextAreaOutput, javax.swing.GroupLayout.DEFAULT_SIZE, 621, Short.MAX_VALUE)
.addContainerGap())
);
panelOutputLayout.setVerticalGroup(
panelOutputLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(panelOutputLayout.createSequentialGroup()
.addComponent(jTextAreaOutput, javax.swing.GroupLayout.DEFAULT_SIZE, 142, Short.MAX_VALUE)
.addComponent(jTextAreaOutput, javax.swing.GroupLayout.DEFAULT_SIZE, 134, Short.MAX_VALUE)
.addContainerGap())
);
@@ -253,64 +328,95 @@ public class BunchLength extends Panel {
plot22.setTitle("");
buttonRestore.setText("Restore");
buttonRestore.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
RestoreActionPerformed(evt);
}
});
labelUserCalib.setText("User calib. (mm/deg):");
labelUserCalib.setToolTipText("");
spinnerUserCalib.setModel(new javax.swing.SpinnerNumberModel(1.0d, 0.01d, 100.0d, 0.1d));
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(panelOutput, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(panelScanPars, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(buttonPrepare)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(buttonPrepare)
.addGroup(layout.createSequentialGroup()
.addComponent(buttonStart)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(buttonAbort))
.addComponent(buttonStart)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(buttonAbort))
.addComponent(buttonRestore)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addGroup(layout.createSequentialGroup()
.addComponent(buttonSetPhase)
.addGap(0, 0, 0)
.addComponent(spinnerPhase, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(panelScanPars, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGap(55, 55, 55))
.addGroup(layout.createSequentialGroup()
.addComponent(labelUserCalib)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jRadioButtonUserCalib)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)))
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(plot21, javax.swing.GroupLayout.DEFAULT_SIZE, 475, Short.MAX_VALUE)
.addComponent(plot11, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(spinnerPhase, javax.swing.GroupLayout.PREFERRED_SIZE, 92, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(spinnerUserCalib, javax.swing.GroupLayout.PREFERRED_SIZE, 92, javax.swing.GroupLayout.PREFERRED_SIZE))))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(plot12, javax.swing.GroupLayout.DEFAULT_SIZE, 438, Short.MAX_VALUE)
.addComponent(plot11, javax.swing.GroupLayout.DEFAULT_SIZE, 390, Short.MAX_VALUE)
.addComponent(plot21, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(plot12, javax.swing.GroupLayout.DEFAULT_SIZE, 390, Short.MAX_VALUE)
.addComponent(plot22, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGap(28, 28, 28))
.addContainerGap())
.addGroup(layout.createSequentialGroup()
.addComponent(panelOutput, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 483, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(panelScanPars, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(buttonPrepare)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(buttonSetPhase)
.addComponent(spinnerPhase, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(buttonStart)
.addComponent(buttonAbort)))
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addComponent(plot11, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(plot12, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGap(0, 0, 0)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(plot22, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(plot21, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(panelOutput, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(19, Short.MAX_VALUE))
.addComponent(plot21, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGap(0, 3, Short.MAX_VALUE))
.addGroup(layout.createSequentialGroup()
.addComponent(panelScanPars, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(layout.createSequentialGroup()
.addComponent(buttonPrepare)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(buttonSetPhase)
.addComponent(spinnerPhase, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(buttonStart)
.addComponent(buttonAbort))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(buttonRestore)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(labelUserCalib)
.addComponent(spinnerUserCalib, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addComponent(jRadioButtonUserCalib))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
.addComponent(panelOutput, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
);
panelScanPars.getAccessibleContext().setAccessibleDescription("");
@@ -326,6 +432,9 @@ public class BunchLength extends Panel {
parameters.add(spinnerThreshold.getValue());
parameters.add(spinnerStation.getValue());
parameters.add(spinnerBunch.getValue());
parameters.add(spinnerScreen.getValue());
parameters.add(jRadioButtonUserCalib.isSelected());
parameters.add(spinnerUserCalib.getValue());
parameters.add(plot11);
parameters.add(plot12);
parameters.add(plot21);
@@ -411,20 +520,49 @@ public class BunchLength extends Panel {
}
}//GEN-LAST:event_buttonSetPhaseActionPerformed
private void RestoreActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_RestoreActionPerformed
ArrayList parameters = new ArrayList();
parameters.add(spinnerStation.getValue());
try {
runAsync("Tools/BunchLengthRestore", parameters).handle((ret, ex) -> {
if (ex != null) {
String message = "Exception executing scan: " + ex;
getLogger().info(message);
showException((Exception) ex);
}
return ret;
});
} catch (Exception ex) {
showException(ex);
}
}//GEN-LAST:event_RestoreActionPerformed
private void spinnerStationStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_spinnerStationStateChanged
try {
updateDefaults();
} catch (Exception ex) {
showException(ex);
}
}//GEN-LAST:event_spinnerStationStateChanged
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton buttonAbort;
private javax.swing.JButton buttonPrepare;
private javax.swing.JButton buttonRestore;
private javax.swing.JButton buttonSetPhase;
private javax.swing.JButton buttonStart;
private javax.swing.JRadioButton jRadioButtonUserCalib;
private javax.swing.JTextArea jTextAreaOutput;
private javax.swing.JLabel labelBunch;
private javax.swing.JLabel labelLatency;
private javax.swing.JLabel labelSamples;
private javax.swing.JLabel labelScreen;
private javax.swing.JLabel labelStart;
private javax.swing.JLabel labelStation;
private javax.swing.JLabel labelStep;
private javax.swing.JLabel labelStop;
private javax.swing.JLabel labelThreshold;
private javax.swing.JLabel labelUserCalib;
private javax.swing.JPanel panelOutput;
private javax.swing.JPanel panelScanPars;
private ch.psi.pshell.plot.LinePlotJFree plot11;
@@ -435,10 +573,12 @@ public class BunchLength extends Panel {
private javax.swing.JSpinner spinnerLatency;
private javax.swing.JSpinner spinnerPhase;
private javax.swing.JSpinner spinnerSamples;
private javax.swing.JSpinner spinnerScreen;
private javax.swing.JSpinner spinnerStart;
private javax.swing.JSpinner spinnerStation;
private javax.swing.JSpinner spinnerStep;
private javax.swing.JSpinner spinnerStop;
private javax.swing.JSpinner spinnerThreshold;
private javax.swing.JSpinner spinnerUserCalib;
// End of variables declaration//GEN-END:variables
}

View File

@@ -314,6 +314,7 @@ public class WireScan extends Panel {
}
JDialog dlgRaw;
void showBlmRawData(String blm){
try {
if ((blm==null) || (blm.isEmpty())){
@@ -324,10 +325,11 @@ public class WireScan extends Panel {
//dev.setPolling(1000);
dev.setMonitored(true);
dev.initialize();
DeviceValueChart chart = new DeviceValueChart();
JDialog dlg = SwingUtils.showDialog((Window)this.getTopLevel(), blm, new Dimension(600,400), chart);
DeviceValueChart chart = new DeviceValueChart();
dlgRaw= SwingUtils.showDialog((Window)this.getTopLevel(), blm, new Dimension(600,400), chart);
chart.setDevice(dev);
dlg.addWindowListener(new WindowAdapter() {
chart.setInterval(200);
dlgRaw.addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent e) {
try {

59
plugins/errors Normal file
View File

@@ -0,0 +1,59 @@
javax.script.ScriptException: Exception: Scan didn't conmplete in <script> at line number 471
at org.python.jsr223.PyScriptEngine.scriptException(PyScriptEngine.java:222)
at org.python.jsr223.PyScriptEngine.eval(PyScriptEngine.java:59)
at org.python.jsr223.PyScriptEngine.eval(PyScriptEngine.java:64)
at java.scripting/javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:249)
at ch.psi.pshell.scripting.Interpreter.evalFile(Interpreter.java:139)
at ch.psi.pshell.scripting.ScriptManager.evalFile(ScriptManager.java:248)
at ch.psi.pshell.core.Context.lambda$evalFile$11(Context.java:1906)
at ch.psi.pshell.core.Context.runInInterpreterThread(Context.java:1433)
at ch.psi.pshell.core.Context.evalFile(Context.java:1900)
at ch.psi.pshell.core.Context.evalFile(Context.java:1875)
at ch.psi.pshell.core.Context.lambda$evalFileAsync$5(Context.java:1570)
at ch.psi.utils.Threading.lambda$getFuture$0(Threading.java:207)
at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1771)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:835)
Caused by: Traceback (most recent call last):
File "<script>", line 471, in <module>
File "<script>", line 278, in do_scan
Exception: Scan didn't conmplete
at org.python.core.PyException.doRaise(PyException.java:211)
at org.python.core.Py.makeException(Py.java:1654)
at org.python.core.Py.makeException(Py.java:1658)
at org.python.core.Py.makeException(Py.java:1662)
at org.python.core.Py.makeException(Py.java:1666)
at org.python.pycode._pyx3270.f$0(<script>:515)
at org.python.pycode._pyx3270.call_function(<script>)
at org.python.core.PyTableCode.call(PyTableCode.java:173)
at org.python.core.PyCode.call(PyCode.java:18)
at org.python.core.Py.runCode(Py.java:1703)
at org.python.core.__builtin__.eval(__builtin__.java:497)
at org.python.core.__builtin__.eval(__builtin__.java:501)
at org.python.util.PythonInterpreter.eval(PythonInterpreter.java:255)
at org.python.jsr223.PyScriptEngine.eval(PyScriptEngine.java:57)
... 14 more
12/02/24 15:00:37.804 dispatcher.addStream Fine Creating stream from: {"sendBehavior":{"buildChannelConfig":"at-startup","strategy":"complete-all
"},"mapping":{"incomplete":"fill-null"},"streamType":"pub_sub",
"channels":
[{"offset":0,"name":"SINDI01-DWSC090:ENC_1_BS","modulo":10},
{"offset":0,"name":"SINDI02-DBLM085:LOSS_SIGNAL_RAW","modulo":10},
{"offset":0,"name":"SINDI02-DBLM025:B1_LOSS","modulo":10},
{"offset":0,"name":"SINDI01-DBPM060:X1","modulo":10},
{"offset":0,"name":"SINDI01-DBPM060:Y1","modulo":10},
{"offset":0,"name":"SIN-CVME-TIFGUN-EVR0:BUNCH-1-OK","modulo":10},
{"offset":0,"name":"SINDI01-DWSC090:CURR_CYCL","modulo":10}
,{"offset":0,"name":"SINDI02-DBLM085:B1_LOSS","modulo":10},
{"offset":0,"name":"SINDI01-DBPM060:Q1","modulo":10},
{"offset":0,"name":"SINDI02-DBPM010:Y1","modulo":10},{"offset":0,"name":"SINDI02-DBPM010:X1","modulo":10},{"offset":0,"name":"SINDI02-DBPM010:Q1","modulo":10},{"offset":0,"name":"SINDI02-DBLM025:LOSS_SIGNAL_RAW","modulo":10},{"offset":0,"name":" ","modulo":10},{"offset":0,"name":"SINDI02-DBLM025:WS_RUNNING","modulo":10}],"channelValidation":{"inconsistency":"adjust-global"}}
run ("Tools/dispatcher")
get_dispatcher_channel_info("SINDI02-DBLM025:B1_LOSS_RAW")

18
script/CPython/hfitoff.py Executable file → Normal file
View File

@@ -1,25 +1,21 @@
import numpy as np
from scipy.optimize import leastsq
def hfitoff(data, xdeg):
"""
Harmonic fit with offset
"""
start, end = min(xdeg), max(xdeg)
guess_amplitude = 2 ** 0.5 * np.std(data)
guess_amplitude = 4 * np.std(data)
guess_phase = 0
guess_offset = np.mean(data)
xrad = xdeg / 180 * np.pi
optimize_func = lambda x: x[0] * np.sin(xrad + x[1]) + x[2] - data
optimize_func = lambda x: x[0] * np.sin((xdeg + x[1]) * np.pi / 180) + x[2] - data
fit_amplitude, fit_phase, fit_offset = leastsq(optimize_func, [guess_amplitude, guess_phase, guess_offset])[0]
if fit_amplitude < 0:
fit_amplitude = -fit_amplitude
fit_phase = fit_phase - np.pi
fit_phase = fit_phase + 180
fit_xdeg = np.linspace(start, end, 100)
fit_data = fit_amplitude * np.sin(fit_xdeg / 180 * np.pi + fit_phase) + fit_offset
fit_phase_deg = fit_phase / np.pi * 180
ph_crest = 90 - fit_phase_deg
if ph_crest > 180:
ph_crest = ph_crest - 360
return (fit_amplitude, fit_phase_deg, fit_offset, ph_crest, fit_xdeg, fit_data)
fit_data = fit_amplitude * np.sin((fit_xdeg + fit_phase) * np.pi / 180) + fit_offset
ph_crest = 90 - fit_phase
ph_crest = ph_crest % 360
return (fit_amplitude, fit_phase, fit_offset, ph_crest, fit_xdeg, fit_data)

View File

@@ -16,6 +16,8 @@ def linfit(x, y):
ret = call_jep("CPython/linfit", "linfit", [to_npa(x),to_npa(y)])
return (ret[0].data, ret[1].data, ret[2].data, ret[3])
def python_version():
return eval_jep("import sys; sys.version")

View File

@@ -121,7 +121,7 @@ try:
_stream.initialize()
_stream.start(True)
if _camname != None:
shared = _camname.endswith("_sp1")
shared = _camname.endswith("_sp")
print "Camera: " , _camname, " shared: ", shared
cam_server.start(_camname, shared )

View File

@@ -3,7 +3,9 @@ run("Correlation/CorrelationStream")
#PREFIX = "SLAAR"
PREFIX = "SLG"
correlation_endstations=[PREFIX+"-LBSTREAM1",PREFIX+"-LBSTREAM2", PREFIX+"-LBSTREAM3", PREFIX+"-LBSTREAM4", PREFIX+"-LBSTREAM5", PREFIX+"-LBSTREAM6"]
correlation_endstations=[ PREFIX+"-LBSTREAM1",PREFIX+"-LBSTREAM2", PREFIX+"-LBSTREAM3",
PREFIX+"-LBSTREAM4", PREFIX+"-LBSTREAM5", PREFIX+"-LBSTREAM6",
PREFIX+"-LBSTREAM7", PREFIX+"-LBSTREAM8", PREFIX+"-LBSTREAM9",]
correlation_streams = []
log("Initializing...")

View File

@@ -102,10 +102,11 @@ elements = (
(DBPM, "SATSY01-DBPM290", 302.8202),
(DBPM, "S30CB01-DBPM420", 303.8150),
(DWSC, "S30CB01-DWSC440", 304.2330),
(DBLM, "S30CB01-DBLM445", 304.3000),
(DBPM, "SATSY02-DBPM020", 306.8663),
(DBPM, "SATSY02-DBPM210", 312.6833),
(DBLM, "S30CB02-DBLM415", 312.8000),
(DBPM, "S30CB02-DBPM420", 312.9150),
(DBLM, "S30CB02-DBLM445", 313.3625),
(DBPM, "SATSY03-DBPM030", 317.2003),
(DBPM, "SATSY03-DBPM060", 320.0003),
(DBPM, "S30CB03-DBPM420", 322.0150),
@@ -153,8 +154,9 @@ elements = (
(DBPM, "SARCL01-DBPM120", 450.7750),
(DBPM, "SARCL01-DBPM150", 452.1510),
(DWSC, "SARCL01-DWSC160", 452.3510),
(DBLM, "SARCL01-DBLM195", 453.5500),
(DBLM, "SARCL02-DBLM050", 453.6500),
(DBPM, "SARCL02-DBPM110", 456.9100),
(DBLM, "SARCL02-DBLM135", 457.9854),
(DBPM, "SARCL02-DBPM220", 460.9609),
(DWSC, "SARCL02-DWSC235", 461.6270),
(DBPM, "SARCL02-DBPM260", 462.7569),

View File

@@ -1,7 +1,9 @@
# shift BLM ROI by desired offset in us and reinitialise ioc
blm = "SATUN22-DBLM005"
ioc = "SARCL02-DBLM469"
offset = 0.040 # us
blm = "SARUN05-DBLM030"
#ioc = "SARUN04-DBLM516"
ioc = caget(blm + ":PLL-LOCKED-OP-CALC.INPA").split()[0]
ioc = ioc.split(':')[0]
offset = 0.000 # us
PIX = 2.33426704 # 1 / (124.8 MHz * 3) = 2.33426704 ns
evr = caget(blm + ":GPAC-DELAY-OP.INPA").split()[0]
delay = caget(evr)

View File

@@ -14,7 +14,7 @@ SETTLING_TIME = 0.1
NUM_IMAGES = 50 #number of images for every step
print cam_server.cameras
cam_server.start(CAMERA + "_sp1", True)
cam_server.start(CAMERA + "_sp", True)
wait_cam_server_message()
print cam_server.value.identifiers
m=cam_server.getDataMatrix()

View File

@@ -9,22 +9,27 @@ run("Devices/Elements")
run("Diagnostics/sig_process_wrapper")
BPM_SENSORS = [("x","X1"), ("y","Y1"), ("q","Q1")] #(logic name sufix, channel sufix)
TRAVEL_SPEED = 0.001
TRAVEL_SPEED = 0.05
ADD_CHANNELS = []
ADD_CHANNELS = ["SARFE10-PBPG050:HAMP-INTENSITY-CAL", "SARFE10-PBIG050-EVR0:CALCI"]
#Paramter parsing
prefix = args[0] if is_panel else "SINDI02-DLAC055"
scan_type = args[1] if is_panel else "Shrom3"
scan_range = args[2] if is_panel else [-0.12, 0.12]
cycles = args[3] if is_panel else 1
velocity = args[4] if is_panel else 0.00001
scan_range = args[2] if is_panel else [-0.0, 1.7]
cycles = args[3] if is_panel else 2
velocity = args[4] if is_panel else 0.005
bpms = args[5] if is_panel else ["SINDI02-DBPM040", "SINDI02-DBPM080"]
blms = args[6] if is_panel else ["SINDI02-DBLM085", "S10DI01-DBLM045"]
bkgrd = args[7] if is_panel else 5 #Number of beam synchronous messages
plt = args[8] if is_panel else plot(None, title = "DLAC Scan")[0]
bunch = args[9] if is_panel else 1
do_elog = True if is_panel else False
print "DLAC scan parameters: ", prefix, scan_type, scan_range, cycles, velocity, bpms, blms, bkgrd
center_pos = 199.484
center_pos = 154.50
beam_filter = get_beam_ok_channel(bunch) + " == 1"
scan_type_index = DLAC_POSITIONS.index(scan_type)
if scan_type_index<0:
raise Exception("Bad sample position name")
@@ -60,7 +65,7 @@ park_pos = caget (prefix + ":P0_U0_SP")
#List of stream channels
channels = [] #[("m_pos", scanner.motor_bs_readback.get_channel_name()), ]
for i in range (len(blms)):
channels.append (("blm" + str(i+1), blms[i] + ":B1_LOSS"))
channels.append (("blm" + str(i+1), blms[i] + ":B1_LOSS_RAW"))
series = LinePlotSeries(blms[i], None, min(i+1, 2))
plt.addSeries(series)
series.setLinesVisible(False)
@@ -68,6 +73,9 @@ for i in range (len(blms)):
for i in range (len(bpms)):
for sensor in BPM_SENSORS:
channels.append (("bpm" + str(i+1) + "_" + sensor[0], bpms[i] + ":" + sensor[1]))
channels.append(("beam_ok", get_beam_ok_channel(bunch)))
for ch in ADD_CHANNELS:
channels.append((ch, ch))
#Metadata
set_attribute("/", "DLAC Scanner", prefix)
@@ -93,12 +101,17 @@ if st.take() is None:
raise Exception("Error initializing data stream")
start = st.take().timestamp
st.setFilter(beam_filter)
#Scan callback
scan_complete, cur_cycle = False, 0
scan, res = None, None
destination = None
def check_end_scan(record, scan):
def check_end_scan(record, _scan):
global scan_complete, start, destination
global scan
scan=_scan
if motor.ready:
#if motor.isInPosition(destination):
print "Data aquisition completed"
@@ -106,7 +119,8 @@ def check_end_scan(record, scan):
scan.abort()
record.cancel() #So it won't be saved
else:
position = float( record[1].timestamp - start )
position = float( record[1].timestamp - start ) #TIME
#position = motor.readback.take() #POSITION
for i in range (len(blms)):
plt.getSeries(i).appendData(position, record[2 + i])
@@ -133,7 +147,7 @@ msg = ""
print "Starting scan..."
try:
do_background()
#do_background()
#plt.getAxis(plt.AxisId.X).setRange(scan_range[0], scan_range[1])
for s in plt.getAllSeries():
@@ -157,7 +171,7 @@ try:
#else:
# motor.moveAsync(center_pos + scan_range[0])
start = st.take().timestamp
mscan ( st, [motor.readback,] + st.getReadables(), -1, -1, take_initial = True, after_read = check_end_scan)
res = mscan ( st, [motor.readback,] + st.getReadables(), -1, -1, take_initial = True, after_read = check_end_scan)
except:
print "Quit scan"
if not scan_complete:
@@ -174,9 +188,14 @@ try:
"""
finally:
print "Closing stream"
st.close()
print "Closing stream"
motor.setSpeed(TRAVEL_SPEED)
motor.stop()
st.close()
if res:
plot(res["blm1"], xdata= res[motor.readback], title="BLM 1 x Motor")
plot(res["blm2"], xdata= res[motor.readback], title="BLM 2 x Motor")
print msg

64
script/Diagnostics/WireScan.py Executable file → Normal file
View File

@@ -10,7 +10,14 @@ run("Devices/Elements")
run("Devices/WireScanner")
run("Diagnostics/sig_process_wrapper")
#set_exec_pars(layout="default")
#LayoutSF
DATA_GROUP_PREFIX = "data/"
DATASET_SUFIX = "/value"
set_exec_pars(layout="default")
#LayoutDefault
DATA_GROUP_PREFIX = ""
DATASET_SUFIX = ""
#Paramter parsing
prefix = args[0] if has_args else "SARCL01-DWSC160" # "SINDI01-DWSC090" # "S10DI01-DWSC010" #"S10CB07-DWSC440" #"SINDI01-DWSC090"
@@ -42,6 +49,9 @@ SET_BLM_WS_MODE = True
SET_BLM_WS_SETTLING_TIME = 2.0
SET_BLM_WS_BS_READBACK_TIMEOUT = 10000 #ms
ADD_CHANNELS = []
#ADD_CHANNELS = ["SARFE10-PBPG050:HAMP-INTENSITY-CAL", "SARFE10-PBIG050-EVR0:CALCI"]
#TODO: configure biggerCAJ buffer size and set back to 10000
SAMPLE_CHANNEL_SIZE = 2049 #10000
SAMPLE_CHANNEL_EMPTY_VALUE = 0.0
@@ -75,7 +85,6 @@ rr = get_repetition_rate(bunch)
velocity_x = abs(scan_range[1]-scan_range[0])*rr/n_shot
velocity_y = abs(scan_range[3]-scan_range[2])*rr/n_shot
#Creating WireScanner object
print "Creating scanner..."
if prefix not in get_wire_scanners():
@@ -85,10 +94,12 @@ scanner = WireScanner(prefix, scan_range, cycles, None, True)
#List of stream channels
channels = [("m_pos", scanner.motor_bs_readback.get_channel_name()),
("cur_cycle", scanner.curr_cycl.get_channel_name()),
("scanning", scanner.status_channels[0].get_channel_name())]
("scanning", scanner.status_channels[0].get_channel_name())]
for i in range (len(blms)):
channels.append (("blm" + str(i+1), blms[i] + ":B" + str(bunch) + "_LOSS"))
channels.append (("blm" + str(i+1), blms[i] + ":B" + str(bunch) + "_LOSS_RAW"))
#channels.append (("blm" + str(i+1), blms[i] + ":B" + str(bunch) + "_LOSS"))
if plt is not None:
series = LinePlotSeries(blms[i], None, min(i+1, 2))
plt.addSeries(series)
@@ -103,7 +114,9 @@ for i in range (len(bpms)):
if SET_BLM_WS_MODE and (len(blms)>0):
channels.append(("blm1_ws_mode", blms[0] + ":WS_RUNNING"))
channels.append(("beam_ok", get_beam_ok_channel(bunch)))
for ch in ADD_CHANNELS:
channels.append((ch, ch))
#Metadata
set_attribute("/", "Wire Scanner", prefix)
@@ -136,15 +149,19 @@ for retry in range(STREAM_CREATION_RETRIES):
st.addScalar(c[0], c[1], int(100.0 / rr), 0)
st.initialize()
st.start()
add_device(st, True)
st.waitCacheChange(10000) #Wait stream be running before starting scan
break
except:
print "Error starting stream"
print sys.exc_info()[1]
if retry >= (STREAM_CREATION_RETRIES-1):
channels_names = [dev.name for dev in st1.children]
msg = "Error creating stream with channels:\n" + "\n".join(channels_names)
show_message(msg)
print(msg)
raise
else:
print "Retrying"
print "Error creating stream, retrying..."
class Timestamp(Readable):
def read(self):
@@ -168,20 +185,27 @@ def check_end_scan(record, scan):
if (rec is None) and (record is not None):
print "Started receiving from stream"
rec = record
if record[4]<1:
if record["scanning"]<1:
print "Data aquisition completed"
scan_complete=True
scan.abort()
record.cancel() #So it won't be saved
else:
position = record[0]
if record[3] != cur_cycle:
cur_cycle = record[3]
position = record["w_pos"]
if record["cur_cycle"] != cur_cycle:
cur_cycle = record["cur_cycle"]
get_context().dataManager.splitScanData(scan)
#if plt is not None: for s in plt.getAllSeries(): s.clear()
if plt is not None:
for i in range (len(blms)):
plt.getSeries(i).appendData(position, record[5 + i])
try:
val = record["blm" + str(i+1)]
if val is None:
val = float("NaN")
print "Null value for blm ", ("blm" + str(i+1))
plt.getSeries(i).appendData(position, val)
except:
print "Error plotting position " , position, record["blm" + str(i+1)]
if scanner.take() != "At start":
print "Not at start: parking scanner"
@@ -196,7 +220,7 @@ def do_background():
for i in range(len(r.getReadables())):
d = r.getReadable(i)
try:
path = get_exec_pars().group + "/data/"+ r.getReadables()[i].name
path = get_exec_pars().group + "/" + DATA_GROUP_PREFIX + r.getReadables()[i].name
set_attribute(path, "Mean", mean(d))
set_attribute(path, "Sigma", stdev(d) )
except:
@@ -296,19 +320,19 @@ def calculate():
for i in range(len(blms)):
msg += "Wire " + wire + " - BLM " + str(i+1) + ":\n"
try:
blm_back_path = "background/data/blm" + str(i+1)
blm_back_path = "background/" + DATA_GROUP_PREFIX + "blm" + str(i+1)
print "BLM path: ", blm_back_path
blm_back_attrs = get_attributes(blm_back_path)
print "BLM attrs: ", blm_back_attrs
bg = blm_back_attrs["Mean"] if bkgrd>0 else 0.0
samples = [[], [], [], [], [], []]
for cycle in range (cycles):
pos_path = wire+"_" + ("%04d" % (cycle+1)) + "/data/w_pos"
pos_path = wire+"_" + ("%04d" % (cycle+1)) + "/" + DATA_GROUP_PREFIX+ "w_pos"
print "Loading: ", pos_path
pos = load_data(pos_path+"/value")
path = wire+"_" + ("%04d" % (cycle+1)) + "/data/blm" + str(i+1)
pos = load_data(pos_path + DATASET_SUFIX)
path = wire+"_" + ("%04d" % (cycle+1)) + "/" + DATA_GROUP_PREFIX + "blm" + str(i+1)
print "Loading ", path
data = load_data(path+"/value")
data = load_data(path + DATASET_SUFIX)
print "OK"
sp = data #blm_remove_spikes(data)
sig = sp if bg is None else [v-bg for v in sp]
@@ -336,7 +360,7 @@ def calculate():
#g = Gaussian(amp, com, sigma)
#gauss = [g.value(v)+off for v in pos]
#plot([data, sp, sig, gauss], ["data", "sp", "signal", "gauss", ], xdata = pos, title="Fit blm" + str(i+1) + " - " + str(cycle+1))
ret.extend([rms_com, rms_sigma, com, sigma, filename + "|"+ pos_path +"/value", filename + "|"+ path +"/value"])
ret.extend([rms_com, rms_sigma, com, sigma, filename + "|"+ pos_path + DATASET_SUFIX, filename + "|"+ path + DATASET_SUFIX])
stats.append([])
for sample in samples:
@@ -486,7 +510,7 @@ finally:
stop_blm_ws(blms[i])
print "Closing scanner"
scanner.close()
print "Closing stream"
print "Closing stream"
st.close()
print msg

View File

@@ -2,7 +2,7 @@ import ch.psi.pshell.epics.ChannelDouble as ChannelDouble
A1 = ChannelDouble("x", "SARUN13-DBPM070:X-REF-FB")
A2 = ChannelDouble("y", "SARUN13-DBPM070:Y-REF-FB")
camera_name = "SARBD01-DSCR110"
cam_server.start(camera_name+"_sp1", True) #True for shared pipeline
cam_server.start(camera_name+"_sp", True) #True for shared pipeline
wait_cam_server_message()
S1 = cam_server.stream.getChild("intensity")

View File

@@ -2,7 +2,7 @@ import ch.psi.pshell.epics.ChannelDouble as ChannelDouble
A1 = ChannelDouble("x", "SARUN13-DBPM070:X-REF-FB")
A2 = ChannelDouble("y", "SARUN13-DBPM070:Y-REF-FB")
camera_name = "SARBD01-DSCR110"
cam_server.start(camera_name+"_sp1", True) #True for shared pipeline
cam_server.start(camera_name+"_sp", True) #True for shared pipeline
wait_cam_server_message()
S1 = cam_server.stream.getChild("intensity")
A1.initialize()

View File

@@ -5,10 +5,10 @@ IN_POSITION_BAND = 10.0
# EInkommentieren fuer Messungen Mit PSCR136
# Auskommentieren fuer Messungen Mit PCEL
#
#cam_server.start("SATOP31-PSCR136_sp1", True)
#cam_server.start("SATOP31-PSRD175_sp1", True)
cam_server.start("SATOP31-PSCR136_sp1", True)
#cam_server.start("SATOP31-PPRM176_sp1", True)
#cam_server.start("SATOP31-PSCR136_sp", True)
#cam_server.start("SATOP31-PSRD175_sp", True)
cam_server.start("SATOP31-PSCR136_sp", True)
#cam_server.start("SATOP31-PPRM176_sp", True)
cam_server.stream.waitCacheChange(-1)
i= cam_server.stream.getChild("intensity")
i_avg = create_averager(i, 20, interval = -1)

View File

@@ -5,7 +5,7 @@ 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)
cam_server.start(CAMERA + "_sp", True)
intensity = cam_server.stream.getChild("intensity")

View File

@@ -5,7 +5,7 @@ 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)
cam_server.start(CAMERA + "_sp", True)
intensity = cam_server.stream.getChild("intensity")

View File

@@ -5,7 +5,7 @@ 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)
#cam_server.start(CAMERA + "_sp", True)
#intensity = cam_server.stream.getChild("intensity")
intensity = Channel("SARFE10-PBPG050:PHOTON-ENERGY-PER-PULSE-US")

View File

@@ -60,10 +60,8 @@ phase.initialize()
phase0 = phase.read() % 360
#Camera setup
if USE_SCREEN_PANEL:
cam_server.start(camera_name+"_sp1", True) # shared pipeline
else:
cam_server.start(camera_name) # generic pipeline
cam_server.start(camera_name+"_sp", USE_SCREEN_PANEL)
wait_cam_server_message()
x = cam_server.stream.getChild("x_center_of_mass")
dx = cam_server.stream.getChild("x_rms")

View File

@@ -1,16 +1,16 @@
# global energy scaling for a group of station (normally one full linac)
# dE1 and dE2 are the old and new energy gains (from bends)
dE1 = 1951.00 # old energy gain
dE2 = 1950.00 # new energy gain
dE1 = 291.72 # old energy gain
dE2 = 292.90 # new energy gain
do_elog = True
#stationlist = ("SINSB01","SINSB02","SINSB03","SINSB04","SINXB01")
stationlist = ("S10CB01","S10CB02","S10CB03","S10CB04","S10CB05","S10CB06","S10CB07","S10CB08","S10CB09")
stationlist = ("SINSB01","SINSB02","SINSB03","SINSB04","SINXB01")
#stationlist = ("S10CB01","S10CB02","S10CB03","S10CB04","S10CB05","S10CB06","S10CB07","S10CB08","S10CB09")
#stationlist = ("S20CB01","S20CB02","S20CB03","S20CB04")
#stationlist = ("S30CB01","S30CB02","S30CB03","S30CB04","S30CB05","S30CB06","S30CB07","S30CB08","S30CB09","S30CB10","S30CB11","S30CB12","S30CB13")
do_VRF = True
VRFGAIN = "S10:SET-E-GAIN-OP"
do_VRF = False
#VRFGAIN = "S10:SET-E-GAIN-OP"
#VRFGAIN = "S20:SET-E-GAIN-OP"
#VRFGAIN = "S30:SET-E-GAIN-OP"

View File

@@ -52,7 +52,7 @@ bph.config.rotation = True # will go back to zero if > 360 deg
bph.config.save()
bph.initialize()
bph.update()
bph0 = bph.read() % 360.0
#bph0 = bph.read() % 360.0
rph.initialize()
rph.monitored=True
bph0 = bph.read()

View File

@@ -1,13 +1,14 @@
# TDS calibration from phase jitter, to be completed...
MO_FREQ = 142.8e6 # MO = 142.8 MHz
run('Tools/CameraCorrelation')
start_camera_correlation("SATMA02-RLLE-DSP:PHASE-VS",
"SATBD02-DSCR050_sp1 x_center_of_mass",
#"SATBD02-DSCR050_sp x_center_of_mass",
"SLG-LCAM-C103_sp x_center_of_mass",
samples = 200, modulo = 10, offset = 0, plt = plot(None)[0])
while True:
# the loop should run until the value is stable or a timeout is reached
a = linear_fit.read()
b = correlation.read()
stop_camera_correlation()
MO_FREQ = 142.8e6 # MO = 142.8 MHz
calib = a * 360 * 84 * MO_FREQ / 1e15 # um/fs
print(calib)

158
script/RFscan/phase_scan_caqtdm.py Executable file → Normal file
View File

@@ -3,100 +3,88 @@ import ch.psi.pshell.epics.ChannelDouble as ChannelDouble
dry_run = False
do_elog = True
#station = "S30CB09" # define param locally
#bpm_ch = "SARCL02-DBPM110"
#bpm_field = "X1"
is_panel = get_exec_pars().source != CommandSource.ui
if is_panel:
run("RFscan/phase_scan_data.py")
if get_exec_pars().args: # args is set by callin process (Qt panel)
station = args[0]
bpm_ch = args[1]
bpm_field = args[2]
else:
station = "SATCB01"
bpm_ch = "SATBD02-DBPM010"
bpm_field = "Y2"
#station = "S30CB13"
#bpm_ch = "SARCL02-DBPM110"
#bpm_field = "X1"
#station = "STEST01"
#bpm_ch = "SINBC02-DBPM140"
#bpm_field = "X1"
if dry_run:
station = "STEST01"
bpm_ch = "SINBC02-DBPM140"
bpm_field = "X1-SIMU"
bpm_val = ChannelDouble("BPM position", bpm_ch + ":" + bpm_field)
amplt = ChannelDouble(station + " Amplitude", station + "-RSYS:GET-VSUM-AMPLT")
power = ChannelDouble(station + " Klystron Power", station + "-RSYS:GET-KLY-POWER-GATED")
bpm_val.initialize()
amplt.initialize()
power.initialize()
phase = Positioner("Phase", station + "-RSYS:SET-VSUM-PHASE", station + "-RSYS:GET-VSUM-PHASE")
phase.config.minValue = -90.0 # cannot be zero, we need margin for scanning around 0 deg
phase.config.maxValue = 360.0
phase.config.precision = 4 # digits beyond this are ignored
phase.config.resolution = 0.3 # dead-band for comparing set and get values
phase.config.rotation = True # forced to 0..360 deg for comparison
phase.initialize()
phase0 = phase.read()
start = caget(station + "-RSYS:SET-SCAN-START")
stop = caget(station + "-RSYS:SET-SCAN-STOP")
end = caget(station + "-RSYS:SET-SCAN-STOP")
step = caget(station + "-RSYS:SET-SCAN-STEP")
lat = caget(station + "-RSYS:SET-SCAN-WAIT-TIME")
nb = caget(station + "-RSYS:SET-NUM-AVERAGE")
disp = caget(bpm_ch + ":DISPERSION-OP")
def mbnd(bpm_ch):
return {
'SINLH02-DBPM210': 'SINLH02-MBND100',
'SINLH02-DBPM240': 'SINLH02-MBND100',
'SINBC02-DBPM140': 'SINBC02-MBND100',
'SINBC02-DBPM320': 'SINBC02-MBND100',
'S10BD01-DBPM020': 'S10DI01-MBND100',
'S10BC02-DBPM140': 'S10BC02-MBND100',
'S10BC02-DBPM320': 'S10BC02-MBND100',
'SARCL02-DBPM110': 'SARCL02-MBND100',
'SARCL02-DBPM220': 'SARCL02-MBND100',
'SARCL02-DBPM260': 'SARCL02-MBND100',
'SARCL02-DBPM330': 'SARCL02-MBND100',
'SARCL02-DBPM470': 'SARCL02-MBND100',
'SATBD02-DBPM010': 'SATBD01-MBND200'
}[bpm_ch]
p0 = caget(mbnd(bpm_ch) + ":P-READ")
p0 = caget(bpm_list[bpm_ch]["mbnd"] + ":P-READ")
bpm_averager = create_averager(bpm_val, nb, lat)
energy0 = p0 - 0.511
A = energy0 / (disp * 1000)
B = energy0
phase = Positioner("Phase", station + "-RSYS:SET-VSUM-PHASE", station + "-RSYS:GET-VSUM-PHASE")
phase.config.minValue =-90.0
phase.config.maxValue = 360.0
phase.config.precision = 4
phase.config.resolution = 0.3
phase.config.rotation = True
phase.initialize()
V = ChannelDouble(station + " Amplitude", station + "-RSYS:GET-VSUM-AMPLT")
P = ChannelDouble(station + " Klystron Power", station + "-RSYS:GET-KLY-POWER-GATED")
V.initialize()
P.initialize()
if dry_run:
x = ChannelDouble("BPM-X averager", bpm_ch + ":X1-SIMU")
else:
x = ChannelDouble("BPM-X averager", bpm_ch + ":" + bpm_field)
x.initialize()
phase0 = phase.read() % 360.0
caput(station + "-RSYS:GET-FIT-PHASE-ARRAY", to_array([0.0],'d'))
caput(station + "-RSYS:GET-FIT-ENERGY-ARRAY", to_array([0.0],'d'))
caput(station + "-RSYS:GET-ONCREST-VSUM-PHASE", float('nan'))
caput(station + "-RSYS:GET-ONCREST-VSUM-AMPLT", float('nan'))
caput(station + "-RSYS:GET-ONCREST-E-GAIN", float('nan'))
caput(station + "-RSYS:GET-ONCREST-KLY-POWER", float('nan'))
A, B = energy0 / (disp * 1000), energy0 # param to convert bpm mm to MeV
#update the plot dynamically
arr_phase,arr_energy = [],[]
arr_phase, arr_energy = [],[]
def after(rec):
global A, B
arr_phase.append(rec.positions[0])
arr_energy.append(A * rec.readables[0].mean + B)
caput(station + "-RSYS:GET-PHASE-ARRAY", to_array(arr_phase, 'd'))
caput(station + "-RSYS:GET-ENERGY-ARRAY", to_array(arr_energy,'d'))
caput("SF-PHASE-GLOBAL:GET-PHASE-ARRAY", to_array(arr_phase, 'd'))
caput("SF-PHASE-GLOBAL:GET-ENERGY-ARRAY", to_array(arr_energy,'d'))
#scan and plot
try:
phase.write(start)
time.sleep(5.0)
x_averager = create_averager(x, nb, lat)
r = lscan(phase, x_averager, start, stop, step, latency=lat, after_read = after)
caput(station + "-RSYS:GET-ONCREST-VSUM-PHASE", float('nan'))
caput(station + "-RSYS:GET-ONCREST-VSUM-AMPLT", float('nan'))
caput(station + "-RSYS:GET-ONCREST-E-GAIN", float('nan'))
caput(station + "-RSYS:GET-ONCREST-KLY-POWER", float('nan'))
caput(station + "-RSYS:GET-FIT-PHASE-ARRAY", to_array([0.0],'d'))
caput(station + "-RSYS:GET-FIT-ENERGY-ARRAY", to_array([0.0],'d'))
caput("SF-PHASE-GLOBAL:GET-FIT-PHASE-ARRAY", to_array([0.0],'d'))
caput("SF-PHASE-GLOBAL:GET-FIT-ENERGY-ARRAY", to_array([0.0],'d'))
feedback_state_init = {}
for feedback_channel in station_list[station]["feedback"]:
feedback_state = caget(feedback_channel)
feedback_state_init[feedback_channel] = feedback_state
caput(feedback_channel, 0)
time.sleep(1.0)
caput(station + "-RSYS:PHASE-SCAN-MESSAGE", "scanning " + station)
r = lscan(phase, bpm_averager, start, end, step, latency=lat, after_read = after)
energy = [A * val.mean + B for val in r.getReadable(0)] # convert bpm mm to MeV
rf_phase = r.getPositions(0)
if start < 0:
rf_phase = [((ph + 90) % 360) -90 for ph in rf_phase ]
energy = [A * val.mean + B for val in r.getReadable(0)]
rf_phase = [((ph + 90) % 360) -90 for ph in rf_phase ] # force phase values in -90..270 range
caput(station + "-RSYS:GET-ENERGY-ARRAY", to_array(energy, 'd'))
caput(station + "-RSYS:GET-PHASE-ARRAY", to_array(rf_phase,'d'))
caput("SF-PHASE-GLOBAL:GET-ENERGY-ARRAY", to_array(energy, 'd'))
caput("SF-PHASE-GLOBAL:GET-PHASE-ARRAY", to_array(rf_phase,'d'))
try:
run("CPython/wrapper")
(fit_amplitude, fit_phase_deg, fit_offset, ph_crest, fit_x, fit_y) = hfitoff(energy , rf_phase)
fit_amplitude, fit_phase_deg, fit_offset, ph_crest, fit_x, fit_y = hfitoff(energy, rf_phase)
except:
raise Exception("Fit failure")
plt = plot(None,name="phase scan")[0]
plt = plot(None, name="phase scan")[0]
if plt is not None:
plt.getSeries(0).setData(to_array(rf_phase,'d'), to_array(energy,'d'))
plt.getSeries(0).setPointSize(6)
@@ -105,30 +93,38 @@ try:
plt.getSeries(1).setData(fit_x, fit_y)
plt.getSeries(1).setPointsVisible(False)
plt.setLegendVisible(True)
ph_crest = ph_crest % 360
phase.write(ph_crest)
time.sleep(lat)
Ampl = V.read()
Power = P.read()
nominal_phase = ph_crest + 180 if station == "SINXB01" else ph_crest
phase.write(nominal_phase)
time.sleep(1.0)
nominal_ampl = amplt.read()
nominal_power = power.read()
caput(station + "-RSYS:GET-ONCREST-VSUM-PHASE", ph_crest)
caput(station + "-RSYS:GET-ONCREST-E-GAIN", fit_amplitude)
caput(station + "-RSYS:GET-ONCREST-VSUM-AMPLT", Ampl)
caput(station + "-RSYS:GET-ONCREST-KLY-POWER", Power)
caput(station + "-RSYS:GET-ONCREST-VSUM-AMPLT", nominal_ampl)
caput(station + "-RSYS:GET-ONCREST-KLY-POWER", nominal_power)
caput(station + "-RSYS:GET-FIT-PHASE-ARRAY", fit_x)
caput(station + "-RSYS:GET-FIT-ENERGY-ARRAY", fit_y)
caput("SF-PHASE-GLOBAL:GET-FIT-PHASE-ARRAY", fit_x)
caput("SF-PHASE-GLOBAL:GET-FIT-ENERGY-ARRAY", fit_y)
message = "on-crest phase " + str('{:.2f}'.format(ph_crest))
message = message + ", delta " + str('{:.2f}'.format(ph_crest - phase0))
caput(station + "-RSYS:PHASE-SCAN-MESSAGE", message)
phase_corr = caget(station + "-RSYS:GET-VSUM-PHASE-OFFSET-CORR")
phase_offset = 90.0 - ph_crest - phase_corr # nominal on-crest phase is 90 deg (also for SINXB01)
amplitude_scale = fit_amplitude / nominal_ampl if nominal_ampl != 0 else 0.0
power_scale = nominal_power / fit_amplitude**2 if fit_amplitude != 0 else 0.0
caput(station + "-RSYS:SET-VSUM-PHASE-OFFSET-BASE-CALC", phase_offset)
caput(station + "-RSYS:SET-VSUM-AMPLT-SCALE-CALC", amplitude_scale)
caput(station + "-RSYS:SET-VOLT-POWER-SCALE-CALC", power_scale)
finally:
for feedback_channel in station_list[station]["feedback"]:
feedback_state = feedback_state_init[feedback_channel]
caput(feedback_channel, feedback_state)
phase.write(phase0)
phase.close()
V.close()
P.close()
x.close()
phase_corr = caget(station + "-RSYS:GET-VSUM-PHASE-OFFSET-CORR")
phase_offset = 90.0 - ph_crest - phase_corr
amplitude_scale = fit_amplitude / Ampl if Ampl != 0 else 0.0
power_scale = Power / fit_amplitude**2 if fit_amplitude != 0 else 0.0
caput(station + "-RSYS:SET-VSUM-PHASE-OFFSET-BASE-CALC", phase_offset)
caput(station + "-RSYS:SET-VSUM-AMPLT-SCALE-CALC", amplitude_scale)
caput(station + "-RSYS:SET-VOLT-POWER-SCALE-CALC", power_scale)
amplt.close()
power.close()
bpm_val.close()
#Saving metadata
save_dataset ("experiment/Station" , station )

35
script/RFscan/phase_scan_caqtdm_set.py Executable file → Normal file
View File

@@ -1,37 +1,30 @@
do_elog = True
is_panel = get_exec_pars().source != CommandSource.ui
if is_panel:
station = args[0]
else:
station = "STEST01"
#station = "STEST01" # define param locally
if get_exec_pars().args: # args is set by callin process (Qt panel)
station = args[0]
phase_set = caget(station + "-RSYS:PHASE-SET")
ampli_set = caget(station + "-RSYS:AMPLT-SET")
power_set = caget(station + "-RSYS:POWER-SET")
n = 0
if (phase_set == 'True'):
if phase_set == 'True':
phase_offset = caget(station + "-RSYS:SET-VSUM-PHASE-OFFSET-BASE-CALC")
phase_offset_old = caget(station + "-RSYS:SET-VSUM-PHASE-OFFSET-BASE")
caput(station + "-RSYS:SET-VSUM-PHASE-OFFSET-BASE", phase_offset)
n = n + 1
if (ampli_set == 'True'):
if ampli_set == 'True':
vsum_ampl = caget(station + "-RSYS:GET-VSUM-AMPLT")
amplitude_scale = caget(station + "-RSYS:SET-VSUM-AMPLT-SCALE-CALC")
amplitude_scale_old = caget(station + "-RSYS:SET-VSUM-AMPLT-SCALE")
caput(station + "-RSYS:SET-VSUM-AMPLT-SCALE", amplitude_scale)
new_acc_volt = vsum_ampl * amplitude_scale
caput(station + "-RSYS:SET-ACC-VOLT", new_acc_volt)
n = n + 1
if (power_set == 'True'):
if power_set == 'True':
power_scale = caget(station + "-RSYS:SET-VOLT-POWER-SCALE-CALC")
power_scale_old = caget(station + "-RSYS:SET-VOLT-POWER-SCALE")
caput(station + "-RSYS:SET-VOLT-POWER-SCALE", power_scale)
n = n + 1
if n > 0:
if do_elog == True:
title = "Set RF calibration:" + station
log_msg = ""
if (phase_set == 'True'): log_msg = log_msg + station + "-RSYS:SET-VSUM-PHASE-OFFSET-BASE: %12.2f" % phase_offset + " deg (was %12.2f" % phase_offset_old + " deg )\n"
if (ampli_set == 'True'): log_msg = log_msg + station + "-RSYS:SET-VSUM-AMPLT-SCALE: %12.3f" % amplitude_scale + " MV (was %12.3f" % amplitude_scale_old + " MV )\n"
if (power_set == 'True'): log_msg = log_msg + station + "-RSYS:SET-VOLT-POWER-SCALE: %12.7f" % power_scale + " MW/MV^2 (was %12.7f" % power_scale_old + " MW/MV^2)"
attachments = []
elog(title, log_msg, attachments)
if do_elog == True and (phase_set == 'True' or ampli_set == 'True' or power_set == 'True'):
title = "Set RF calibration:" + station
log_msg = ""
if (phase_set == 'True'): log_msg = log_msg + station + "-RSYS:SET-VSUM-PHASE-OFFSET-BASE: %12.2f" % phase_offset + " deg (was %12.2f" % phase_offset_old + " deg )\n"
if (ampli_set == 'True'): log_msg = log_msg + station + "-RSYS:SET-VSUM-AMPLT-SCALE: %12.3f" % amplitude_scale + " MV (was %12.3f" % amplitude_scale_old + " MV )\n"
if (power_set == 'True'): log_msg = log_msg + station + "-RSYS:SET-VOLT-POWER-SCALE: %12.7f" % power_scale + " MW/MV^2 (was %12.7f" % power_scale_old + " MW/MV^2)"
attachments = []
elog(title, log_msg, attachments)

View File

@@ -0,0 +1,47 @@
#phase scan config
station_list = {"STEST01": {"bpm_ch": "SINBC02-DBPM140", "feedback": []},
"SINSB01": {"bpm_ch": "SINBC02-DBPM140", "feedback": ["SFB_ARRIVAL_TIME_GUN_AR:ONOFF1", "SFB_ARRIVAL_TIME_BC1_AR:ONOFF1", "SFB_COMPRESSION_BC1_AR:ONOFF1", "SFB_COMPRESSION_BC1_AR:ONOFF2"]},
"SINSB02": {"bpm_ch": "SINBC02-DBPM140", "feedback": ["SFB_ARRIVAL_TIME_GUN_AR:ONOFF1", "SFB_ARRIVAL_TIME_BC1_AR:ONOFF1", "SFB_COMPRESSION_BC1_AR:ONOFF1", "SFB_COMPRESSION_BC1_AR:ONOFF2"]},
"SINSB03": {"bpm_ch": "SINBC02-DBPM140", "feedback": ["SFB_ARRIVAL_TIME_GUN_AR:ONOFF1", "SFB_ARRIVAL_TIME_BC1_AR:ONOFF1", "SFB_COMPRESSION_BC1_AR:ONOFF1", "SFB_COMPRESSION_BC1_AR:ONOFF2"]},
"SINSB04": {"bpm_ch": "SINBC02-DBPM140", "feedback": ["SFB_ARRIVAL_TIME_GUN_AR:ONOFF1", "SFB_ARRIVAL_TIME_BC1_AR:ONOFF1", "SFB_COMPRESSION_BC1_AR:ONOFF1", "SFB_COMPRESSION_BC1_AR:ONOFF2"]},
"SINXB01": {"bpm_ch": "SINBC02-DBPM140", "feedback": ["SFB_ARRIVAL_TIME_GUN_AR:ONOFF1", "SFB_ARRIVAL_TIME_BC1_AR:ONOFF1", "SFB_COMPRESSION_BC1_AR:ONOFF1", "SFB_COMPRESSION_BC1_AR:ONOFF2"]},
"S10CB01": {"bpm_ch": "S10BC02-DBPM140", "feedback": ["SFB_COMPRESSION_BC2_AR:ONOFF1", "SFB_COMPRESSION_BC2_AR:ONOFF3", "SFB_COMPRESSION_BC2_AR:ONOFF2", "S10:SET-OP-MODE"]},
"S10CB02": {"bpm_ch": "S10BC02-DBPM140", "feedback": ["SFB_COMPRESSION_BC2_AR:ONOFF1", "SFB_COMPRESSION_BC2_AR:ONOFF3", "SFB_COMPRESSION_BC2_AR:ONOFF2", "S10:SET-OP-MODE"]},
"S10CB03": {"bpm_ch": "S10BC02-DBPM140", "feedback": ["SFB_COMPRESSION_BC2_AR:ONOFF1", "SFB_COMPRESSION_BC2_AR:ONOFF3", "SFB_COMPRESSION_BC2_AR:ONOFF2", "S10:SET-OP-MODE"]},
"S10CB04": {"bpm_ch": "S10BC02-DBPM140", "feedback": ["SFB_COMPRESSION_BC2_AR:ONOFF1", "SFB_COMPRESSION_BC2_AR:ONOFF3", "SFB_COMPRESSION_BC2_AR:ONOFF2", "S10:SET-OP-MODE"]},
"S10CB05": {"bpm_ch": "S10BC02-DBPM140", "feedback": ["SFB_COMPRESSION_BC2_AR:ONOFF1", "SFB_COMPRESSION_BC2_AR:ONOFF3", "SFB_COMPRESSION_BC2_AR:ONOFF2", "S10:SET-OP-MODE"]},
"S10CB06": {"bpm_ch": "S10BC02-DBPM140", "feedback": ["SFB_COMPRESSION_BC2_AR:ONOFF1", "SFB_COMPRESSION_BC2_AR:ONOFF3", "SFB_COMPRESSION_BC2_AR:ONOFF2", "S10:SET-OP-MODE"]},
"S10CB07": {"bpm_ch": "S10BC02-DBPM140", "feedback": ["SFB_COMPRESSION_BC2_AR:ONOFF1", "SFB_COMPRESSION_BC2_AR:ONOFF3", "SFB_COMPRESSION_BC2_AR:ONOFF2", "S10:SET-OP-MODE"]},
"S10CB08": {"bpm_ch": "S10BC02-DBPM140", "feedback": ["SFB_COMPRESSION_BC2_AR:ONOFF1", "SFB_COMPRESSION_BC2_AR:ONOFF3", "SFB_COMPRESSION_BC2_AR:ONOFF2", "S10:SET-OP-MODE"]},
"S10CB09": {"bpm_ch": "S10BC02-DBPM140", "feedback": ["SFB_COMPRESSION_BC2_AR:ONOFF1", "SFB_COMPRESSION_BC2_AR:ONOFF3", "SFB_COMPRESSION_BC2_AR:ONOFF2", "S10:SET-OP-MODE"]},
"S20CB01": {"bpm_ch": "SARCL02-DBPM110", "feedback": ["SFB_BEAM_ENERGY_ECOL_AR:ONOFF1", "S20:SET-OP-MODE", "S30:SET-OP-MODE"]},
"S20CB02": {"bpm_ch": "SARCL02-DBPM110", "feedback": ["SFB_BEAM_ENERGY_ECOL_AR:ONOFF1", "S20:SET-OP-MODE", "S30:SET-OP-MODE"]},
"S20CB03": {"bpm_ch": "SARCL02-DBPM110", "feedback": ["SFB_BEAM_ENERGY_ECOL_AR:ONOFF1", "S20:SET-OP-MODE", "S30:SET-OP-MODE"]},
"S20CB04": {"bpm_ch": "SARCL02-DBPM110", "feedback": ["SFB_BEAM_ENERGY_ECOL_AR:ONOFF1", "S20:SET-OP-MODE", "S30:SET-OP-MODE"]},
"S30CB01": {"bpm_ch": "SARCL02-DBPM110", "feedback": ["SFB_BEAM_ENERGY_ECOL_AR:ONOFF1", "S20:SET-OP-MODE", "S30:SET-OP-MODE"]},
"S30CB02": {"bpm_ch": "SARCL02-DBPM110", "feedback": ["SFB_BEAM_ENERGY_ECOL_AR:ONOFF1", "S20:SET-OP-MODE", "S30:SET-OP-MODE"]},
"S30CB03": {"bpm_ch": "SARCL02-DBPM110", "feedback": ["SFB_BEAM_ENERGY_ECOL_AR:ONOFF1", "S20:SET-OP-MODE", "S30:SET-OP-MODE"]},
"S30CB04": {"bpm_ch": "SARCL02-DBPM110", "feedback": ["SFB_BEAM_ENERGY_ECOL_AR:ONOFF1", "S20:SET-OP-MODE", "S30:SET-OP-MODE"]},
"S30CB05": {"bpm_ch": "SARCL02-DBPM110", "feedback": ["SFB_BEAM_ENERGY_ECOL_AR:ONOFF1", "S20:SET-OP-MODE", "S30:SET-OP-MODE"]},
"S30CB06": {"bpm_ch": "SARCL02-DBPM110", "feedback": ["SFB_BEAM_ENERGY_ECOL_AR:ONOFF1", "S20:SET-OP-MODE", "S30:SET-OP-MODE"]},
"S30CB07": {"bpm_ch": "SARCL02-DBPM110", "feedback": ["SFB_BEAM_ENERGY_ECOL_AR:ONOFF1", "S20:SET-OP-MODE", "S30:SET-OP-MODE"]},
"S30CB08": {"bpm_ch": "SARCL02-DBPM110", "feedback": ["SFB_BEAM_ENERGY_ECOL_AR:ONOFF1", "S20:SET-OP-MODE", "S30:SET-OP-MODE"]},
"S30CB09": {"bpm_ch": "SARCL02-DBPM110", "feedback": ["SFB_BEAM_ENERGY_ECOL_AR:ONOFF1", "S20:SET-OP-MODE", "S30:SET-OP-MODE"]},
"S30CB10": {"bpm_ch": "SARCL02-DBPM110", "feedback": ["SFB_BEAM_ENERGY_ECOL_AR:ONOFF1", "S20:SET-OP-MODE", "S30:SET-OP-MODE"]},
"S30CB11": {"bpm_ch": "SARCL02-DBPM110", "feedback": ["SFB_BEAM_ENERGY_ECOL_AR:ONOFF1", "S20:SET-OP-MODE", "S30:SET-OP-MODE"]},
"S30CB12": {"bpm_ch": "SARCL02-DBPM110", "feedback": ["SFB_BEAM_ENERGY_ECOL_AR:ONOFF1", "S20:SET-OP-MODE", "S30:SET-OP-MODE"]},
"S30CB13": {"bpm_ch": "SARCL02-DBPM110", "feedback": ["SFB_BEAM_ENERGY_ECOL_AR:ONOFF1", "S20:SET-OP-MODE", "S30:SET-OP-MODE"]},
"SATCB01": {"bpm_ch": "SATBD02-DBPM010", "feedback": ["SFB_BEAM_DUMP_AT:ONOFF1"]}}
bpm_list = {"SINLH02-DBPM210": {"bpm_field": "X1", "mbnd": "SINLH02-MBND100"},
"SINLH02-DBPM240": {"bpm_field": "X1", "mbnd": "SINLH02-MBND100"},
"SINBC02-DBPM140": {"bpm_field": "X1", "mbnd": "SINBC02-MBND100"},
"SINBC02-DBPM320": {"bpm_field": "X1", "mbnd": "SINBC02-MBND100"},
"S10BD01-DBPM020": {"bpm_field": "X1", "mbnd": "S10DI01-MBND100"},
"S10BC02-DBPM140": {"bpm_field": "X1", "mbnd": "S10BC02-MBND100"},
"S10BC02-DBPM320": {"bpm_field": "X1", "mbnd": "S10BC02-MBND100"},
"SARCL02-DBPM110": {"bpm_field": "X1", "mbnd": "SARCL02-MBND100"},
"SARCL02-DBPM220": {"bpm_field": "X1", "mbnd": "SARCL02-MBND100"},
"SARCL02-DBPM260": {"bpm_field": "X1", "mbnd": "SARCL02-MBND100"},
"SARCL02-DBPM330": {"bpm_field": "X1", "mbnd": "SARCL02-MBND100"},
"SARCL02-DBPM470": {"bpm_field": "X1", "mbnd": "SARCL02-MBND100"},
"SATBD02-DBPM010": {"bpm_field": "Y2", "mbnd": "SATBD01-MBND200"}}

View File

@@ -0,0 +1,11 @@
run("RFscan/phase_scan_data.py")
for station in station_list:
req = caget(station + "-RSYS:PHASE-SCAN-REQUIRED")
if req == "True":
feedback_list = station_list[station]["feedback"]
bpm_ch = station_list[station]["bpm_ch"]
bpm_field = bpm_list[bpm_ch]["bpm_field"]
run("RFscan/phase_scan_caqtdm.py")
run("RFscan/phase_scan_caqtdm_set.py")
caput(station + "-RSYS:PHASE-SCAN-REQUIRED", 0)

View File

@@ -1,20 +1,42 @@
# set scan parameters globally for the qt phasing tool
scan_range = 100.0
scan_range = 60.0
nb_steps = 21
nb_average = 10
wait_time = 0.1
#stationlist = ("SINSB01","SINSB02","SINSB03","SINSB04","SINXB01")
#stationlist = ("S10CB01","S10CB02","S10CB03","S10CB04","S10CB05","S10CB06","S10CB07","S10CB08","S10CB09")
#stationlist = ("S20CB01","S20CB02","S20CB03","S20CB04")
stationlist = ("S30CB01","S30CB02","S30CB03","S30CB04","S30CB05","S30CB06","S30CB07","S30CB08","S30CB09","S30CB10","S30CB11","S30CB12","S30CB13")
stationlist = ("SINSB01","SINSB02","SINSB03","SINSB04","SINXB01",
"S10CB01","S10CB02","S10CB03","S10CB04","S10CB05","S10CB06","S10CB07","S10CB08","S10CB09",
"S20CB01","S20CB02","S20CB03","S20CB04",
"S30CB01","S30CB02","S30CB03","S30CB04","S30CB05","S30CB06","S30CB07","S30CB08","S30CB09","S30CB10","S30CB11","S30CB12","S30CB13",
"SATCB01","STEST01")
P1, P2 = {}, {}
phase_start, phase_stop = {}, {}
for station in stationlist:
Ph_Vsum = caget(station + "-RSYS:SET-VSUM-PHASE")
Ph_Beam = caget(station + "-RSYS:SET-BEAM-PHASE")
P1[station] = Ph_Vsum - scan_range / 2 + 90 - Ph_Beam
P2[station] = Ph_Vsum + scan_range / 2 + 90 - Ph_Beam
Ph_Vsum = caget(station + "-RSYS:SET-VSUM-PHASE")
Ph_Offset = caget(station + "-RSYS:SET-VSUM-PHASE-OFFSET-BASE")
while Ph_Vsum > 360:
Ph_Vsum = Ph_Vsum - 360
Ph_Offset = Ph_Offset + 360
while Ph_Vsum < 0:
Ph_Vsum = Ph_Vsum + 360
Ph_Offset = Ph_Offset - 360
caput(station + "-RSYS:SET-VSUM-PHASE", Ph_Vsum)
caput(station + "-RSYS:SET-VSUM-PHASE-OFFSET-BASE", Ph_Offset)
nominal_phase = 270 if station == "SINXB01" else 90
range_start = Ph_Vsum - scan_range / 2 + nominal_phase - Ph_Beam
range_stop = Ph_Vsum + scan_range / 2 + nominal_phase - Ph_Beam
if range_stop > 360:
range_start = range_start - 360
range_stop = range_stop - 360
phase_start[station], phase_stop[station] = range_start, range_stop
for station in stationlist:
caput(station + "-RSYS:SET-SCAN-START", P1[station])
caput(station + "-RSYS:SET-SCAN-STOP", P2[station])
caput(station + "-RSYS:SET-SCAN-START", phase_start[station])
caput(station + "-RSYS:SET-SCAN-STOP", phase_stop[station])
caput(station + "-RSYS:SET-SCAN-STEP", scan_range / (nb_steps - 1))
caput(station + "-RSYS:SET-NUM-AVERAGE", nb_average)
caput(station + "-RSYS:SET-SCAN-WAIT-TIME", wait_time)
caput(station + "-RSYS:PHASE-SET", 1)
caput(station + "-RSYS:AMPLT-SET", 0)
caput(station + "-RSYS:POWER-SET", 0)

View File

@@ -6,24 +6,39 @@ else:
tds = "S30CB14"
run("Tools/BunchLengthTDSdata.py")
# stop the beam
caput("SIN-TIMAST-TMA:Beam-RF-OnDelay-Sel", 1)
caput("SIN-TIMAST-TMA:Beam-Apply-Cmd.PROC", 1)
caput("SIN-TIMAST-TMA:Bunch-1-Freq-Sel", 10)
caput("SIN-TIMAST-TMA:Bunch-2-Freq-Sel", 10)
# stop the beam and set rates to 1 Hz
if tds == "SATMA02":
caput("SIN-TIMAST-TMA:Bunch-2-OnDelay-Sel", 1)
caput("SIN-TIMAST-TMA:Beam-Apply-Cmd.PROC", 1)
caput("SIN-TIMAST-TMA:Bunch-2-Freq-Sel", 6)
else :
caput("SIN-TIMAST-TMA:Beam-RF-OnDelay-Sel", 1)
caput("SIN-TIMAST-TMA:Beam-Apply-Cmd.PROC", 1)
caput("SIN-TIMAST-TMA:Bunch-1-Freq-Sel", 10)
caput("SIN-TIMAST-TMA:Bunch-2-Freq-Sel", 10)
# beam stopper and coll.
# set mode and coll.
gap_init = []
if tds == "SINDI01":
caput("S10CB01-RSYS:REQUIRED-OP", 0)
caput("S10CB02-RSYS:REQUIRED-OP", 0)
caput("S10DI01-MBND100:P-SET", 297.0)
time.sleep(10.0)
if tds == "S30CB14":
caput("SARMA02-MBNP100:REQUEST", 1)
#caput("SARCL01-DCOL030:GAP", 5.0)
caput("SARCL02-VCOL290:GAP", 8.0)
gap_init.append(caget("SARCL02-VCOL290:GAP"))
caputq("SARCL02-VCOL290:GAP", 8.0)
# switch BLMs off
blm = tds_data[tds]["BLM"]
for i in range(len(blm)):
caput(blm[i] + ":B1_ROI_ACTIVE_OP", 0)
caput(blm[i] + ":B2_ROI_ACTIVE_OP", 0)
# set optics
quads = tds_data[tds]["quads"]
k1l = tds_data[tds]["K1L-meas"]
k1l_meas = tds_data[tds]["K1L-meas"]
i_set_init = []
for i in range(len(quads)):
caput(quads[i] + ":K1L-SET", k1l[i])
i_set_init.append(caget(quads[i] + ":I-SET"))
caput(quads[i] + ":K1L-SET", k1l_meas[i])

View File

@@ -6,21 +6,26 @@ else:
tds = "S30CB14"
run("Tools/BunchLengthTDSdata.py")
# stop the beam
caput("SIN-TIMAST-TMA:Beam-RF-OnDelay-Sel", 1)
caput("SIN-TIMAST-TMA:Beam-Apply-Cmd.PROC", 1)
caput("SIN-TIMAST-TMA:Bunch-1-Freq-Sel", 10)
caput("SIN-TIMAST-TMA:Bunch-2-Freq-Sel", 10)
# stop the beam and set rates to 1 Hz
if tds == "SATMA02":
caput("SIN-TIMAST-TMA:Bunch-2-OnDelay-Sel", 1)
caput("SIN-TIMAST-TMA:Beam-Apply-Cmd.PROC", 1)
else :
caput("SIN-TIMAST-TMA:Beam-RF-OnDelay-Sel", 1)
caput("SIN-TIMAST-TMA:Beam-Apply-Cmd.PROC", 1)
# beam stopper and coll.
# collimators
if tds == "S30CB14":
#caput("SARCL01-DCOL030:GAP", 5.0)
caput("SARCL02-VCOL290:GAP", 5.0)
caputq("SARCL02-VCOL290:GAP", gap_init[0])
# restore nominal optics
quads = tds_data[tds]["quads"]
k1l = tds_data[tds]["K1L-nom"]
for i in range(len(quads)):
caput(quads[i] + ":K1L-SET", k1l[i])
caput(quads[i] + ":I-SET", i_set_init[i])
caput(quads[i] + ":CYCLE", 2)
# show message: restore optics and coll.
#switch BLMs on
blm = tds_data[tds]["BLM"]
for i in range(len(blm)):
caput(blm[i] + ":B1_ROI_ACTIVE_OP", 1)
caput(blm[i] + ":B2_ROI_ACTIVE_OP", 1)

View File

@@ -6,6 +6,7 @@ dry_run = False
do_elog = True
USE_SCREEN_PANEL = True
MO_FREQ = 142.8e6 # MO = 142.8 MHz
FW_THRESHOLD = 0.20
is_panel = get_exec_pars().source != CommandSource.ui # run from panel
if is_panel:
start = args[0]
@@ -16,19 +17,25 @@ if is_panel:
thr = args[5]
tds = args[6]
bunch = args[7]
plt11 = args[8]
plt12 = args[9]
plt21 = args[10]
plt22 = args[11]
screen = args[8]
user_calib_enabled = args[9]
user_calib = args[10]
plt11 = args[11]
plt12 = args[12]
plt21 = args[13]
plt22 = args[14]
else:
start = -0.1
stop = 0.1 + 0.001
step = 0.05
nb = 5
lat = 2.0
thr = 250
tds = "S30CB14"
bunch = "Bunch1"
nb = 10
lat = 0.4
thr = 20
tds = "SATMA02"
bunch = "Bunch2"
screen = "SATBD01-DSCR120"
user_calib_enabled = False
user_calib = 1.0
plt11 = plot(None, title="Output")[0]
plt12 = plot(None, title="Output")[0]
plt21 = plot(None, title="Output")[0]
@@ -81,12 +88,11 @@ init_plots(plt12, plt22)
#Creating Phase positioner
if dry_run:
phase = DummyPositioner("TDS Phase")
camera_name = "simulation"
else:
phase = Positioner("TDS Phase", tds + "-RSYS:SET-BEAM-PHASE", tds + "-RSYS:SET-BEAM-PHASE")
camera_name = tds_data[tds]["screen"]
camera_name = screen
phase.config.minValue = -90.0
phase.config.maxValue = 270.0
phase.config.maxValue = 360.0
phase.config.precision = 4
phase.config.resolution = 0.05
phase.config.rotation = True
@@ -95,65 +101,57 @@ phase.initialize()
phase0 = phase.read() % 360
#Camera setup
if USE_SCREEN_PANEL:
cam_server.start(camera_name+"_sp1", True) # shared pipeline
else:
cam_server.start(camera_name) # generic pipeline
cam_server.setFunction("beam_full_width")
cam_server.setInstanceConfigValue("fw_threshold", 0.3)
cam_server.start(camera_name +"_sp", USE_SCREEN_PANEL)
cam_server.setFunction("bunch_length_op")
cam_server.setInstanceConfigValue("replace", True)
cam_server.setInstanceConfigValue("fw_threshold", FW_THRESHOLD)
cam_server.setThreshold(thr)
cam_server.setBackgroundSubtraction(False)
cam_server.setGoodRegion(0.1, 3.0)
print "Waiting for y_fw and y_fit"
cam_server.setGoodRegion(0.05, 5.0)
print "Waiting for fw and fit"
xy = tds_data[tds]["DEFAULTS"]["plane"]
timeout = 1.0
start_time = time.time()
while (True):
wait_cam_server_message()
y_fw = cam_server.stream.getChild("y_fw")
y_fit = cam_server.stream.getChild("gr_y_fit_standard_deviation")
if (y_fw is not None) and (y_fit is not None):
fw = cam_server.stream.getChild(xy + "_fw")
gr_fit = cam_server.stream.getChild("gr_" + xy + "_fit_standard_deviation")
if (fw is not None) and (gr_fit is not None):
break
if time.time() - start_time > timeout:
if y_fw is None:
raise Exception("y_fw not in camera stream")
if y_fit is None:
raise Exception("y_fit not in camera stream")
y_center_of_mass = cam_server.stream.getChild("y_center_of_mass")
y_rms = cam_server.stream.getChild("y_rms")
y_profile = cam_server.stream.getChild("y_profile")
y_axis = cam_server.stream.getChild("y_axis")
if fw is None:
raise Exception(xy + "_fw not in camera stream")
if gr_fit is None:
raise Exception(xy + "_fit not in camera stream")
com = cam_server.stream.getChild(xy + "_center_of_mass")
rms = cam_server.stream.getChild(xy + "_rms")
profile = cam_server.stream.getChild(xy + "_profile")
axis = cam_server.stream.getChild(xy + "_axis")
image = cam_server.getDataMatrix()
set_device_alias(image, "image")
#Creating averagers
com_averager = create_averager(y_center_of_mass, nb, -1) # -1 event based, waits for the next value
rms_averager = create_averager(y_rms, nb, -1)
fw_averager = create_averager(y_fw, nb, -1)
fit_averager = create_averager(y_fit, nb, -1)
com_averager = create_averager(com, nb, -1) # -1 event based, waits for the next value
rms_averager = create_averager(rms, nb, -1)
fw_averager = create_averager(fw, nb, -1)
fit_averager = create_averager(gr_fit, nb, -1)
rms_averager.monitored = True # not blocking, will return last nb values
fw_averager.monitored = True
fit_averager.monitored = True
#switch BLMs off
blm = tds_data[tds]["BLM"]
strg = ":B1_ROI_ACTIVE_OP" if bunch == "Bunch1" else ":B2_ROI_ACTIVE_OP"
for i in range(len(blm)):
if dry_run:
print(blm[i] + strg, 0)
else:
caput(blm[i] + strg, 0)
#The scan loop
try:
bunch1_charge = caget("SINEG01-DBPM340:Q1")
bunch2_charge = caget("SINEG01-DBPM340:Q2")
bunch_charge = bunch1_charge if bunch == "Bunch1" else bunch2_charge
sensor_list = [com_averager, rms_averager, fw_averager, fit_averager, y_axis, y_profile, y_center_of_mass]
sensor_list = [com_averager, rms_averager, fw_averager, fit_averager, axis, profile, com, image]
phase.write(start)
time.sleep(1.0)
time.sleep(3.0)
# get bs phase-jitter / screen position data for SATMA02 calib
r1 = lscan(phase, sensor_list, start, stop, step , latency=lat, after_read = update_plot_1)
start, stop = start + 180.0, stop + 180.0
phase.write(start)
time.sleep(10.0)
time.sleep(3.0)
r2 = lscan(phase, sensor_list, start, stop, step , latency=lat, after_read = update_plot_2)
finally:
phase.write(phase0)
@@ -161,20 +159,13 @@ finally:
cam_server.stop() # stops cam_server but does not close it cam_server is a global object
# stop the beam
if dry_run:
print("SIN-TIMAST-TMA:Beam-RF-OnDelay-Sel", 1)
print("SIN-TIMAST-TMA:Beam-Apply-Cmd.PROC", 1)
else:
caput("SIN-TIMAST-TMA:Beam-RF-OnDelay-Sel", 1)
caput("SIN-TIMAST-TMA:Beam-Apply-Cmd.PROC", 1)
#switch BLMs on
for i in range(len(blm)):
if dry_run:
print(blm[i] + strg, 1)
if not dry_run:
if bunch == "Bunch1":
caput("SIN-TIMAST-TMA:Bunch-1-OnDelay-Sel", 1)
else:
caput(blm[i] + strg, 1)
caput("SIN-TIMAST-TMA:Bunch-2-OnDelay-Sel", 1)
caput("SIN-TIMAST-TMA:Beam-Apply-Cmd.PROC", 1)
#output
def write_output(r, plt):
phase_pos = r.getPositions(0)
@@ -184,21 +175,23 @@ def write_output(r, plt):
bunch_center_stdev = [val.stdev for val in r.getReadable(0)]
a0, a1 = fit_polynomial(time_pos, bunch_center, 1)
calib = abs(a1) # in fs/um
#calib = 1
if user_calib_enabled:
calib = rf_period * 1e15 / 360 / user_calib / 1000 # in fs/um
if dry_run: calib = 1
bunch_length_rms = [val.mean * calib for val in r.getReadable(1)]
bunch_length_rms_average = sum(bunch_length_rms) / len(bunch_length_rms)
bunch_length_fw = [val.mean * calib for val in r.getReadable(2)]
bunch_length_fw_average = sum(bunch_length_fw) / len(bunch_length_fw)
bunch_length_fit = [val.mean * calib for val in r.getReadable(3)]
bunch_length_fit_average = sum(bunch_length_fit) / len(bunch_length_fit)
profiles_um = r[y_axis]
profiles_dig = r[y_profile]
profiles_com = r[y_center_of_mass]
com = sum(profiles_com) / len(profiles_com)
profiles_um = r[axis]
profiles_dig = r[profile]
profiles_com = r[com]
com_avg = sum(profiles_com) / len(profiles_com)
profiles_fs = []
profiles_kA = []
for i in range(len(r[y_axis])):
delta_um = profiles_com[i] - com
for i in range(len(r[axis])):
delta_um = profiles_com[i] - com_avg
profiles_fs.append([(val - delta_um) * calib for val in profiles_um[i]])
step_fs = (max(profiles_fs[i]) - min(profiles_fs[i])) / (len(profiles_fs[i]) - 1)
total_dig = float(sum(profiles_dig[i]))
@@ -216,12 +209,13 @@ bunch_length_fit = (bunch_length_fit_average1 + bunch_length_fit_average2) / 2
calib = (calib1 + calib2) / 2
#archiver channels
if bunch == "Bunch1":
caput(tds + "-RTDS100:BD-BUNCH1-DURATION", bunch_length_fw)
caput(tds + "-RTDS100:BD-BUNCH1-CALIBRATION", 1 / calib)
else:
caput(tds + "-RTDS100:BD-BUNCH2-DURATION", bunch_length_fw)
caput(tds + "-RTDS100:BD-BUNCH2-CALIBRATION", 1 / calib)
if do_elog:
if bunch == "Bunch1":
caput(tds + "-RTDS100:BD-BUNCH1-DURATION", bunch_length_rms)
caput(tds + "-RTDS100:BD-BUNCH1-CALIBRATION", 1 / calib)
else:
caput(tds + "-RTDS100:BD-BUNCH2-DURATION", bunch_length_rms)
caput(tds + "-RTDS100:BD-BUNCH2-CALIBRATION", 1 / calib)
#Elog entry
if do_elog:
@@ -247,13 +241,13 @@ if do_elog:
log_msg = log_msg + "Calibration: %0.4f" % calib + " fs/um"
sleep(0.1) #Give some time to plot to be finished - it is not sync with acquisition
file_name1 = os.path.abspath(get_context().setup.getContextPath() + "/BunchLengthScanPlot1.png")
plt11.saveSnapshot(file_name1, "png")
plt11.saveSnapshot(file_name1, "png", Dimension(400, 300))
file_name2 = os.path.abspath(get_context().setup.getContextPath() + "/BunchLengthCurrent1.png")
plt21.saveSnapshot(file_name2, "png")
plt21.saveSnapshot(file_name2, "png", Dimension(400, 300))
file_name3 = os.path.abspath(get_context().setup.getContextPath() + "/BunchLengthScanPlot2.png")
plt12.saveSnapshot(file_name3, "png")
plt12.saveSnapshot(file_name3, "png", Dimension(400, 300))
file_name4 = os.path.abspath(get_context().setup.getContextPath() + "/BunchLengthCurrent2.png")
plt22.saveSnapshot(file_name4, "png")
plt22.saveSnapshot(file_name4, "png", Dimension(400, 300))
elog(title, log_msg, [file_name1, file_name2, file_name3, file_name4])
set_return([bunch_length_rms_average1, bunch_length_fw_average1, bunch_length_fit_average1, calib1,

View File

@@ -1,47 +1,42 @@
#tds config
tds_data = {'SINDI01': {"harm": 21, "screen": "SINDI02-DSCR075",
tds_data = {"SINDI01": {"harm": 21,
"quads":
["SINDI02-MQUA020", "SINDI02-MQUA030", "SINDI02-MQUA050",
"SINDI02-MQUA060"],
"K1L-nom":
[-0.020000, 0.050000, -0.165000,
0.200000],
"K1L-meas":
[-0.389776, 0.324016, 0.067305,
0.174710],
"BLM": []},
'S30CB14': {"harm": 40, "screen": "SARCL01-DSCR170",
[-0.391000, 0.325000, 0.067500,
0.175300],
"BLM": [],
"DEFAULTS" : {"Start": -2.0, "Stop": 2.0, "Step": 2.0, "Nb": 10, "Lat": 2.0,
"Thr": 25, "Scr": "SINDI02-DSCR075", "plane": "y"}},
"S30CB14": {"harm": 40,
"quads":
["S30CB10-MQUA430", "S30CB11-MQUA430", "S30CB12-MQUA430",
"S30CB13-MQUA430", "S30CB14-MQUA430", "S30CB15-MQUA430",
"SARCL01-MQUA020", "SARCL01-MQUA050", "SARCL01-MQUA080",
"SARCL01-MQUA100", "SARCL01-MQUA140", "SARCL01-MQUA190"],
"K1L-nom":
[-0.125000, 0.125000, -0.125000,
0.125000, -0.125000, 0.125000,
-0.070000, 0.010000, -0.145000,
0.155000, 0.415000, -0.490000],
"K1L-meas":
[-0.102751, -0.014919, 0.112685,
-0.064000, -0.053854, 0.048777,
0.104904, -0.039548, -0.005735,
0.005119, -0.027870, -0.011176],
"BLM":
["SARCL02-DBLM135", "SARCL02-DBLM355", "SARUN01-DBLM065",
["S30CB14-DBLM445",
"SARCL02-DBLM050", "SARCL02-DBLM355", "SARUN01-DBLM065",
"SARUN03-DBLM030", "SARUN04-DBLM030", "SARUN05-DBLM030",
"SARUN06-DBLM030", "SARUN07-DBLM030", "SARUN08-DBLM030",
"SARUN09-DBLM030", "SARUN10-DBLM030", "SARUN11-DBLM030",
"SARUN12-DBLM030", "SARUN13-DBLM030", "SARUN14-DBLM030",
"SARUN15-DBLM030", "SARUN15-DBLM035", "SARUN20-DBLM035"]},
'SATMA02': {"harm": 84, "screen": "SATBD01-DSCR120",
"SARUN15-DBLM030", "SARUN15-DBLM035", "SARUN20-DBLM035"],
"DEFAULTS" : {"Start": -0.15, "Stop": 0.15, "Step": 0.15, "Nb": 10, "Lat": 2.0,
"Thr": 200, "Scr": "SARCL01-DSCR170", "plane": "y"}},
"SATMA02": {"harm": 84,
"quads":
["SATBD01-MQUA010", "SATBD01-MQUA030", "SATBD01-MQUA050",
"SATBD01-MQUA070", "SATBD01-MQUA090"],
"K1L-nom":
[ 0.150000, -0.185000, 0.040000,
0.140000, -0.225000],
"SATBD01-MQUA070", "SATBD01-MQUA090", "SATBD02-MQUA030"],
"K1L-meas":
[-0.090111, 0.108271, 0.025250,
-0.072006, -0.382500],
"BLM": []}}
[ 0.152300, -0.185800, 0.039800,
0.142400, -0.223600, -0.315600],
"BLM": ["SATBD01-DBLM205", "SATUN22-DBLM005"],
"DEFAULTS" : {"Start": -0.2, "Stop": 0.2, "Step": 0.2, "Nb": 10, "Lat": 2.0,
"Thr": 300, "Scr": "SATBD02-DSCR050", "plane": "x"}}}

View File

@@ -42,7 +42,7 @@ def start_camera_correlation(dispatcer_channel, camera_channel, samples=50, modu
_dispatcher_stream.setBufferCapacity(500)
camera_name, camera_channel = camera_channel.split(" ")
shared = camera_name.endswith("_sp1")
shared = camera_name.endswith("_sp")
cam_server.start(camera_name, shared )
camera_stream = cam_server.stream
camera_stream.setBufferCapacity(500)
@@ -112,7 +112,7 @@ def stop_camera_correlation():
#Testing
start_camera_correlation("SINEG01-DICT215:B1_CHARGE", "SATES31-CAMS187-RIXS1_sp1 intensity", samples = 40, plt=plot(None)[0])
start_camera_correlation("SINEG01-DICT215:B1_CHARGE", "SATES31-CAMS187-RIXS1_sp intensity", samples = 40, plt=plot(None)[0])
try:
time.sleep(10.0)
finally:

View File

@@ -11,5 +11,5 @@ else:
phase_rf = caget(tds + "-RSYS:GET-VSUM-PHASE")
phase_corr = caget(tds + "-RSYS:GET-VSUM-PHASE-OFFSET-CORR")
phase_offset = phase - phase_rf - phase_corr
print(tds + "-RSYS:SET-VSUM-PHASE-OFFSET-BASE", phase_offset)
caput(tds + "-RSYS:SET-VSUM-PHASE-OFFSET-BASE", phase_offset)
caput(tds + "-RSYS:SET-BEAM-PHASE", phase)

2
script/Tools/save_camera_data.py Executable file → Normal file
View File

@@ -40,7 +40,7 @@ else:
_server = cam_server
try:
_server.start(camera_name + "_sp1" if shared else camera_name, shared)
_server.start(camera_name + "_sp", shared)
if roi is not None and len(roi.strip())>0:
roi = json.loads(roi)

6
script/Tools/save_snapshot.py Executable file → Normal file
View File

@@ -18,11 +18,7 @@ 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.start(camera_name + "_sp", shared)
cam_server.waitNext(10000)
stream_value = cam_server.stream.take()

View File

@@ -4,19 +4,19 @@ udlylist = ("SATUN06","SATUN07","SATUN08","SATUN09","SATUN10",
uindlist = ("SATUN06","SATUN07","SATUN08","SATUN09","SATUN10","SATUN11","SATUN12","SATUN13",
"SATUN15","SATUN16","SATUN17","SATUN18","SATUN19","SATUN20","SATUN21","SATUN22")
#for udly in udlylist: caputq(udly + "-UDLY060:OFF-OP-SIMU", caget(udly + "-UDLY060:OFF-OP"))
#for udly in udlylist: caputq(udly + "-UDLY060:DEL-OP-SIMU", caget(udly + "-UDLY060:DEL-OP"))
#for udly in udlylist: caputq(udly + "-UDLY060:PH-SHIFT-OP-SIMU", caget(udly + "-UDLY060:PH-SHIFT-OP"))
for udly in udlylist: caputq(udly + "-UDLY060:OFF-OP-SIMU", caget(udly + "-UDLY060:OFF-OP"))
for udly in udlylist: caputq(udly + "-UDLY060:DEL-OP-SIMU", caget(udly + "-UDLY060:DEL-OP"))
for udly in udlylist: caputq(udly + "-UDLY060:PH-SHIFT-OP-SIMU", caget(udly + "-UDLY060:PH-SHIFT-OP"))
#for udly in udlylist: caputq(udly + "-UDLY060:GAP-U-SET-SIMU", caget(udly + "-CHIC:G1"))
#for udly in udlylist: caputq(udly + "-UDLY060:GAP-D-SET-SIMU", caget(udly + "-CHIC:G2"))
for udly in udlylist: caputq(udly + "-UDLY060:GAP-U-SET-SIMU", caget(udly + "-UDLY060:GAP-U-SET"))
for udly in udlylist: caputq(udly + "-UDLY060:GAP-D-SET-SIMU", caget(udly + "-UDLY060:GAP-D-SET"))
#for udly in udlylist: caputq(udly + "-UDLY060:GAP-U-SET-SIMU", caget(udly + "-UDLY060:GAP-U-SET"))
#for udly in udlylist: caputq(udly + "-UDLY060:GAP-D-SET-SIMU", caget(udly + "-UDLY060:GAP-D-SET"))
#for udly in udlylist: caputq(udly + "-UDLY060:OFF-OP-SIMU", 0.0)
#for udly in udlylist: caputq(udly + "-UDLY060:DEL-OP-SIMU", 0.020)
#for udly in udlylist: caputq(udly + "-UDLY060:GAP-U-SET-SIMU", 70)
#for udly in udlylist: caputq(udly + "-UDLY060:GAP-D-SET-SIMU", 60)
#for udly in udlylist: caputq(udly + "-UDLY060:PH-SHIFT-OP-SIMU", 0.0)
#for udly in udlylist: caputq(udly + "-UDLY060:PH-SHIFT-OP-SIMU", caget(udly + "-UDLY060:PH-SHIFT-OP-SIMU") + 360)
#for uind in uindlist: caputq(uind + "-UIND030:K_SET_SIMU", caget(uind + "-UIND030:K_SET"))
#for uind in uindlist: caputq(uind + "-UIND030:POL-SET-SIMU", caget(uind + "-UIND030:POL-SET"))
for uind in uindlist: caputq(uind + "-UIND030:K_SET_SIMU", caget(uind + "-UIND030:K_UND_SET"))
for uind in uindlist: caputq(uind + "-UIND030:POL-SET-SIMU", caget(uind + "-UIND030:POL-SET"))
#caputq("SATCB01:ENE-FILT-OP-SIMU", caget("SATCB01:ENE-FILT-OP"))

View File

@@ -19,4 +19,6 @@ if do_elog:
title = "Wavelength change"
log_msg = "Old photon energy: %0.2f" % Eph1 + " kev\n"
log_msg = log_msg + "New photon energy: %0.2f" % Eph2 + " keV\n"
elog(title, log_msg)
elog(title, log_msg)
set_return("Success")

View File

@@ -19,4 +19,6 @@ if do_elog:
title = "Wavelength change"
log_msg = "Old photon energy: %0.2f" % Eph1 + " kev\n"
log_msg = log_msg + "New photon energy: %0.2f" % Eph2 + " keV\n"
elog(title, log_msg)
elog(title, log_msg)
set_return("Success")

View File

@@ -1,20 +1,18 @@
from random import random
undlist = ("SARUN03","SARUN04","SARUN05","SARUN06","SARUN07","SARUN08","SARUN09",
"SARUN10","SARUN11","SARUN12","SARUN13","SARUN14","SARUN15")
i = 0
amp = 0.10
for und in undlist:
K_taper = (-1)**i * 0.25 + random() * 0.050 - 0.025
rand = random() * 0.7 + 0.3
K_taper = (-1)**i * amp * rand
i = i + 1
K = caget(und + "-UIND030:K_SET")
K_min = caget(und + "-UIND030:K_SET.DRVL")
K_max = caget(und + "-UIND030:K_SET.DRVH")
if K + K_taper > K_max:
K_taper = K_max - K - random() * 0.025
K_taper = -K_taper
if K + K_taper < K_min:
K_taper = K_min - K + random() * 0.025
print(K, K_taper, K + K_taper)
K_taper = -K_taper
caputq(und + "-UIND030:K_TAPER_SET", K_taper)
set_return("Success")

View File

@@ -23,4 +23,4 @@ if do_elog:
log_msg = "Old photon energy: %0.3f" % Eph1 + " kev\n"
log_msg = log_msg + "New photon energy: %0.3f" % Eph2 + " keV\n"
elog(title, log_msg)
set_return("Success")

View File

@@ -7,4 +7,5 @@ for und in undlist:
K = K + K_taper
caputq(und + "-UIND030:K_SET", K)
caputq(und + "-UIND030:K_TAPER_SET", 0.0)
set_return("Success")

View File

@@ -1,22 +1,20 @@
from random import random
undlist = ("SATUN06","SATUN07","SATUN08","SATUN09",
"SATUN10","SATUN11","SATUN12","SATUN13",
"SATUN15","SATUN16","SATUN17","SATUN18",
"SATUN19","SATUN20","SATUN21","SATUN22")
i = 0
amp = 0.6
for und in undlist:
K_taper = (-1)**i * 0.25 + random() * 0.180 - 0.090
rand = random() * 0.7 + 0.3
K_taper = (-1)**i * amp * rand
i = i + 1
K = caget(und + "-UIND030:K_SET")
K_min = caget(und + "-UIND030:K_SET.DRVL")
K_max = caget(und + "-UIND030:K_SET.DRVH")
if K + K_taper > K_max:
K_taper = K_max - K - random() * 0.025
K_taper = -K_taper
if K + K_taper < K_min:
K_taper = K_min - K + random() * 0.025
print(K_taper)
K_taper = -K_taper
caputq(und + "-UIND030:K_TAPER_SET", K_taper)
set_return("Success")

View File

@@ -18,3 +18,5 @@ time.sleep(0.5) # Make sure the new K values have been written
#Switching on radial motors (and pushing go) to ensure proper movements
for und in undlist: caput(und + "-UIND030:RADIAL-ON.PROC", 1)
for und in undlist: caput(und + "-UIND030:RADIAL-GO.PROC", 1)
set_return("Success")

View File

@@ -17,3 +17,5 @@ time.sleep(0.5) # Make sure the new K values have been written
#Switching on radial motors (and pushing go) to ensure proper movements
for und in undlist: caput(und + "-UIND030:RADIAL-ON.PROC", 1)
for und in undlist: caput(und + "-UIND030:RADIAL-GO.PROC", 1)
set_return("Success")

View File

@@ -17,3 +17,5 @@ time.sleep(0.5) # Make sure the new K values have been written
#Switching on radial motors (and pushing go) to ensure proper movements
for und in undlist: caput(und + "-UIND030:RADIAL-ON.PROC", 1)
for und in undlist: caput(und + "-UIND030:RADIAL-GO.PROC", 1)
set_return("Success")

View File

@@ -16,3 +16,4 @@ for und in undlist:
if taper_qua_start <= u <= taper_qua_stop: j = j + 1
caputq(und + "-UIND030:K_TAPER_SET", K_taper)
u = u + 1
set_return("Success")

View File

@@ -16,3 +16,4 @@ for und in undlist:
if taper_qua_start <= u <= taper_qua_stop: j = j + 1
if 0 <= u <= 7: caputq(und + "-UIND030:K_TAPER_SET", K_taper)
u = u + 1
set_return("Success")

View File

@@ -16,3 +16,4 @@ for und in undlist:
if taper_qua_start <= u <= taper_qua_stop: j = j + 1
if 8 <= u <= 15: caputq(und + "-UIND030:K_TAPER_SET", K_taper)
u = u + 1
set_return("Success")

View File

@@ -7,4 +7,4 @@ for und in undlist:
K = K + K_taper
caputq(und + "-UIND030:K_SET", K)
caputq(und + "-UIND030:K_TAPER_SET", 0.0)
set_return("Success")

View File

@@ -5,9 +5,9 @@ IN_POSITION_BAND = 10.0
# EInkommentieren fuer Messungen Mit PSCR136
# Auskommentieren fuer Messungen Mit PCEL
#
#cam_server.start("SATOP31-PSCR136_sp1", True)
cam_server.start("SATOP31-PSRD175_sp1", True)
#cam_server.start("SATOP31-PPRM176_sp1", True)
#cam_server.start("SATOP31-PSCR136_sp", True)
cam_server.start("SATOP31-PSRD175_sp", True)
#cam_server.start("SATOP31-PPRM176_sp", True)
cam_server.stream.waitCacheChange(-1)
i= cam_server.stream.getChild("intensity")
i_avg = create_averager(i, 20, interval = -1)

View File

@@ -393,10 +393,7 @@ def setup_camera_scan():
save_laser_state()
multiple_background = use_background and multiple_background
if source == "server":
if use_screen_panel_stream:
cam_server.start(camera_name + "_sp1", True)
else:
cam_server.start(camera_name)
cam_server.start(camera_name + "_sp", use_screen_panel_stream)
if use_background:
if not dry_run:
laser_off()

View File

@@ -0,0 +1,139 @@
import re
import json
#Discover camera server forwarding
cs = CameraClient("http://sf-daqsync-01:8888")
cameras = cs.getCameras()
camserver_cameras = []
for c in cameras:
try:
cfg=cs.getConfig(c)
if cfg.get("forwarder_port"):
if cfg["forwarder_port"]>0:
if cfg["source_type"] == "bsread":
camserver_cameras.append(c)
except:
pass
#Discover store pipelines
pc = ProxyClient("http://sf-daqsync-01:8889")
permanent_pipelines = pc.getPemanentInstances()
pc = PipelineClient("http://sf-daqsync-01:8889")
for p in permanent_pipelines.keys():
if not p.startswith("#"):
try:
cfg = pc.getConfig(permanent_pipelines[p])
if cfg.get("pipeline_type") == "store":
camserver_cameras.append(cfg["camera_name"])
except:
pass
#Resolve URLs
camserver_sources = {}
for c in camserver_cameras:
url=caget(c+":BSREADCONFIG")
url = url.lower().replace(".psi.ch", "")
camserver_sources[url] = c
print c, url
camserver_cfg_urls = [str(x) for x in camserver_sources.keys()]
#Enter direct URLS from ImageBuffer ConfigL file images.source
def remove_comments(input_string):
pattern = r'/\*.*?\*/'
result = re.sub(pattern, '', input_string, flags=re.DOTALL)
return result
file_name = os.path.abspath(expand_path("{script}/test/image.sources"))
file_name = "/afs/psi.ch/user/g/gobbo_a/dev/config/sf_imagebuffer/sources/image.sources"
try:
f=open(file_name,"r")
text =f.read()
finally:
f.close()
text = remove_comments(text)
image_buffer_urls_file = json.loads(text)
image_buffer_urls = [str(x["stream"].lower().replace(".psi.ch", "")) for x in image_buffer_urls_file["sources"]]
for url in image_buffer_urls:
print url
direct_urls = []
cam_server_urls = []
for x in image_buffer_urls:
if "daqsync" in x:
cam_server_urls.append(str(x))
else:
direct_urls.append(str(x))
conflicts = False
#Verify conficts
for url in direct_urls:
if url in cam_server_urls:
print "Conflict: ", url, (camserver_sources[url] if camserver_sources.get(url) else "?")
conflicts=True
elif url in camserver_cfg_urls:
print "Potential conflict: ", url, camserver_cfg_urls[url]
conflicts=True
if not conflicts:
print "No conflicts"
#Utility: get camera_name from direft URLs
#url = direct_urls[0]
#url="tcp://daqsf-sioc-cs-74:9130"
def get_direct_camera_names():
camera_names = {}
for url in direct_urls:
add_device(Stream("st1",url.replace("tcp://daqsf", "tcp://sf"), SocketType.PULL), True)
try:
st1.start()
st1.waitCacheChange(1000)
try:
camera=st1.take().getKeys()[0].replace(":FPICTURE", "")
except:
camera=None
finally:
st1.close()
camera_names[url]=camera
print url, camera
return camera_names
def get_streaming_cameras():
camera_names = {}
for url in image_buffer_urls:
add_device(Stream("st1",url.replace("tcp://daqsf", "tcp://sf"), SocketType.PULL), True)
try:
st1.start()
st1.waitCacheChange(1000)
try:
v=st1.take()
camera=v.getKeys()[0].replace(":FPICTURE", "")
shape = v.getShape(0)
camera_names[url]=camera
print url, camera, shape
except:
pass
finally:
st1.close()
return camera_names
def get_camera_urls():
cs = CameraClient("http://sf-daqsync-01:8888")
cameras = cs.getCameras()
for camera in cameras:
try:
url = caget(camera+":BSREADCONFIG")
except:
url = None
print camera, url

View File

@@ -16,8 +16,7 @@ snapshotFile = None
#cam_server.start(camera_name + "_sp", camera_name + "_sp1")
cam_server.start(camera_name + "_sp1", True)
cam_server.start(camera_name + "_sp", True)
cam_server.waitNext(10000)
stream_value = cam_server.stream.take()

View File

@@ -1,21 +1,23 @@
CAMERA = "SARES20-CAMS142-M3"
CAMERA = "SARFE10-PSSS059"
CAMERA = "SATBD02-DSCR050"
CAMERA = "SATES31-CAMS187-RIXS1"
CAMERA = "SAROP21-PPRM138"
CAMERA = "SARES20-CAMS142-C2"
#CAMERA = "SATES31-CAMS187-RIXS1"
#CAMERA = "SAROP21-PPRM138"
#CAMERA = "SARES20-CAMS142-C2"
#CAMERA = "SATBD02-DSCR050"
#CAMERA = "SARCL01-DSCR170"
CAMERA_URL = caget(CAMERA + ":BSREADCONFIG").replace("tcp://daq", "tcp://")
#CAMERA_URL= "tcp://sf-sioc-cs-83:9020"
#CAMERA_URL= "tcp://sf-sioc-cs-64:9000"
#sCAMERA_URL= "tcp://sf-daqsync-17:9002"
print CAMERA_URL
st1 = Stream("st1", CAMERA_URL, SocketType.PULL)
st1.initialize()
add_device(Stream("st1", CAMERA_URL, SocketType.PULL), True)
st1.start()
st1.waitCacheChange(3000)
try:
r=bscan (st1, records=5, timeout=10.0, save=False, enabled_plots=[st1,])
v= st1.getValues()
#r=bscan (st1, records=5, timeout=10.0, save=False, enabled_plots=[st1,])
#v= st1.getValues()
show_panel(st1)
finally:
st1.close()
pass
#st1.close()

View File

@@ -1,4 +1,4 @@
xxx = create_device("cs://sf-daqsync-01:8889/SLG-LCAM-C041_sp1?channel=intensity&samples=-10&interval=-1")
xxx = create_device("cs://sf-daqsync-01:8889/SLG-LCAM-C041_sp?channel=intensity&samples=-10&interval=-1")
add_device(xxx, True)
show_panel(xxx)

View File

@@ -26,7 +26,7 @@ if get_exec_pars().source == CommandSource.ui:
#dy = "SINDI01-RLLE-STA:SLAVE1-DLTIMER"
#dy = "SLG-LCAM-C042 y_rms"
#dytype = TYPE_CHANNEL
dy = "SATES31-CAMS187-RIXS1_sp1 intensity"
dy = "SATES31-CAMS187-RIXS1_sp intensity"
dytype = TYPE_CAMERA
#dy=get_beam_ok_channel(2)
#dytype = TYPE_STREAM
@@ -128,7 +128,7 @@ try:
_stream.initialize()
_stream.start(True)
if _camname != None:
shared = _camname.endswith("_sp1")
shared = _camname.endswith("_sp")
print "Camera: " , _camname, " shared: ", shared
cam_server.start(_camname, shared )

View File

@@ -4,7 +4,7 @@ from ch.psi.pshell.bs import StreamMerger as StreamMerger
set_exec_pars(save=False)
add_device (Stream("st1", cam_server.getStream("test_furka"), SocketType.SUB), True)
add_device (Stream("st2", cam_server.getStream("simulation_sp1"), SocketType.SUB), True)
add_device (Stream("st2", cam_server.getStream("simulation_sp"), SocketType.SUB), True)
add_device(Stream("st3", dispatcher), force = True)
st3.addScalar(get_beam_ok_channel(1))
st3.addScalar(get_beam_ok_channel(2))

View File

@@ -40,10 +40,8 @@ phase.initialize()
phase0 = phase.read() % 360
#Camera setup
if USE_SCREEN_PANEL:
cam_server.start(camera_name+"_sp1", True) # shared pipeline
else:
cam_server.start(camera_name) # generic pipeline
cam_server.start(camera_name+"_sp", USE_SCREEN_PANEL)
wait_cam_server_message()
x = cam_server.stream.getChild("x_center_of_mass")
dx = cam_server.stream.getChild("x_rms")

161
script/test/TestWireScan.py Normal file
View File

@@ -0,0 +1,161 @@
CALCULATE = True
class CalculateBLM(Readable):
def __init__(self, index):
self.index = index
def getName(self):
return "blm" + str(self.index + 1)
def read(self):
raw = st.take()[blms[self.index] + ":LOSS_SIGNAL_RAW"]
#min_wf=np.min(BLM_NAME:LOSS_SIGNAL_RAW[:1500])
#summa=sum(raw[(min_wf-20):(min_wf+20)])
#min_wf=min(raw[:1500])
min_wf=raw.index(min(raw[:1500]))
summa=sum(raw[(min_wf-20):(min_wf+20)])
print self.index , (min_wf-20) , (min_wf+20)
return summa
import traceback
is_embedded = (get_exec_pars().getCommand(False).parent != None)
has_args = is_embedded or (get_exec_pars().source != CommandSource.ui)
STREAM_CREATION_RETRIES = 3
MAX_RANGE_STEP = 3
run("Devices/Elements")
run("Devices/WireScanner")
run("Diagnostics/sig_process_wrapper")
#set_exec_pars(layout="default")
#Paramter parsing
prefix = args[0] if has_args else "SARCL01-DWSC160" # "SINDI01-DWSC090" # "S10DI01-DWSC010" #"S10CB07-DWSC440" #"SINDI01-DWSC090"
scan_type = args[1] if has_args else WireScanner.WireX1
scan_range = args[2] if has_args else []
cycles = args[3] if has_args else 2
#velocity = args[4] if has_args else 200
n_shot = args[4] if has_args else 200
bpms = args[5] if has_args else [] #get_wire_scanners_bpms(prefix)
blms = args[6] if has_args else get_wire_scanners_blms(prefix)
bkgrd = args[7] if has_args else 10
plt = args[8] if has_args else plot(None, title = "Wire Scan")[0]
save_raw = args[9] if has_args else False
bunch = args[10] if has_args else 1
adaptive = args[11] if has_args else 1 #0=Off, 1=Gain, 2=Gain+range
filter_beam_ok = (args[12] if (has_args and len(args)>12) else True)
do_elog = True if (has_args and (not is_embedded) and (plt is not None)) else False
print has_args, is_embedded, do_elog
print "WireScan parameters: ", prefix, scan_type, scan_range, cycles, n_shot, bpms, blms, bkgrd, bunch, adaptive
#Adaptive mode parameters
MIN_GAIN, MAX_GAIN = 0.5, 1.1
INCREMENT_FACTOR = 0.5
SCAN_RANGE_FACTOR = 6
MAX_RANGE_STEP = 300
SET_BLM_WS_MODE = True
SET_BLM_WS_SETTLING_TIME = 2.0
SET_BLM_WS_BS_READBACK_TIMEOUT = 10000 #ms
#TODO: configure biggerCAJ buffer size and set back to 10000
SAMPLE_CHANNEL_SIZE = 2049 #10000
SAMPLE_CHANNEL_EMPTY_VALUE = 0.0
BPM_SENSORS = [("x","X"+str(bunch)), ("y","Y"+str(bunch)), ("q","Q"+str(bunch))] #(logic name suffix, channel suffix)
#Plot setup
if plt is not None:
plt.clear()
plt.removeMarker(None)
plt.getAxis(plt.AxisId.X).setLabel("Position");
plt.getAxis(plt.AxisId.Y).setLabel("");
plt.getAxis(plt.AxisId.Y2).setLabel("");
plt.setLegendVisible(True);
snapshots = []
rr = get_repetition_rate(bunch)
channels=[]
for i in range (len(blms)):
index_blm = len(channels)
#channels.append (("blm" + str(i+1), blms[i] + ":B" + str(bunch) + "_LOSS_RAW"))
channels.append ((("blm_loss" + str(i+1)) if CALCULATE else ("blm" + str(i+1)) , blms[i] + ":B" + str(bunch) + "_LOSS"))
if plt is not None:
series = LinePlotSeries(blms[i], None, min(i+1, 2))
plt.addSeries(series)
series.setLinesVisible(False)
series.setPointSize(2)
if save_raw or CALCULATE:
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]))
if SET_BLM_WS_MODE and (len(blms)>0):
channels.append(("blm1_ws_mode", blms[0] + ":WS_RUNNING"))
channels.append(("beam_ok", get_beam_ok_channel(bunch)))
filename = get_exec_pars().path
#Stream creation
for retry in range(STREAM_CREATION_RETRIES):
try:
print "Starting stream..."
st = Stream("pulse_id", dispatcher)
for c in channels:
if c[1].endswith("LOSS_SIGNAL_RAW"):
st.addWaveform(c[0], c[1], int(100.0 / rr), 0)
else:
st.addScalar(c[0], c[1], int(100.0 / rr), 0)
st.initialize()
st.start()
add_device(st, True)
st.waitCacheChange(10000) #Wait stream be running before starting scan
break
except:
print "Error starting stream"
print sys.exc_info()[1]
if retry >= (STREAM_CREATION_RETRIES-1):
raise
else:
print "Retrying"
class Timestamp(Readable):
def read(self):
return st.getTimestamp()
start_time=time.time()
#Pseudo-device returning the wire position
class w_pos(Readable):
def read(self):
return time.time() - start_time
rec =None
scan_complete=False
cur_cycle = 1.0
if plt is not None:
for s in plt.getAllSeries():
s.clear()
plt.removeMarker(None)
l=[w_pos()] ; l.extend(st.getReadables()); l.append(Timestamp());
if CALCULATE:
for i in range (len(blms)):
l.append (CalculateBLM(i))
print "Start scan"
mscan (st, l, 10)
print "End scan"

View File

@@ -0,0 +1,23 @@
channels = [{"offset":0,"name":"S20SY02-DBPM080:Q1","modulo":10},
{"offset":0,"name":"S20SY02-DBLM075:WS_RUNNING","modulo":10},
{"offset":0,"name":"S20SY01-DWSC070:SCANNING","modulo":10},
{"offset":0,"name":"S20SY02-DBLM075:B1_LOSS_RAW","modulo":10},
{"offset":0,"name":"SIN-CVME-TIFGUN-EVR0:BUNCH-1-OK","modulo":10},
{"offset":0,"name":"S20SY01-DBPM060:X1","modulo":10},
{"offset":0,"name":"S20SY01-DBPM060:Y1","modulo":10},
{"offset":0,"name":"S20SY01-DBPM060:Q1","modulo":10},
{"offset":0,"name":"S20SY01-DWSC070:CURR_CYCL","modulo":10},
{"offset":0,"name":"S20SY02-DBPM080:Y1","modulo":10},
{"offset":0,"name":"S20SY03-DBLM025:B1_LOSS_RAW","modulo":10},
{"offset":0,"name":"S20SY02-DBPM080:X1","modulo":10},
{"offset":0,"name":"S20SY01-DWSC070:ENC_1_BS","modulo":10}]
names = [c["name"] for c in channels]
for ch in names:
print ch,
try:
val=bsget(ch)
print str(val)
except:
print sys.exc_info()[1]

View File

@@ -0,0 +1,4 @@
add_device(Stream("st1", "tcp://sf-daqsync-03.psi.ch:9003", SocketType.PULL), True)
st1.setAnalizeHeader(True)
st1.start()
show_panel(st1)

View File

@@ -1,19 +1,16 @@
st1 = Stream("st1", dispatcher)
add_device(st1, force = True)
ch1="SINEG01-DICT210:GUN_CHARGE"
ch1="SATMA02-RLLE-DSP:PHASE-VS"
wv1="SARES11-SPEC125-M1.roi_signal_x_profile"
s1=st1.addScalar(ch1,ch1, 1, 0)
#ch1="SARES11-SPEC125-M2.processing_parameters"
#wv1="SAR-CVME-TIFALL4:EvtSet"
wv2="SAR-CVME-TIFALL6:EvtSet"
#s1=st1.addScalar(ch1,ch1, 1, 0)
#w1=st1.addWaveform(wv1,wv1, 1, 0)
w2=st1.addWaveform(wv2,wv2, 1, 0)
#st1.addWaveform("phase", "SINXB01-RWVG100-DCP10:FOR-PHASE", 10, 0, 2048)
#st1.addWaveform("amplt", "SINXB01-RWVG100-DCP10:FOR-AMPLT", 10, 0, 2048)
st1.initialize()
add_device(st1, force = True)
st1.start(True)
print st1.waitCacheChange(5000)
try:
bscan (st1, 10, title="bscan")
#tscan (st1.getReadables(), 10, 1, title="tscan")
x = st1.take()
finally:
st1.close()
show_panel(st1)

View File

@@ -1,9 +1,8 @@
st1 = Stream("st1", dispatcher)
add_device(st1, force = True)
st1.addScalar("SLAAR21-LCAM-C561:intensity")
st1.addScalar("SLAAR21-LCAM-C561:x_fit_mean")
st1.addScalar("SLAAR21-LCAM-C561:y_fit_mean")
st1.initialize()
add_device(st1, force = True)
st1.start(True)
try:
bscan (st1, 10, save=False)

View File

@@ -0,0 +1,8 @@
run("RFscan/phase_scan_data.py")
for station in station_list:
req = caget(station + "-RSYS:PHASE-SCAN-REQUIRED")
if req == "True":
bpm_ch = station_list[station]["bpm_ch"]
bpm_field = bpm_list[bpm_ch]["bpm_field"]
print(station + "-RSYS:PHASE-SCAN-REQUIRED", 0)

2
script/test/dummy.py Normal file
View File

@@ -0,0 +1,2 @@
time.sleep(10.0)
set_return("Success")

268
script/test/image.sources Normal file
View File

@@ -0,0 +1,268 @@
/*
Get the bsread stream address from an image name (e.g. for SARES20-PROF142-M3:FPICTURE)
caget SARES20-PROF142-M3:BSREADCONFIG
the current camserver/pipline configuration can be found here: https://git.psi.ch/controls_highlevel_applications/cam_server_configuration/blob/master/configuration/pipeline_config/servers.json
*/
{
"sources": [
/* Gun Laser */
{"stream":"tcp://daqsf-sioc-cs-01.psi.ch:8160","split":4,"backend":"sf-imagebuffer"}
/* Machine */
,{"stream":"tcp://daqsf-sioc-cs-11.psi.ch:8020","split":4,"backend":"sf-imagebuffer"}
,{"stream":"tcp://daqsf-sioc-cs-11.psi.ch:8030","split":4,"backend":"sf-imagebuffer"}
,{"stream":"tcp://daqsf-sioc-cs-11.psi.ch:8040","split":4,"backend":"sf-imagebuffer"}
,{"stream":"tcp://daqsf-sioc-cs-11.psi.ch:9000","split":4,"backend":"sf-imagebuffer"}
,{"stream":"tcp://daqsf-sioc-cs-11.psi.ch:9010","split":4,"backend":"sf-imagebuffer"}
,{"stream":"tcp://daqsf-sioc-cs-11.psi.ch:9020","split":4,"backend":"sf-imagebuffer"}
,{"stream":"tcp://daqsf-sioc-cs-11.psi.ch:9030","split":4,"backend":"sf-imagebuffer"}
,{"stream":"tcp://daqsf-sioc-cs-11.psi.ch:9040","split":4,"backend":"sf-imagebuffer"}
,{"stream":"tcp://daqsf-sioc-cs-11.psi.ch:9050","split":4,"backend":"sf-imagebuffer"}
,{"stream":"tcp://daqsf-sioc-cs-11.psi.ch:9060","split":4,"backend":"sf-imagebuffer"}
,{"stream":"tcp://daqsf-sioc-cs-11.psi.ch:9070","split":4,"backend":"sf-imagebuffer"}
,{"stream":"tcp://daqsf-sioc-cs-11.psi.ch:9080","split":4,"backend":"sf-imagebuffer"}
,{"stream":"tcp://daqsf-sioc-cs-11.psi.ch:9100","split":4,"backend":"sf-imagebuffer"}
,{"stream":"tcp://daqsf-sioc-cs-11.psi.ch:9110","split":4,"backend":"sf-imagebuffer"}
,{"stream":"tcp://daqsf-sioc-cs-11.psi.ch:9120","split":4,"backend":"sf-imagebuffer"}
,{"stream":"tcp://daqsf-sioc-cs-11.psi.ch:9130","split":4,"backend":"sf-imagebuffer"}
,{"stream":"tcp://daqsf-sioc-cs-11.psi.ch:9140","split":4,"backend":"sf-imagebuffer"}
,{"stream":"tcp://daqsf-sioc-cs-11.psi.ch:9150","split":4,"backend":"sf-imagebuffer"}
,{"stream":"tcp://daqsf-sioc-cs-11.psi.ch:9160","split":4,"backend":"sf-imagebuffer"}
,{"stream":"tcp://daqsf-sioc-cs-11.psi.ch:9170","split":4,"backend":"sf-imagebuffer"}
,{"stream":"tcp://daqsf-sioc-cs-11.psi.ch:9180","split":4,"backend":"sf-imagebuffer"}
,{"stream":"tcp://daqsf-sioc-cs-11.psi.ch:9190","split":4,"backend":"sf-imagebuffer"}
,{"stream":"tcp://daqsf-sioc-cs-12.psi.ch:9000","split":4,"backend":"sf-imagebuffer"}
,{"stream":"tcp://daqsf-sioc-cs-12.psi.ch:9010","split":4,"backend":"sf-imagebuffer"}
,{"stream":"tcp://daqsf-sioc-cs-13.psi.ch:9000","split":4,"backend":"sf-imagebuffer"}
/* ,{"stream":"tcp://daqsf-sioc-cs-13.psi.ch:9010","split":4,"backend":"sf-imagebuffer"} */
,{"stream":"tcp://daqsf-sioc-cs-14.psi.ch:9000","split":4,"backend":"sf-imagebuffer"}
/* ,{"stream":"tcp://daqsf-sioc-cs-14.psi.ch:9010","split":4,"backend":"sf-imagebuffer"} */
,{"stream":"tcp://daqsf-sioc-cs-14.psi.ch:9020","split":4,"backend":"sf-imagebuffer"}
,{"stream":"tcp://daqsf-sioc-cs-21.psi.ch:9000","split":4,"backend":"sf-imagebuffer"}
/* ,{"stream":"tcp://daqsf-sioc-cs-21.psi.ch:9010","split":4,"backend":"sf-imagebuffer"} */
,{"stream":"tcp://daqsf-sioc-cs-31.psi.ch:9000","split":4,"backend":"sf-imagebuffer"}
/* ,{"stream":"tcp://daqsf-sioc-cs-31.psi.ch:9020","split":4,"backend":"sf-imagebuffer"} */
,{"stream":"tcp://daqsf-sioc-cs-31.psi.ch:9010","split":4,"backend":"sf-imagebuffer"}
,{"stream":"tcp://daqsf-sioc-cs-41.psi.ch:9000","split":4,"backend":"sf-imagebuffer"}
,{"stream":"tcp://daqsf-sioc-cs-41.psi.ch:9010","split":4,"backend":"sf-imagebuffer"}
,{"stream":"tcp://daqsf-sioc-cs-42.psi.ch:9010","split":4,"backend":"sf-imagebuffer"}
,{"stream":"tcp://daqsf-sioc-cs-42.psi.ch:9020","split":4,"backend":"sf-imagebuffer"}
,{"stream":"tcp://daqsf-sioc-cs-42.psi.ch:9030","split":4,"backend":"sf-imagebuffer"}
,{"stream":"tcp://daqsf-sioc-cs-42.psi.ch:9040","split":4,"backend":"sf-imagebuffer"}
,{"stream":"tcp://daqsf-sioc-cs-42.psi.ch:9050","split":4,"backend":"sf-imagebuffer"}
,{"stream":"tcp://daqsf-sioc-cs-51.psi.ch:9000","split":4,"backend":"sf-imagebuffer"}
,{"stream":"tcp://daqsf-sioc-cs-61.psi.ch:9000","split":4,"backend":"sf-imagebuffer"}
,{"stream":"tcp://daqsf-sioc-cs-61.psi.ch:9010","split":4,"backend":"sf-imagebuffer"}
,{"stream":"tcp://daqsf-sioc-cs-62.psi.ch:9000","split":4,"backend":"sf-imagebuffer"}
,{"stream":"tcp://daqsf-sioc-cs-62.psi.ch:9010","split":4,"backend":"sf-imagebuffer"}
/* ,{"stream":"tcp://daqsf-sioc-cs-63.psi.ch:9000","split":4,"backend":"sf-imagebuffer"} */
,{"stream":"tcp://daqsf-sioc-cs-63.psi.ch:9010","split":4,"backend":"sf-imagebuffer"}
/* ,{"stream":"tcp://daqsf-sioc-cs-64.psi.ch:9000","split":4,"backend":"sf-imagebuffer"} SATBD02-DSCR050*/
,{"stream":"tcp://daqsf-sioc-cs-64.psi.ch:9010","split":4,"backend":"sf-imagebuffer"}
/* Aramis Pump Laser */
,{"stream":"tcp://daqsf-sioc-cs-71.psi.ch:8090","split":4,"backend":"sf-imagebuffer"}
/* Athos Machine + Photonics */
,{"stream":"tcp://daqsf-sioc-cs-65.psi.ch:9000","split":4,"backend":"sf-imagebuffer"}
,{"stream":"tcp://daqsf-sioc-cs-65.psi.ch:9010","split":4,"backend":"sf-imagebuffer"}
,{"stream":"tcp://daqsf-sioc-cs-65.psi.ch:9020","split":4,"backend":"sf-imagebuffer"}
/* Aramis Photonics */
/* ,{"stream":"tcp://daqsf-sioc-cs-72.psi.ch:9000","split":4,"backend":"sf-imagebuffer"} */
/* ,{"stream":"tcp://daqsf-sioc-cs-72.psi.ch:9010","split":4,"backend":"sf-imagebuffer"} */
/* ,{"stream":"tcp://daqsf-sioc-cs-72.psi.ch:9020","split":4,"backend":"sf-imagebuffer"} */
/* ,{"stream":"tcp://daqsf-sioc-cs-73.psi.ch:9000","split":4,"backend":"sf-imagebuffer"} */
,{"stream":"tcp://daqsf-sioc-cs-74.psi.ch:9000","split":4,"backend":"sf-imagebuffer"}
/* ,{"stream":"tcp://daqsf-sioc-cs-74.psi.ch:9010","split":4,"backend":"sf-imagebuffer"} */
,{"stream":"tcp://daqsf-sioc-cs-74.psi.ch:9020","split":4,"backend":"sf-imagebuffer"}
,{"stream":"tcp://daqsf-sioc-cs-74.psi.ch:9030","split":4,"backend":"sf-imagebuffer"}
,{"stream":"tcp://daqsf-sioc-cs-74.psi.ch:9040","split":4,"backend":"sf-imagebuffer"}
,{"stream":"tcp://daqsf-sioc-cs-74.psi.ch:9050","split":4,"backend":"sf-imagebuffer"}
,{"stream":"tcp://daqsf-sioc-cs-74.psi.ch:9060","split":4,"backend":"sf-imagebuffer"}
,{"stream":"tcp://daqsf-sioc-cs-74.psi.ch:9070","split":4,"backend":"sf-imagebuffer"}
,{"stream":"tcp://daqsf-sioc-cs-74.psi.ch:9090","split":4,"backend":"sf-imagebuffer"}
/* ,{"stream":"tcp://daqsf-sioc-cs-74.psi.ch:9100","split":4,"backend":"sf-imagebuffer"} */
,{"stream":"tcp://daqsf-sioc-cs-74.psi.ch:9120","split":4,"backend":"sf-imagebuffer"}
,{"stream":"tcp://daqsf-sioc-cs-74.psi.ch:9130","split":4,"backend":"sf-imagebuffer"}
,{"stream":"tcp://daqsf-sioc-cs-74.psi.ch:9140","split":4,"backend":"sf-imagebuffer"}
,{"stream":"tcp://daqsf-sioc-cs-74.psi.ch:9150","split":4,"backend":"sf-imagebuffer"}
/* ,{"stream":"tcp://daqsf-sioc-cs-74.psi.ch:9160","split":4,"backend":"sf-imagebuffer"} */
/* ,{"stream":"tcp://daqsf-sioc-cs-74.psi.ch:9170","split":4,"backend":"sf-imagebuffer"} */
/* Aramis ESA-Alvra */
/* ,{"stream":"tcp://daqsf-sioc-cs-81.psi.ch:9000","split":4,"backend":"sf-imagebuffer"} */
,{"stream":"tcp://daqsf-sioc-cs-81.psi.ch:9010","split":4,"backend":"sf-imagebuffer"}
,{"stream":"tcp://daqsf-sioc-cs-81.psi.ch:9030","split":4,"backend":"sf-imagebuffer"}
/* Aramis ESB-Bernina */
,{"stream":"tcp://daqsf-sioc-cs-83.psi.ch:8060","split":4,"backend":"sf-imagebuffer"}
/* ,{"stream":"tcp://daqsf-sioc-cs-83.psi.ch:9000","split":4,"backend":"sf-imagebuffer"} */
,{"stream":"tcp://daqsf-sioc-cs-83.psi.ch:9010","split":4,"backend":"sf-imagebuffer"}
,{"stream":"tcp://daqsf-sioc-cs-83.psi.ch:9020","split":4,"backend":"sf-imagebuffer"}
/* ,{"stream":"tcp://daqsf-sioc-cs-83.psi.ch:9030","split":4,"backend":"sf-imagebuffer"} */
/* ,{"stream":"tcp://daqsf-sioc-cs-83.psi.ch:9040","split":4,"backend":"sf-imagebuffer"} */
/* ,{"stream":"tcp://daqsf-sioc-cs-83.psi.ch:9050","split":4,"backend":"sf-imagebuffer"} */
/* ,{"stream":"tcp://daqsf-sioc-cs-83.psi.ch:9060","split":4,"backend":"sf-imagebuffer"} */
/* ,{"stream":"tcp://daqsf-sioc-cs-83.psi.ch:9070","split":4,"backend":"sf-imagebuffer"} */
/* ,{"stream":"tcp://daqsf-sioc-cs-83.psi.ch:9080","split":4,"backend":"sf-imagebuffer"} */
,{"stream":"tcp://daqsf-sioc-cs-84.psi.ch:9000","split":4,"backend":"sf-imagebuffer"}
/* ,{"stream":"tcp://daqsf-sioc-cs-85.psi.ch:9000","split":4,"backend":"sf-imagebuffer"} */
/* ,{"stream":"tcp://daqsf-sioc-cs-85.psi.ch:9010","split":4,"backend":"sf-imagebuffer"} */
/* Aramis ESC-Cristallina */
,{"stream": "tcp://daqsf-sioc-cs-92.psi.ch:9000","split":4,"backend":"sf-imagebuffer", "labels": ["SARES30-CAMS156-PCO1"]}
/* ,{"stream": "tcp://daqsf-sioc-cs-91.psi.ch:9000","split":4,"backend":"sf-imagebuffer", "labels": ["SARES30-CAMS156-XE"]} */
,{"stream": "tcp://daqsf-sioc-cs-91.psi.ch:9020","split":4,"backend":"sf-imagebuffer", "labels": ["SARES30-CAMS156-SMX-OAV"]}
,{"stream": "tcp://daqsf-sioc-cs-91.psi.ch:9030","split":4,"backend":"sf-imagebuffer", "labels": ["SARES30-CAMS156-SMX-XEYE"]}
,{"stream": "tcp://daqsf-sioc-cs-91.psi.ch:9040","split":4,"backend":"sf-imagebuffer", "labels": ["SARES30-CAMS156-X8M"]}
/* Athos Photonics */
/* ,{"stream":"tcp://daqsf-sioc-cs-a1.psi.ch:9000","split":4,"backend":"sf-imagebuffer"} */
/* ,{"stream":"tcp://daqsf-sioc-cs-a1.psi.ch:9010","split":4,"backend":"sf-imagebuffer"} */
/* ,{"stream":"tcp://daqsf-sioc-cs-a1.psi.ch:9020","split":4,"backend":"sf-imagebuffer"} */
/* ,{"stream":"tcp://daqsf-sioc-cs-a1.psi.ch:9030","split":4,"backend":"sf-imagebuffer"} */
/* ,{"stream":"tcp://daqsf-sioc-cs-a1.psi.ch:9040","split":4,"backend":"sf-imagebuffer"} */
/* ,{"stream":"tcp://daqsf-sioc-cs-b1.psi.ch:9000","split":4,"backend":"sf-imagebuffer"} */
/* ,{"stream":"tcp://daqsf-sioc-cs-b1.psi.ch:9010","split":4,"backend":"sf-imagebuffer"} */
/* ,{"stream":"tcp://daqsf-sioc-cs-b1.psi.ch:9020","split":4,"backend":"sf-imagebuffer"} */
/* Athos Laser */
,{"stream":"tcp://daqsf-sioc-cs-b2.psi.ch:8020","split":4,"backend":"sf-imagebuffer", "labels": ["SLAAT01-LCAM-C602"]}
,{"stream":"tcp://daqsf-sioc-cs-b2.psi.ch:8110","split":4,"backend":"sf-imagebuffer", "labels": ["SLAAT01-LCAM-C603"]}
,{"stream":"tcp://daqsf-sioc-cs-b2.psi.ch:8120","split":4,"backend":"sf-imagebuffer"}
/* Athos ESE-Maloja */
/* ,{"stream":"tcp://daqsf-sioc-cs-c2.psi.ch:9000","split":4,"backend":"sf-imagebuffer", "labels": ["SATES21-CAMS154-GIGE1"]} */
/* ,{"stream":"tcp://daqsf-sioc-cs-c2.psi.ch:9010","split":4,"backend":"sf-imagebuffer", "labels": ["SATES21-CAMS154-GIGE2"]} */
/* ,{"stream":"tcp://daqsf-sioc-cs-c2.psi.ch:9020","split":4,"backend":"sf-imagebuffer", "labels": ["SATES21-CAMS154-GIGE3"]} */
/* ,{"stream":"tcp://daqsf-sioc-cs-c2.psi.ch:9030","split":4,"backend":"sf-imagebuffer", "labels": ["SATES21-CAMS154-GIGE4"]} */
/* ,{"stream":"tcp://daqsf-sioc-cs-c2.psi.ch:9040","split":4,"backend":"sf-imagebuffer", "labels": ["SATES21-CAMS154-GIGE5"]} */
/* ,{"stream":"tcp://daqsf-sioc-cs-c2.psi.ch:9050","split":4,"backend":"sf-imagebuffer", "labels": ["SATES21-CAMS154-GIGE6"]} */
/* ,{"stream":"tcp://daqsf-sioc-cs-c2.psi.ch:9060","split":4,"backend":"sf-imagebuffer", "labels": ["SATES21-CAMS154-GIGE7"]} */
/* ,{"stream":"tcp://daqsf-sioc-cs-c2.psi.ch:9070","split":4,"backend":"sf-imagebuffer", "labels": ["SATES21-CAMS154-GIGE8"]} */
/* Athos ESF-Furka */
/* ,{"stream":"tcp://daqsf-sioc-cs-c6.psi.ch:9000","split":4,"backend":"sf-imagebuffer"} */
/* ,{"stream":"tcp://daqsf-sioc-cs-c6.psi.ch:9010","split":4,"backend":"sf-imagebuffer"} */
,{"stream":"tcp://daqsf-sioc-cs-c6.psi.ch:9020","split":4,"backend":"sf-imagebuffer"}
,{"stream":"tcp://daqsf-sioc-cs-c6.psi.ch:9030","split":4,"backend":"sf-imagebuffer"}
,{"stream":"tcp://daqsf-sioc-cs-c6.psi.ch:9040","split":4,"backend":"sf-imagebuffer"}
,{"stream":"tcp://daqsf-sioc-cs-c6.psi.ch:9050","split":4,"backend":"sf-imagebuffer"}
/* PSSS SARFE10-PSSS059 */
,{"stream":"tcp://daqsf-daqsync-11.psi.ch:8890","split":4,"backend":"sf-imagebuffer", "labels": ["SARFE10-PSSS059"]}
,{"stream":"tcp://daqsf-daqsync-11.psi.ch:8891","split":4,"backend":"sf-imagebuffer", "labels": ["SARFE10-PSSS059-LB"]}
/* PMOS SATOP31-PMOS132-2D */
,{"stream":"tcp://daqsf-daqsync-03.psi.ch:9002","split":4,"backend":"sf-imagebuffer", "labels": ["SATOP31-PMOS132-2D"]}
/* SARFE10-PPRM064 */
,{"stream":"tcp://daqsf-daqsync-03.psi.ch:9015","split":4,"backend":"sf-imagebuffer", "labels": ["SARFE10-PPRM064"]}
/* SATES21-CAMS154-M1 */
,{"stream":"tcp://daqsf-daqsync-12.psi.ch:9000","split":4,"backend":"sf-imagebuffer", "labels": ["SATES21-CAMS154-M1"]}
/* SATES24-CAMS161-M1 */
,{"stream":"tcp://daqsf-daqsync-12.psi.ch:9010","split":4,"backend":"sf-imagebuffer", "labels": ["SATES24-CAMS161-M1"]}
/* SATES21-CAMS-PATT1 */
,{"stream":"tcp://daqsf-daqsync-12.psi.ch:9002","split":4,"backend":"sf-imagebuffer", "labels": ["SATES21-CAMS-PATT1"]}
,{"stream":"tcp://daqsf-daqsync-12.psi.ch:9040","split":4,"backend":"sf-imagebuffer", "labels": ["SATES21-CAMS154-GIGE8"]}
,{"stream":"tcp://daqsf-daqsync-12.psi.ch:9041","split":4,"backend":"sf-imagebuffer", "labels": ["SATES21-CAMS154-GIGE6"]}
,{"stream":"tcp://daqsf-daqsync-12.psi.ch:9042","split":4,"backend":"sf-imagebuffer", "labels": ["SATES21-CAMS154-GIGE7"]}
/* PSEN SARES11-SPEC125-M1 */
,{"stream":"tcp://daqsf-daqsync-13.psi.ch:9000","split":4,"backend":"sf-imagebuffer", "labels": ["SARES11-SPEC125-M1"]}
/* SARES11-SPEC125-M2 */
,{"stream":"tcp://daqsf-daqsync-13.psi.ch:9010","split":4,"backend":"sf-imagebuffer", "labels": ["SARES11-SPEC125-M2"]}
/* FLEX SARES12-CAMS128-M1 */
,{"stream":"tcp://daqsf-daqsync-13.psi.ch:9002","split":4,"backend":"sf-imagebuffer", "labels": ["SARES12-CAMS128-M1"]}
/* SARES12-XPR128-C4F1 */
,{"stream":"tcp://daqsf-daqsync-13.psi.ch:9004","split":4,"backend":"sf-imagebuffer", "labels": ["SARES12-XPR128-C4F1"]}
/* SARES11-XMI125-C4P1 */
,{"stream":"tcp://daqsf-daqsync-13.psi.ch:9005","split":4,"backend":"sf-imagebuffer", "labels": ["SARES11-XMI125-C4P1"]}
/* PSEN SARES20-CAMS142-M1 */
,{"stream":"tcp://daqsf-daqsync-14.psi.ch:9002","split":4,"backend":"sf-imagebuffer", "labels": ["SARES20-CAMS142-M1"]}
/* PSEN SARES20-CAMS142-M4 */
,{"stream":"tcp://daqsf-daqsync-14.psi.ch:9000","split":4,"backend":"sf-imagebuffer", "labels": ["SARES20-CAMS142-M4"]}
/* PSEN SARES20-CAMS142-M5 */
,{"stream":"tcp://daqsf-daqsync-14.psi.ch:9010","split":4,"backend":"sf-imagebuffer", "labels": ["SARES20-CAMS142-M5"]}
/* SARES20-PROF142-M1 */
/* ,{"stream": "tcp://daqsf-daqsync-14.psi.ch:9005","split":4,"backend":"sf-imagebuffer", "labels": ["SARES20-PROF142-M1"]} */
/* SPEC SARES20-PROF142-M1 */
,{"stream": "tcp://daqsf-daqsync-11.psi.ch:9003","split":4,"backend":"sf-imagebuffer", "labels": ["SARES20-PROF142-M1"]}
/* SARES20-PROF141-M1 pipeline */
,{"stream": "tcp://daqsf-daqsync-14.psi.ch:9013","split":4,"backend":"sf-imagebuffer", "labels": ["SARES20-PROF141-M1"]}
,{"stream": "tcp://daqsf-daqsync-14.psi.ch:9030","split":4,"backend":"sf-imagebuffer", "labels": ["SLAAR02-LPMO01-C321"]}
,{"stream": "tcp://daqsf-daqsync-14.psi.ch:9031","split":4,"backend":"sf-imagebuffer", "labels": ["SLAAR02-LPMO02-C322"]}
,{"stream": "tcp://daqsf-daqsync-14.psi.ch:9040","split":4,"backend":"sf-imagebuffer", "labels": ["SAROP21-PPRM113"]}
/* SAROP21_PPRM102 pipeline */
,{"stream": "tcp://daqsf-daqsync-14.psi.ch:9006","split":4,"backend":"sf-imagebuffer", "labels": ["SAROP21-PPRM102"]}
/* SAROP21_PPRM138 pipeline */
,{"stream": "tcp://daqsf-daqsync-14.psi.ch:9004","split":4,"backend":"sf-imagebuffer", "labels": ["SAROP21-PPRM138"]}
/*SARES20-DSDPPRM pipeline */
,{"stream": "tcp://daqsf-daqsync-14.psi.ch:9020","split":4,"backend":"sf-imagebuffer", "labels": ["SARES20-DSDPPRM"]}
/* SATES30-CAMS182-GIGE1 */
,{"stream": "tcp://daqsf-daqsync-15.psi.ch:9003","split":4,"backend":"sf-imagebuffer", "labels": ["SATES30-CAMS182-GIGE1"]}
/* SATES30-CAMS182-GIGE2 */
,{"stream": "tcp://daqsf-daqsync-15.psi.ch:9005","split":4,"backend":"sf-imagebuffer", "labels": ["SATES30-CAMS182-GIGE2"]}
/* SATES31-CAMS187-RIXS1 */
,{"stream": "tcp://daqsf-daqsync-15.psi.ch:9001","split":4,"backend":"sf-imagebuffer", "labels": ["SATES31-CAMS187-RIXS1"]}
,{"stream": "tcp://daqsf-daqsync-15.psi.ch:9007","split":4,"backend":"sf-imagebuffer", "labels": ["SATES30-RIXS-CAM01"]}
/* SAROP31-PPRM150 */
,{"stream": "tcp://daqsf-daqsync-16.psi.ch:9002","split":4,"backend":"sf-imagebuffer", "labels": ["SAROP31-PPRM150"]}
/* SAROP31-PPRM113 */
,{"stream": "tcp://daqsf-daqsync-16.psi.ch:9000","split":4,"backend":"sf-imagebuffer", "labels": ["SAROP31-PPRM113"]}
/* SARES30-CAMS156-XE */
,{"stream": "tcp://daqsf-daqsync-16.psi.ch:9006","split":4,"backend":"sf-imagebuffer", "labels": ["SARES30-CAMS156-XE"]}
/* SINBC02-DSRM310 */
,{"stream": "tcp://daqsf-daqsync-10.psi.ch:9011","split":4,"backend":"sf-imagebuffer", "labels": ["SINBC02-DSRM310"]}
/* SINDI02-DSCR075 */
,{"stream": "tcp://daqsf-daqsync-10.psi.ch:9010","split":4,"backend":"sf-imagebuffer", "labels": ["SINDI02-DSCR075"]}
/* S10BD01-DSCR030 */
,{"stream": "tcp://daqsf-daqsync-10.psi.ch:9012","split":4,"backend":"sf-imagebuffer", "labels": ["S10BD01-DSCR030"]}
/* SATBD02-DSCR050 */
,{"stream": "tcp://daqsf-daqsync-10.psi.ch:9013","split":4,"backend":"sf-imagebuffer", "labels": ["SATBD02-DSCR050"]}
/* SARCL01-DSCR170 */
,{"stream": "tcp://daqsf-daqsync-10.psi.ch:9014","split":4,"backend":"sf-imagebuffer", "labels": ["SARCL01-DSCR170"]}
/* S10BC02-DSRM310 */
,{"stream": "tcp://daqsf-daqsync-10.psi.ch:9015","split":4,"backend":"sf-imagebuffer", "labels": ["S10BC02-DSRM310"]}
]
}

View File

@@ -19,11 +19,7 @@ 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.start(camera_name + "_sp", shared)
cam_server.waitNext(10000)
stream_value = cam_server.stream.take()

10
script/test/test_bsf.py Normal file
View File

@@ -0,0 +1,10 @@
st1 = Stream("st1", dispatcher)
st1.addScalar("B1","SIN-CVME-TIFGUN-EVR0:BUNCH-1-OK", 1, 0)
st1.addScalar("B2","SIN-CVME-TIFGUN-EVR0:BUNCH-2-OK", 1, 0)
add_device(st1, force = True)
st1.start(True)
try:
bscan (st1, 10, save=False)
finally:
st1.close()

View File

@@ -0,0 +1,33 @@
import ch.psi.pshell.epics.Positioner as Positioner
import ch.psi.pshell.epics.ChannelDouble as ChannelDouble
station = "STEST01" # define param locally
bpm_ch = "SARCL02-DBPM110"
bpm_field = "X1"
run("RFscan/phase_scan_data.py")
x_bpm = ChannelDouble("BPM-X averager", bpm_ch + ":" + bpm_field)
start = caget(station + "-RSYS:SET-SCAN-START")
end = caget(station + "-RSYS:SET-SCAN-STOP")
step = caget(station + "-RSYS:SET-SCAN-STEP")
lat = caget(station + "-RSYS:SET-SCAN-WAIT-TIME")
nb = caget(station + "-RSYS:SET-NUM-AVERAGE")
disp = caget(bpm_ch + ":DISPERSION-OP")
p0 = caget(bpm_list[bpm_ch]["mbnd"] + ":P-READ")
energy0 = p0 - 0.511
A, B = energy0 / (disp * 1000), energy0
phase = Positioner("Phase", station + "-RSYS:SET-VSUM-PHASE", station + "-RSYS:GET-VSUM-PHASE")
phase.config.minValue = -90.0
phase.config.maxValue = 360.0
phase.config.precision = 4
phase.config.resolution = 0.3
phase.config.rotation = True
phase.initialize()
show_panel(phase)
V = ChannelDouble(station + " Amplitude", station + "-RSYS:GET-VSUM-AMPLT")
P = ChannelDouble(station + " Klystron Power", station + "-RSYS:GET-KLY-POWER-GATED")
V.initialize()
P.initialize()
x_bpm.initialize()
phase0 = phase.read()
print(phase0)