This commit is contained in:
gobbo_a
2023-08-17 15:16:51 +02:00
parent c545879253
commit 8beeb7dbc7
134 changed files with 3722 additions and 1287 deletions

View File

@@ -1,9 +1,12 @@
#Tue Jul 13 10:23:03 CEST 2021
#Thu May 04 15:07:35 CEST 2023
xscanMoveTimeout=600
autoSaveScanData=true
simulation=false
commandExecutionEvents=false
logDaysToLive=30
xscanCrlogicChannel=null
dataScanSaveOutput=false
xscanCrlogicSimulated=false
userAuthenticator=
logLevelConsole=Off
filePermissionsConfig=Default
@@ -13,44 +16,51 @@ dataScanSaveScript=false
dataScanSaveSetpoints=false
notifiedTasks=null
parallelInitialization=false
fdaSerialization=false
scanDataRelease=false
dataTransferPath=null
scanStreamingPort=-1
saveConsoleSessionFiles=false
xscanAppendSuffix=true
devicePoolFile={config}/devices.properties
versionTrackingManual=true
dataTransferMode=Off
hostName=
userManagement=false
instanceName=OP
disableEmbeddedAttributes=false
instanceName=OP
dataServerPort=-1
hideServerMessages=false
serverPort=8090
hideServerMessages=false
versionTrackingEnabled=true
dataPath={data}/{year}/{month}/{day}/{date}_{time}_{name}
serverEnabled=true
dataScanReleaseRecords=false
depthDimension=0
dataScanReleaseRecords=false
dataScanPreserveTypes=false
logLevel=Fine
dataScanFlushRecords=false
logPath={logs}/{date}_{time}
filePermissionsLogs=Default
filePermissionsLogs=Public
dataLayout=sf
disableDataFileLogs=false
sessionHandling=Off
deviceUpdateStrategyFile={config}/update.properties
terminalEnabled=false
notificationLevel=Off
filePermissionsScripts=Default
filePermissionsScripts=Public
terminalPort=3579
xscanCrlogicPrefix=null
tasksFile={config}/tasks.properties
dataTransferUser=null
filePermissionsData=Default
xscanCrlogicAbortable=true
xscanContinuousUpdate=false
createSessionFiles=false
versionTrackingLogin={context}/svcusr-hlapp_robot
noBytecodeFiles=false
versionTrackingRemote=git@git.psi.ch\:pshell_config/sf-op.git
dataProvider=default
xscanCrlogicIoc=null
dataScanLazyTableCreation=false
saveCommandStatistics=false

View File

@@ -1,7 +1,8 @@
dispatcher=ch.psi.pshell.bs.Dispatcher|https://dispatcher-api.psi.ch/sf|||
cam_server=ch.psi.pshell.bs.PipelineServer|sf-daqsync-01:8889|||
charge=ch.psi.pshell.epics.ProcessVariable|SINEG01-DICT215:B1_CHARGE_AVERAGE-OP|||
$rep_rate=ch.psi.pshell.epics.ProcessVariable|SIN-TIMAST-TMA:Beam-Appl-Freq-RB|||
rep_rate_bunch_1=ch.psi.pshell.epics.ProcessVariable|SIN-TIMAST-TMA:Bunch-1-Appl-Freq-RB|||
rep_rate_bunch_2=ch.psi.pshell.epics.ProcessVariable|SIN-TIMAST-TMA:Bunch-2-Appl-Freq-RB|||
destination_AR=ch.psi.pshell.epics.ChannelString|SF:MODE_AR false|||
energy_AR=ch.psi.pshell.epics.ProcessVariable|SF:ENERGY_AR|||
laser=ch.psi.pshell.epics.ChannelString|SLG-LGEN:WHICH_LASER false|||

119
config/preferences.json Normal file
View File

@@ -0,0 +1,119 @@
{
"fontShellPanel" : {
"name" : "Monospaced",
"style" : 0,
"size" : 13
},
"fontShellCommand" : {
"name" : "SansSerif",
"style" : 0,
"size" : 13
},
"fontOutput" : {
"name" : "Monospaced",
"style" : 0,
"size" : 13
},
"fontEditor" : {
"name" : "Monospaced",
"style" : 0,
"size" : 15
},
"fontPlotLabel" : {
"name" : "SansSerif",
"style" : 0,
"size" : 11
},
"fontPlotTick" : {
"name" : "SansSerif",
"style" : 0,
"size" : 10
},
"fontPlotTitle" : {
"name" : "SansSerif",
"style" : 1,
"size" : 13
},
"fontTerminal" : {
"name" : "Monospaced",
"style" : 0,
"size" : 14
},
"tabSize" : 4,
"contentWidth" : 0,
"editorBackground" : null,
"editorForeground" : null,
"simpleEditor" : false,
"hideEditorLineNumbers" : false,
"hideEditorContextMenu" : false,
"consoleLocation" : "Document",
"dataPanelLocation" : null,
"openDataFilesInDocTab" : false,
"noVariableEvaluationPropagation" : false,
"processingScripts" : [ ],
"asyncViewersUpdate" : false,
"asyncHistoryPlotsUpdate" : true,
"scanPlotDisabled" : false,
"scanTableDisabled" : false,
"cachedDataPanel" : false,
"dataExtensions" : "",
"dataSubFiles" : "",
"hideFileName" : false,
"showEmergencyStop" : false,
"showHomingButtons" : false,
"showJogButtons" : false,
"hideScanPanel" : false,
"hideOutputPanel" : false,
"showXScanFileBrowser" : false,
"showQueueBrowser" : false,
"backgroundRendering" : false,
"showImageStatusBar" : true,
"persistRendererWindows" : true,
"defaultRendererColormap" : "Grayscale",
"linePlot" : "ch.psi.pshell.plot.LinePlotJFree",
"matrixPlot" : "ch.psi.pshell.plot.MatrixPlotJFree",
"surfacePlot" : "ch.psi.pshell.plot.SurfacePlotJzy3d",
"timePlot" : "ch.psi.pshell.plot.TimePlotJFree",
"plotsDetached" : false,
"plotsHidden" : false,
"plotLayout" : "Vertical",
"quality" : "High",
"defaultPlotColormap" : "Temperature",
"markerSize" : 2,
"plotBackground" : null,
"gridColor" : null,
"outlineColor" : null,
"disableOffscreenBuffer" : false,
"defaultPanels" : [ {
"deviceClassName" : "ch.psi.pshell.epics.Scaler",
"panelClassName" : "ch.psi.pshell.swing.ScalerPanel"
}, {
"deviceClassName" : "ch.psi.pshell.epics.Scienta",
"panelClassName" : "ch.psi.pshell.swing.ScientaPanel"
}, {
"deviceClassName" : "ch.psi.pshell.device.Motor",
"panelClassName" : "ch.psi.pshell.swing.MotorPanel"
}, {
"deviceClassName" : "ch.psi.pshell.device.ProcessVariable",
"panelClassName" : "ch.psi.pshell.swing.ProcessVariablePanel"
}, {
"deviceClassName" : "ch.psi.pshell.device.MotorGroup",
"panelClassName" : "ch.psi.pshell.swing.MotorGroupPanel"
}, {
"deviceClassName" : "ch.psi.pshell.device.DiscretePositioner",
"panelClassName" : "ch.psi.pshell.swing.DiscretePositionerPanel"
}, {
"deviceClassName" : "ch.psi.pshell.device.Camera",
"panelClassName" : "ch.psi.pshell.swing.CameraPanel"
}, {
"deviceClassName" : "ch.psi.pshell.device.Slit",
"panelClassName" : "ch.psi.pshell.swing.SlitPanel"
}, {
"deviceClassName" : "ch.psi.pshell.device.ReadonlyRegister$ReadonlyRegisterArray",
"panelClassName" : "ch.psi.pshell.swing.DeviceValueChart"
}, {
"deviceClassName" : "ch.psi.pshell.device.ReadonlyRegister$ReadonlyRegisterMatrix",
"panelClassName" : "ch.psi.pshell.swing.DeviceValueChart"
} ],
"scriptPopupDialog" : "None"
}

View File

@@ -1,24 +1,26 @@
#Wed Mar 03 11:49:30 CET 2021
#Tue Aug 16 16:27:12 CEST 2022
scriptPath={home}/script
sessionsPath={outp}/sessions
pluginsPath={home}/plugins
configFileDevices={config}/devices.properties
consoleSessionsPath={sessions}/console
libraryPath={script}; {script}/Lib
configFilePlugins={config}/plugins.properties
contextPath={outp}/context
xscanPath={script}
queuePath={script}
extensionsPath={home}/extensions
configFileUpdateStrategy={config}/update.properties
configPath={home}/config
configFileSessions={config}/sessions.properties
userSessionsPath={sessions}/user
dataPath={outp}/data
devicesPath={home}/devices
configFileVariables={config}/variables.properties
configFileSettings={config}/settings.properties
logPath={outp}/log
wwwPath={home}/www
configFile={config}/config.properties
configFileTasks={config}/tasks.properties
pluginsPath={home}/plugins
consoleSessionsPath={sessions}/console
libraryPath={script}; {script}/Lib
configFilePlugins={config}/plugins.properties
contextPath={outp}/context
devicesPath={home}/devices
configFileSettings={config}/settings.properties
imagesPath={data}/{year}/{month}/{day}
scriptType=py
configFileTasks={config}/tasks.properties

View File

@@ -1,2 +1,2 @@
#Correlation/correlation_stream=-1.0;1.0
Correlation/correlation_stream_mult=3.0;1.0
#Correlation/correlation_stream_mult=3.0;1.0

View File

@@ -1,4 +1,4 @@
#Tue Aug 17 13:49:51 CEST 2021
LastRunDate=210817
FileSequentialNumber=5531
DaySequentialNumber=1
#Thu Aug 17 14:59:44 CEST 2023
LastRunDate=230817
FileSequentialNumber=10016
DaySequentialNumber=5

View File

@@ -1,10 +1,11 @@
#Thu Jan 10 11:28:28 CET 2019
maxValue=360.0
#Wed Aug 17 17:20:16 CEST 2022
minValue=-90.0
offset=0.0
precision=4
resolution=0.5
rotation=true
scale=1.0
sign_bit=0
unit=deg
offset=0.0
maxValue=360.0
precision=4
rotation=true
sign_bit=0
scale=1.0
description=null
resolution=0.5

View File

@@ -0,0 +1,25 @@
#Mon Nov 14 12:59:27 CET 2022
spatialCalOffsetY=NaN
spatialCalOffsetX=NaN
colormapLogarithmic=false
scale=1.0
grayscale=false
spatialCalScaleX=NaN
spatialCalScaleY=NaN
colormapMax=NaN
rescaleOffset=0.0
roiWidth=-1
colormap=Grayscale
invert=false
colormapMin=NaN
rotation=0.0
rotationCrop=false
rescaleFactor=1.0
spatialCalUnits=mm
flipVertically=false
roiHeight=-1
flipHorizontally=false
colormapAutomatic=false
roiY=0
roiX=0
transpose=false

View File

@@ -1,8 +1,4 @@
#Tue Aug 17 09:29:56 CEST 2021
\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=
#Thu Aug 17 15:16:51 CEST 2023
\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=
@@ -10,37 +6,41 @@
\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\u0000\u0000\u0000\u0000\u0000=
\u0000\u0000\u0000\u0000\u0000=
colormapLogarithmic=false
spatialCalScaleX=-35.21126887460907
spatialCalScaleY=-48.38709552593848
spatialCalScaleX=-12.508648760497415
spatialCalScaleY=-12.345679012345679
serverURL=null
rescaleOffset=0.0
roiWidth=-1
colormap=Rainbow
imageWidth=2560
colormap=Flame
imageWidth=1744
invert=false
colormapMin=100.0
colormapMin=NaN
rotationCrop=false
roiHeight=-1
colormapAutomatic=true
colormapAutomatic=false
roiY=0
roiX=0
spatialCalOffsetY=-483.5036425564949
spatialCalOffsetX=-637.4980411378614
spatialCalOffsetY=-523.4304458333334
spatialCalOffsetX=-865.4470498186071
scale=1.0
regionStart=
grayscale=false
rtY=1
colormapMax=3000.0
colormapMax=NaN
spat=
rotation=0.0
rescaleFactor=1.0
imageHeight=2160
imageHeight=1680
spatialCalUnits=null
flipVertically=false
r=
t=
flipHorizontally=false
transpose=false
regionStartX=1
regionStartY=1
regionStartX=433
regionStartY=241

View File

@@ -1,10 +1,11 @@
#Thu Sep 13 21:20:39 CEST 2018
maxValue=360.0
#Wed Aug 17 17:33:48 CEST 2022
minValue=-90.0
offset=0.0
precision=4
resolution=0.5
rotation=true
scale=1.0
sign_bit=0
unit=deg
offset=0.0
maxValue=360.0
precision=4
rotation=true
sign_bit=0
scale=1.0
description=null
resolution=0.5

View File

@@ -1,10 +1,11 @@
#Fri Sep 14 08:59:10 CEST 2018
maxValue=180.0
#Fri Aug 19 10:30:42 CEST 2022
minValue=-180.0
offset=0.0
precision=3
resolution=0.01
rotation=false
scale=1.0
sign_bit=0
unit=deg
offset=0.0
maxValue=180.0
precision=3
rotation=false
sign_bit=0
scale=1.0
description=null
resolution=0.01

View File

@@ -0,0 +1,11 @@
#Mon May 01 20:02:47 CEST 2023
minValue=-90.0
unit=deg
offset=0.0
maxValue=270.0
rotation=true
precision=4
sign_bit=0
scale=1.0
description=Dest. beam phase
resolution=0.05

View File

@@ -0,0 +1,9 @@
#Mon Aug 30 10:37:54 CEST 2021
offset=0.0
maxValue=210.0
precision=1
scale=1.0
resolution=NaN
minValue=0.0
unit=A
sign_bit=0

10
devices/TestP.properties Normal file
View File

@@ -0,0 +1,10 @@
#Mon Aug 30 10:39:55 CEST 2021
offset=0.0
maxValue=210.0
rotation=false
precision=1
scale=1.0
resolution=NaN
minValue=0.0
unit=A
sign_bit=0

View File

@@ -1,10 +1,11 @@
#Wed Jul 25 10:35:40 CEST 2018
maxValue=NaN
#Mon Sep 05 18:17:36 CEST 2022
minValue=NaN
offset=0.0
precision=-1
resolution=NaN
rotation=false
scale=1.0
sign_bit=0
unit=null
offset=0.0
maxValue=NaN
precision=-1
rotation=false
sign_bit=0
scale=1.0
description=null
resolution=NaN

View File

@@ -1,6 +1,6 @@
#Tue Aug 17 13:49:50 CEST 2021
#Sun Jul 03 07:32:46 CEST 2022
offset=0.0
maxValue=51500.0
maxValue=140000.0
precision=1
rotation=false
scale=1.0
@@ -9,7 +9,7 @@ maxSpeed=2000.0
resolution=0.1
homingType=None
startRetries=1
minValue=-56300.0
minValue=-56400.0
unit=um
defaultSpeed=2000.0
hasEnable=false

View File

@@ -1,6 +1,6 @@
#Fri Aug 06 14:12:08 CEST 2021
spatialCalOffsetY=-50.048780487804876
spatialCalOffsetX=-50.03903200624512
#Thu Aug 17 14:27:37 CEST 2023
spatialCalOffsetY=-50.048828125
spatialCalOffsetX=-50.03909304143862
colormapLogarithmic=false
scale=1.0
grayscale=false

View File

@@ -1,9 +1,10 @@
#Fri Jun 29 17:40:53 CEST 2018
maxValue=NaN
#Tue Aug 16 16:27:15 CEST 2022
minValue=NaN
offset=0.0
precision=1
resolution=NaN
scale=1.0
sign_bit=0
unit=pC
offset=0.0
maxValue=NaN
precision=1
sign_bit=0
scale=1.0
description=null
resolution=NaN

View File

@@ -1,15 +1,16 @@
#Tue Nov 19 12:01:37 CET 2019
sendStrategy=complete_all
#Fri Jun 16 10:34:26 CEST 2023
dropIncomplete=false
disableCompression=false
keepListeningOnStop=false
disableCompression=false
parallelHandlerProcessing=true
sendBuildChannelConfig=at_startup
sendAwaitFirstMessage=false
socketType=DEFAULT
validationInconsistency=keep_as_is
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

@@ -1,11 +1,12 @@
#Wed Dec 09 13:57:47 CET 2015
motor1=0.0|4.0|8.0|0.0
motor2=0.0|5.0|3.0|NaN
motor3=null
motor4=null
motor5=null
motor6=null
#Thu Jun 01 11:08:52 CEST 2023
motor7=null
motor8=null
positions=Park|Ready|Out|Clear
motor5=null
motor6=null
precision=-1
description=null
positions=Park|Ready|Out|Clear
motor3=null
motor4=null
motor1=0.0|4.0|8.0|0.0
motor2=0.0|5.0|3.0|NaN

View File

@@ -1,9 +1,10 @@
#Fri Aug 17 10:25:25 CEST 2018
maxValue=NaN
#Tue Aug 16 16:27:15 CEST 2022
minValue=NaN
offset=0.0
precision=3
resolution=NaN
scale=1.0
sign_bit=0
unit=MeV
offset=0.0
maxValue=NaN
precision=3
sign_bit=0
scale=1.0
description=null
resolution=NaN

View File

@@ -1,10 +1,11 @@
#Fri Jun 29 17:40:53 CEST 2018
maxValue=1.0
#Tue Aug 16 16:27:15 CEST 2022
minValue=-1.0
offset=0.0
precision=3
resolution=NaN
rotation=false
scale=1.0
sign_bit=0
unit=mrad
offset=0.0
maxValue=1.0
precision=3
rotation=false
sign_bit=0
scale=1.0
description=null
resolution=NaN

View File

@@ -1,10 +1,11 @@
#Fri Jun 29 17:40:53 CEST 2018
maxValue=1.0
#Tue Aug 16 16:27:15 CEST 2022
minValue=-1.0
offset=0.0
precision=3
resolution=NaN
rotation=false
scale=1.0
sign_bit=0
unit=mrad
offset=0.0
maxValue=1.0
precision=3
rotation=false
sign_bit=0
scale=1.0
description=null
resolution=NaN

View File

@@ -1,10 +1,11 @@
#Fri Jun 29 17:40:53 CEST 2018
maxValue=1.0
#Tue Aug 16 16:27:15 CEST 2022
minValue=-1.0
offset=0.0
precision=3
resolution=NaN
rotation=false
scale=1.0
sign_bit=0
unit=mm
offset=0.0
maxValue=1.0
precision=3
rotation=false
sign_bit=0
scale=1.0
description=null
resolution=NaN

View File

@@ -1,10 +1,11 @@
#Fri Jun 29 17:40:53 CEST 2018
maxValue=1.0
#Tue Aug 16 16:27:15 CEST 2022
minValue=-1.0
offset=0.0
precision=3
resolution=NaN
rotation=false
scale=1.0
sign_bit=0
unit=mm
offset=0.0
maxValue=1.0
precision=3
rotation=false
sign_bit=0
scale=1.0
description=null
resolution=NaN

View File

@@ -1,10 +1,11 @@
#Fri Jun 29 17:40:53 CEST 2018
maxValue=180.0
#Tue Aug 16 16:27:15 CEST 2022
minValue=-179.99
offset=0.0
precision=2
resolution=1.0
rotation=false
scale=1.0
sign_bit=0
unit=DEG
offset=0.0
maxValue=180.0
precision=2
rotation=false
sign_bit=0
scale=1.0
description=null
resolution=1.0

View File

@@ -1,10 +1,11 @@
#Fri Jun 29 17:40:53 CEST 2018
maxValue=210.0
#Tue Aug 16 16:27:15 CEST 2022
minValue=0.0
offset=0.0
precision=3
resolution=0.02
rotation=false
scale=1.0
sign_bit=0
unit=A
offset=0.0
maxValue=210.0
precision=3
rotation=false
sign_bit=0
scale=1.0
description=null
resolution=0.02

View File

@@ -1,9 +1,10 @@
#Mon Sep 23 17:29:11 CEST 2019
#Thu Jun 01 11:08:52 CEST 2023
offset=0.0
maxValue=10.0
precision=2
rotation=false
scale=1.0
description=null
estbilizationDelay=0
maxSpeed=10.0
resolution=NaN

View File

@@ -1,9 +1,10 @@
#Mon Sep 23 17:29:11 CEST 2019
#Thu Jun 01 11:08:52 CEST 2023
offset=0.0
maxValue=10.0
precision=2
rotation=false
scale=1.0
description=null
estbilizationDelay=0
maxSpeed=10.0
resolution=NaN

View File

@@ -1,4 +1,4 @@
#Mon Sep 23 17:29:11 CEST 2019
#Thu Jun 01 11:08:52 CEST 2023
minValue=0.0
unit=mm
offset=0.0
@@ -7,4 +7,5 @@ precision=-1
rotation=false
sign_bit=0
scale=1.0
description=null
resolution=NaN

View File

@@ -1,8 +1,10 @@
#Fri Jan 08 10:13:11 CET 2016
maxValue=90.0
#Mon Nov 08 17:03:06 CET 2021
minValue=0.0
offset=0.0
precision=3
resolution=NaN
scale=1.0
unit=Degree
offset=0.0
maxValue=90.0
precision=3
rotation=false
sign_bit=0
scale=1.0
resolution=NaN

View File

@@ -0,0 +1,10 @@
#Tue Aug 16 16:29:34 CEST 2022
minValue=0.0
unit=Hz
offset=0.0
maxValue=0.0
precision=2
sign_bit=0
scale=1.0
description=null
resolution=NaN

View File

@@ -0,0 +1,10 @@
#Tue Aug 16 16:29:34 CEST 2022
minValue=0.0
unit=Hz
offset=0.0
maxValue=0.0
precision=2
sign_bit=0
scale=1.0
description=null
resolution=NaN

View File

@@ -23,50 +23,74 @@
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" max="-2" attributes="0">
<Group type="102" alignment="1" attributes="0">
<Component id="buttonStart" min="-2" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
<Component id="buttonAbort" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="15" max="-2" attributes="0"/>
</Group>
<Group type="103" groupAlignment="1" attributes="0">
<Component id="panelOutput" max="32767" attributes="0"/>
<Group type="102" attributes="0">
<Group type="103" groupAlignment="0" max="-2" attributes="0">
<Component id="panelScanPars" max="32767" attributes="0"/>
<Component id="panelBeamPars" alignment="0" max="32767" attributes="0"/>
<Component id="jPanel1" max="32767" attributes="0"/>
<Component id="jPanel2" max="32767" 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="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"/>
</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"/>
</Group>
</Group>
</Group>
<Component id="plot" pref="528" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" max="-2" attributes="0">
<Component id="plot12" pref="438" max="32767" attributes="0"/>
<Component id="plot22" max="32767" attributes="0"/>
</Group>
<EmptySpace min="-2" pref="28" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="plot" max="32767" attributes="0"/>
<Group type="102" 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="panelBeamPars" min="-2" max="-2" attributes="0"/>
<Component id="buttonPrepare" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jPanel1" min="-2" 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"/>
<Component id="jPanel2" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="30" max="32767" 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="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"/>
<Group type="103" groupAlignment="0" max="-2" attributes="0">
<Component id="plot22" max="32767" attributes="0"/>
<Component id="plot21" max="32767" attributes="0"/>
</Group>
</Group>
</Group>
<EmptySpace min="-2" pref="14" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="panelOutput" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="19" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
@@ -88,33 +112,33 @@
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" 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>
</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="1" attributes="0">
<Group type="102" alignment="1" attributes="0">
<Component id="labelLatency" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="2" max="-2" attributes="0"/>
<Component id="spinnerLatency" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="1" attributes="0">
<Component id="labelStop" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="2" max="-2" attributes="0"/>
<Component id="spinnerStop" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="1" attributes="0">
<Component id="labelStart" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="2" max="-2" attributes="0"/>
<Component id="spinnerStart" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="1" attributes="0">
<Component id="labelSamples" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="2" max="-2" attributes="0"/>
<Component id="spinnerSamples" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="1" attributes="0">
<Component id="labelStep" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="2" max="-2" attributes="0"/>
<Component id="spinnerStep" min="-2" max="-2" attributes="0"/>
</Group>
<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"/>
</Group>
@@ -148,7 +172,21 @@
<Component id="spinnerLatency" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="labelLatency" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="labelThreshold" alignment="3" min="-2" max="-2" attributes="0"/>
<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>
@@ -167,10 +205,7 @@
<Component class="javax.swing.JSpinner" name="spinnerStep">
<Properties>
<Property name="model" type="javax.swing.SpinnerModel" editor="org.netbeans.modules.form.editors2.SpinnerModelEditor">
<SpinnerModel initial="1.0" maximum="10.0" minimum="0.05" numberType="java.lang.Double" stepSize="0.05" type="number"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[64, 20]"/>
<SpinnerModel initial="0.05" maximum="10.0" minimum="0.0" numberType="java.lang.Double" stepSize="0.01" type="number"/>
</Property>
</Properties>
</Component>
@@ -182,25 +217,19 @@
<Component class="javax.swing.JSpinner" name="spinnerStart">
<Properties>
<Property name="model" type="javax.swing.SpinnerModel" editor="org.netbeans.modules.form.editors2.SpinnerModelEditor">
<SpinnerModel initial="0.0" maximum="360.0" minimum="-360.0" numberType="java.lang.Double" stepSize="1.0" type="number"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[64, 20]"/>
<SpinnerModel initial="-0.1" maximum="360.0" minimum="-360.0" numberType="java.lang.Double" stepSize="1.0" type="number"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="labelSamples">
<Properties>
<Property name="text" type="java.lang.String" value="Nb Samples:"/>
<Property name="text" type="java.lang.String" value="Nb samples:"/>
</Properties>
</Component>
<Component class="javax.swing.JSpinner" name="spinnerSamples">
<Properties>
<Property name="model" type="javax.swing.SpinnerModel" editor="org.netbeans.modules.form.editors2.SpinnerModelEditor">
<SpinnerModel initial="1" maximum="50" minimum="1" numberType="java.lang.Integer" stepSize="1" type="number"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[64, 20]"/>
<SpinnerModel initial="10" maximum="100" minimum="1" numberType="java.lang.Integer" stepSize="1" type="number"/>
</Property>
</Properties>
</Component>
@@ -212,107 +241,63 @@
<Component class="javax.swing.JSpinner" name="spinnerLatency">
<Properties>
<Property name="model" type="javax.swing.SpinnerModel" editor="org.netbeans.modules.form.editors2.SpinnerModelEditor">
<SpinnerModel initial="0.1" maximum="5.0" minimum="0.0" numberType="java.lang.Double" stepSize="0.01" type="number"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[64, 20]"/>
<SpinnerModel initial="0.4" maximum="5.0" minimum="0.0" numberType="java.lang.Double" stepSize="0.01" type="number"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JSpinner" name="spinnerStop">
<Properties>
<Property name="model" type="javax.swing.SpinnerModel" editor="org.netbeans.modules.form.editors2.SpinnerModelEditor">
<SpinnerModel initial="180.0" maximum="360.0" minimum="-360.0" numberType="java.lang.Double" stepSize="1.0" type="number"/>
<SpinnerModel initial="0.1" maximum="360.0" minimum="-360.0" numberType="java.lang.Double" stepSize="1.0" type="number"/>
</Property>
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[53, 20]"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="labelThreshold">
<Properties>
<Property name="text" type="java.lang.String" value="Threshold:"/>
</Properties>
</Component>
<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"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[64, 20]"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="labelStation">
<Properties>
<Property name="text" type="java.lang.String" value="TDS Station:"/>
</Properties>
</Component>
<Component class="javax.swing.JSpinner" name="spinnerStation">
<Properties>
<Property name="model" type="javax.swing.SpinnerModel" editor="org.netbeans.modules.form.editors2.SpinnerModelEditor">
<SpinnerModel type="list">
<ListItem value="S30CB14"/>
<ListItem value="SATMA02"/>
<ListItem value="SINDI01"/>
</SpinnerModel>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JSpinner" name="spinnerBunch">
<Properties>
<Property name="model" type="javax.swing.SpinnerModel" editor="org.netbeans.modules.form.editors2.SpinnerModelEditor">
<SpinnerModel type="list">
<ListItem value="Bunch1"/>
<ListItem value="Bunch2"/>
</SpinnerModel>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="labelBunch">
<Properties>
<Property name="text" type="java.lang.String" value="Bunch:"/>
</Properties>
</Component>
</SubComponents>
</Container>
<Container class="javax.swing.JPanel" name="panelBeamPars">
<Properties>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo">
<TitledBorder title="Beam Parameters"/>
</Border>
</Property>
</Properties>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="1" attributes="0">
<EmptySpace max="32767" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="labelDispersion" alignment="1" min="-2" max="-2" attributes="0"/>
<Component id="labelEnergy" alignment="0" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="-2" pref="4" max="-2" attributes="0"/>
<Group type="103" groupAlignment="1" max="-2" attributes="0">
<Component id="spinnerEnergy" pref="73" max="32767" attributes="0"/>
<Component id="spinnerDispersion" max="32767" attributes="0"/>
</Group>
<EmptySpace 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="spinnerDispersion" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="labelDispersion" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="spinnerEnergy" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="labelEnergy" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JSpinner" name="spinnerDispersion">
<Properties>
<Property name="model" type="javax.swing.SpinnerModel" editor="org.netbeans.modules.form.editors2.SpinnerModelEditor">
<SpinnerModel initial="-0.387" maximum="10.0" minimum="-10.0" numberType="java.lang.Double" stepSize="0.001" type="number"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[64, 20]"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="labelEnergy">
<Properties>
<Property name="text" type="java.lang.String" value="p (MeV/c):"/>
</Properties>
</Component>
<Component class="javax.swing.JSpinner" name="spinnerEnergy">
<Properties>
<Property name="model" type="javax.swing.SpinnerModel" editor="org.netbeans.modules.form.editors2.SpinnerModelEditor">
<SpinnerModel initial="7.1" maximum="10.0" minimum="0.0" numberType="java.lang.Double" stepSize="0.01" type="number"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[64, 20]"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="labelDispersion">
<Properties>
<Property name="text" type="java.lang.String" value="Disp. (m):"/>
</Properties>
</Component>
</SubComponents>
</Container>
<Component class="ch.psi.pshell.plot.LinePlotJFree" name="plot">
<Component class="ch.psi.pshell.plot.LinePlotJFree" name="plot11">
<Properties>
<Property name="title" type="java.lang.String" value=""/>
</Properties>
@@ -333,75 +318,34 @@
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonAbortActionPerformed"/>
</Events>
</Component>
<Container class="javax.swing.JPanel" name="jPanel1">
<Component class="javax.swing.JButton" name="buttonPrepare">
<Properties>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo">
<TitledBorder title="Set RF Phase"/>
</Border>
<Property name="text" type="java.lang.String" value="Prepare"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonPrepareActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="buttonSetPhase">
<Properties>
<Property name="text" type="java.lang.String" value="Set Beam Phase"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonSetPhaseActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JSpinner" name="spinnerPhase">
<Properties>
<Property name="model" type="javax.swing.SpinnerModel" editor="org.netbeans.modules.form.editors2.SpinnerModelEditor">
<SpinnerModel initial="0.0" maximum="360.0" minimum="-360.0" numberType="java.lang.Double" stepSize="1.0" type="number"/>
</Property>
</Properties>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace max="32767" attributes="0"/>
<Component id="buttonPhaseSet" min="-2" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
</Group>
<Group type="102" alignment="1" attributes="0">
<EmptySpace max="32767" attributes="0"/>
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="textRefPhase" min="-2" pref="69" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel1" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="textRefPhase" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="buttonPhaseSet" min="-2" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JLabel" name="jLabel1">
<Properties>
<Property name="text" type="java.lang.String" value="Ref phase:"/>
</Properties>
</Component>
<Component class="javax.swing.JButton" name="buttonPhaseSet">
<Properties>
<Property name="text" type="java.lang.String" value="Set"/>
<Property name="enabled" type="boolean" value="false"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonPhaseSetActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JTextField" name="textRefPhase">
<Properties>
<Property name="editable" type="boolean" value="false"/>
<Property name="horizontalAlignment" type="int" value="0"/>
</Properties>
</Component>
</SubComponents>
</Container>
<Container class="javax.swing.JPanel" name="jPanel2">
</Component>
<Container class="javax.swing.JPanel" name="panelOutput">
<Properties>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo">
<TitledBorder title="Set Laser Delay "/>
<TitledBorder title="Output"/>
</Border>
</Property>
</Properties>
@@ -410,15 +354,8 @@
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="32767" attributes="0"/>
<Component id="buttonSetDelay" min="-2" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
</Group>
<Group type="102" alignment="1" attributes="0">
<EmptySpace max="32767" attributes="0"/>
<Component id="jLabel2" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="textOffset" min="-2" pref="69" max="-2" attributes="0"/>
<Component id="jTextAreaOutput" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
@@ -426,40 +363,38 @@
<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"/>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel2" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="textOffset" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="buttonSetDelay" min="-2" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JLabel" name="jLabel2">
<Component class="javax.swing.JTextArea" name="jTextAreaOutput">
<Properties>
<Property name="text" type="java.lang.String" value="Offset:"/>
</Properties>
</Component>
<Component class="javax.swing.JButton" name="buttonSetDelay">
<Properties>
<Property name="text" type="java.lang.String" value="Set"/>
<Property name="enabled" type="boolean" value="false"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonSetDelayActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JTextField" name="textOffset">
<Properties>
<Property name="editable" type="boolean" value="false"/>
<Property name="horizontalAlignment" type="int" value="0"/>
<Property name="columns" type="int" value="20"/>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Courier 10 Pitch" size="14" style="0"/>
</Property>
<Property name="rows" type="int" value="5"/>
</Properties>
</Component>
</SubComponents>
</Container>
<Component class="ch.psi.pshell.plot.LinePlotJFree" name="plot21">
<Properties>
<Property name="title" type="java.lang.String" value=""/>
</Properties>
</Component>
<Component class="ch.psi.pshell.plot.LinePlotJFree" name="plot12">
<Properties>
<Property name="title" type="java.lang.String" value=""/>
</Properties>
</Component>
<Component class="ch.psi.pshell.plot.LinePlotJFree" name="plot22">
<Properties>
<Property name="title" type="java.lang.String" value=""/>
</Properties>
</Component>
</SubComponents>
</Form>

444
plugins/BunchLength.java Executable file
View File

@@ -0,0 +1,444 @@
/*
* Copyright (c) 2014-2017 Paul Scherrer Institute. All rights reserved.
*/
import ch.psi.pshell.plot.LinePlot;
import ch.psi.pshell.plot.LinePlotSeries;
import ch.psi.pshell.ui.Panel;
import ch.psi.utils.State;
import ch.psi.utils.swing.SwingUtils;
import java.awt.Color;
import java.util.ArrayList;
import java.util.List;
import javax.swing.JSpinner;
/**
*
*/
public class BunchLength extends Panel {
public BunchLength() {
initComponents();
setPersistedComponents(SwingUtils.getComponentsByType(panelScanPars, JSpinner.class));
plot11.setStyle(LinePlot.Style.ErrorY);
plot12.setStyle(LinePlot.Style.Normal);
plot21.setStyle(LinePlot.Style.ErrorY);
plot22.setStyle(LinePlot.Style.Normal);
}
//Overridable callbacks
@Override
public void onInitialize(int runCount) {
}
@Override
public void onStateChange(State state, State former) {
buttonAbort.setEnabled(state.isProcessing());
boolean enabled = (state == State.Ready);
buttonPrepare.setEnabled(enabled);
buttonSetPhase.setEnabled(enabled);
buttonStart.setEnabled(enabled);
spinnerStart.setEnabled(enabled);
spinnerStop.setEnabled(enabled);
spinnerStep.setEnabled(enabled);
spinnerSamples.setEnabled(enabled);
spinnerLatency.setEnabled(enabled);
spinnerThreshold.setEnabled(enabled);
spinnerStation.setEnabled(enabled);
spinnerBunch.setEnabled(enabled);
}
@Override
public void onExecutedFile(String fileName, Object result) {
}
//Callback to perform update - in event thread
@Override
protected void doUpdate() {
}
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
panelScanPars = new javax.swing.JPanel();
labelStart = new javax.swing.JLabel();
labelStop = new javax.swing.JLabel();
spinnerStep = new javax.swing.JSpinner();
labelStep = new javax.swing.JLabel();
spinnerStart = new javax.swing.JSpinner();
labelSamples = new javax.swing.JLabel();
spinnerSamples = new javax.swing.JSpinner();
labelLatency = new javax.swing.JLabel();
spinnerLatency = new javax.swing.JSpinner();
spinnerStop = new javax.swing.JSpinner();
labelThreshold = new javax.swing.JLabel();
spinnerThreshold = new javax.swing.JSpinner();
labelStation = new javax.swing.JLabel();
spinnerStation = new javax.swing.JSpinner();
spinnerBunch = new javax.swing.JSpinner();
labelBunch = new javax.swing.JLabel();
plot11 = new ch.psi.pshell.plot.LinePlotJFree();
buttonStart = new javax.swing.JButton();
buttonAbort = new javax.swing.JButton();
buttonPrepare = new javax.swing.JButton();
buttonSetPhase = new javax.swing.JButton();
spinnerPhase = new javax.swing.JSpinner();
panelOutput = new javax.swing.JPanel();
jTextAreaOutput = new javax.swing.JTextArea();
plot21 = new ch.psi.pshell.plot.LinePlotJFree();
plot12 = new ch.psi.pshell.plot.LinePlotJFree();
plot22 = new ch.psi.pshell.plot.LinePlotJFree();
setPreferredSize(new java.awt.Dimension(737, 445));
panelScanPars.setBorder(javax.swing.BorderFactory.createTitledBorder("Scan Parameters"));
labelStart.setText("Start:");
labelStop.setText("Stop:");
spinnerStep.setModel(new javax.swing.SpinnerNumberModel(0.05d, 0.0d, 10.0d, 0.01d));
labelStep.setText("Step size:");
spinnerStart.setModel(new javax.swing.SpinnerNumberModel(-0.1d, -360.0d, 360.0d, 1.0d));
labelSamples.setText("Nb samples:");
spinnerSamples.setModel(new javax.swing.SpinnerNumberModel(10, 1, 100, 1));
labelLatency.setText("Latency:");
spinnerLatency.setModel(new javax.swing.SpinnerNumberModel(0.4d, 0.0d, 5.0d, 0.01d));
spinnerStop.setModel(new javax.swing.SpinnerNumberModel(0.1d, -360.0d, 360.0d, 1.0d));
labelThreshold.setText("Threshold:");
spinnerThreshold.setModel(new javax.swing.SpinnerNumberModel(7000, 0, 50000, 1));
labelStation.setText("TDS Station:");
spinnerStation.setModel(new javax.swing.SpinnerListModel(new String[] {"S30CB14", "SATMA02", "SINDI01"}));
spinnerBunch.setModel(new javax.swing.SpinnerListModel(new String[] {"Bunch1", "Bunch2"}));
labelBunch.setText("Bunch:");
javax.swing.GroupLayout panelScanParsLayout = new javax.swing.GroupLayout(panelScanPars);
panelScanPars.setLayout(panelScanParsLayout);
panelScanParsLayout.setHorizontalGroup(
panelScanParsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(panelScanParsLayout.createSequentialGroup()
.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))
);
panelScanParsLayout.setVerticalGroup(
panelScanParsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(panelScanParsLayout.createSequentialGroup()
.addContainerGap()
.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))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(panelScanParsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(spinnerStop, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(labelStop))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(panelScanParsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(spinnerStep, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(labelStep))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(panelScanParsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(spinnerSamples, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(labelSamples))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(panelScanParsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(spinnerLatency, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(labelLatency))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.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)))
);
plot11.setTitle("");
buttonStart.setText("Start");
buttonStart.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonStartActionPerformed(evt);
}
});
buttonAbort.setText("Abort");
buttonAbort.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonAbortActionPerformed(evt);
}
});
buttonPrepare.setText("Prepare");
buttonPrepare.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonPrepareActionPerformed(evt);
}
});
buttonSetPhase.setText("Set Beam Phase");
buttonSetPhase.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonSetPhaseActionPerformed(evt);
}
});
spinnerPhase.setModel(new javax.swing.SpinnerNumberModel(0.0d, -360.0d, 360.0d, 1.0d));
panelOutput.setBorder(javax.swing.BorderFactory.createTitledBorder("Output"));
jTextAreaOutput.setColumns(20);
jTextAreaOutput.setFont(new java.awt.Font("Courier 10 Pitch", 0, 14)); // NOI18N
jTextAreaOutput.setRows(5);
javax.swing.GroupLayout panelOutputLayout = new javax.swing.GroupLayout(panelOutput);
panelOutput.setLayout(panelOutputLayout);
panelOutputLayout.setHorizontalGroup(
panelOutputLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(panelOutputLayout.createSequentialGroup()
.addContainerGap()
.addComponent(jTextAreaOutput)
.addContainerGap())
);
panelOutputLayout.setVerticalGroup(
panelOutputLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(panelOutputLayout.createSequentialGroup()
.addComponent(jTextAreaOutput, javax.swing.GroupLayout.DEFAULT_SIZE, 142, Short.MAX_VALUE)
.addContainerGap())
);
plot21.setTitle("");
plot12.setTitle("");
plot22.setTitle("");
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.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(buttonPrepare)
.addGroup(layout.createSequentialGroup()
.addComponent(buttonStart)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(buttonAbort))
.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)
.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)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(plot12, javax.swing.GroupLayout.DEFAULT_SIZE, 438, Short.MAX_VALUE)
.addComponent(plot22, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGap(28, 28, 28))
);
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)
.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))
);
panelScanPars.getAccessibleContext().setAccessibleDescription("");
}// </editor-fold>//GEN-END:initComponents
private void buttonStartActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonStartActionPerformed
ArrayList parameters = new ArrayList();
parameters.add(spinnerStart.getValue());
parameters.add(spinnerStop.getValue());
parameters.add(spinnerStep.getValue());
parameters.add(spinnerSamples.getValue());
parameters.add(spinnerLatency.getValue());
parameters.add(spinnerThreshold.getValue());
parameters.add(spinnerStation.getValue());
parameters.add(spinnerBunch.getValue());
parameters.add(plot11);
parameters.add(plot12);
parameters.add(plot21);
parameters.add(plot22);
try {
runAsync("Tools/BunchLengthScan", parameters).handle((ret, ex) -> {
if (ex != null) {
String message = "Exception executing scan: " + ex;
getLogger().info(message);
showException((Exception) ex);
} else {
List ret_list = (List)ret;
try{
double bunch_length_rms_1 = ((Number)ret_list.get(0)).doubleValue();
double bunch_length_fw_1 = ((Number)ret_list.get(1)).doubleValue();
double bunch_length_fit_1 = ((Number)ret_list.get(2)).doubleValue();
double calibration_1 = ((Number)ret_list.get(3)).doubleValue();
double bunch_length_rms_2 = ((Number)ret_list.get(4)).doubleValue();
double bunch_length_fw_2 = ((Number)ret_list.get(5)).doubleValue();
double bunch_length_fit_2 = ((Number)ret_list.get(6)).doubleValue();
double calibration_2 = ((Number)ret_list.get(7)).doubleValue();
double bunch_length_rms = ((Number)ret_list.get(8)).doubleValue();
double bunch_length_fw = ((Number)ret_list.get(9)).doubleValue();
double bunch_length_fit = ((Number)ret_list.get(10)).doubleValue();
double calibration = ((Number)ret_list.get(11)).doubleValue();
jTextAreaOutput.setText(null);
jTextAreaOutput.append(String.format(" 0 deg 180 deg mean\n"));
jTextAreaOutput.append(String.format("Bunch length rms (fs): %12.1f%12.1f%12.1f\n",bunch_length_rms_1,bunch_length_rms_2,bunch_length_rms));
jTextAreaOutput.append(String.format("Bunch length fw (fs): %12.1f%12.1f%12.1f\n",bunch_length_fw_1,bunch_length_fw_2,bunch_length_fw));
jTextAreaOutput.append(String.format("Bunch length gauss fit rms (fs): %12.1f%12.1f%12.1f\n",bunch_length_fit_1,bunch_length_fit_2,bunch_length_fit));
jTextAreaOutput.append(String.format("Calibration (fs/um): %12.3f%12.3f%12.3f\n",calibration_1,calibration_2,calibration));
} catch (Exception e) {
showException(e);
}
}
return ret;
});
} catch (Exception ex) {
showException(ex);
}
}//GEN-LAST:event_buttonStartActionPerformed
private void buttonAbortActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonAbortActionPerformed
try {
abort();
} catch (Exception ex) {
showException(ex);
}
}//GEN-LAST:event_buttonAbortActionPerformed
private void buttonPrepareActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonPrepareActionPerformed
ArrayList parameters = new ArrayList();
parameters.add(spinnerStation.getValue());
try {
runAsync("Tools/BunchLengthPrep", 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_buttonPrepareActionPerformed
private void buttonSetPhaseActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonSetPhaseActionPerformed
ArrayList parameters = new ArrayList();
parameters.add(spinnerStation.getValue());
parameters.add(spinnerPhase.getValue());
try {
runAsync("Tools/SetTdsBeamPhase", 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_buttonSetPhaseActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton buttonAbort;
private javax.swing.JButton buttonPrepare;
private javax.swing.JButton buttonSetPhase;
private javax.swing.JButton buttonStart;
private javax.swing.JTextArea jTextAreaOutput;
private javax.swing.JLabel labelBunch;
private javax.swing.JLabel labelLatency;
private javax.swing.JLabel labelSamples;
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.JPanel panelOutput;
private javax.swing.JPanel panelScanPars;
private ch.psi.pshell.plot.LinePlotJFree plot11;
private ch.psi.pshell.plot.LinePlotJFree plot12;
private ch.psi.pshell.plot.LinePlotJFree plot21;
private ch.psi.pshell.plot.LinePlotJFree plot22;
private javax.swing.JSpinner spinnerBunch;
private javax.swing.JSpinner spinnerLatency;
private javax.swing.JSpinner spinnerPhase;
private javax.swing.JSpinner spinnerSamples;
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;
// End of variables declaration//GEN-END:variables
}

View File

@@ -495,7 +495,7 @@ public class Correlation2 extends Panel {
private void comboTypeXActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_comboTypeXActionPerformed
if (comboTypeX.getSelectedIndex()==0){
textDevX.configure(ChannelSelector.Type.Epics, "http://epics-boot-info.psi.ch", "swissfel", 5000);
textDevX.configure(ChannelSelector.Type.IocInfo, "http://iocinfo.psi.ch/api/v2", "swissfel", 5000);
} else if (comboTypeX.getSelectedIndex()==1){
textDevX.configure(ChannelSelector.Type.DataAPI, "https://data-api.psi.ch/sf", "sf-databuffer", 5000);
} else if (comboTypeX.getSelectedIndex()==2){
@@ -505,7 +505,7 @@ public class Correlation2 extends Panel {
private void comboTypeYActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_comboTypeYActionPerformed
if (comboTypeY.getSelectedIndex()==0){
textDevY.configure(ChannelSelector.Type.Epics, "http://epics-boot-info.psi.ch", "swissfel", 5000);
textDevY.configure(ChannelSelector.Type.IocInfo, "http://iocinfo.psi.ch/api/v2", "swissfel", 5000);
} else if (comboTypeY.getSelectedIndex()==1){
textDevY.configure(ChannelSelector.Type.DataAPI, "https://data-api.psi.ch/sf", "sf-databuffer", 5000);
} else if (comboTypeY.getSelectedIndex()==2){

View File

@@ -40,7 +40,7 @@
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
<Component id="plot" pref="528" max="32767" attributes="0"/>
<Component id="plot" pref="523" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
@@ -88,38 +88,23 @@
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="1" attributes="0">
<Group type="102" alignment="1" attributes="0">
<Component id="labelLatency" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="2" max="-2" attributes="0"/>
<Component id="spinnerLatency" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="1" attributes="0">
<Component id="labelStop" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="2" max="-2" attributes="0"/>
<Component id="spinnerStop" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="1" attributes="0">
<Component id="labelStart" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="2" max="-2" attributes="0"/>
<Component id="spinnerStart" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="1" attributes="0">
<Component id="labelSamples" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="2" max="-2" attributes="0"/>
<Component id="spinnerSamples" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="1" attributes="0">
<Component id="labelStep" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="2" max="-2" attributes="0"/>
<Component id="spinnerStep" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" attributes="0">
<Component id="labelLatency1" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="2" max="-2" attributes="0"/>
<Component id="spinnerThreshold" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="32767" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="labelStart" alignment="1" min="-2" max="-2" attributes="0"/>
<Component id="labelStop" alignment="1" min="-2" max="-2" attributes="0"/>
<Component id="labelStep" alignment="1" min="-2" max="-2" attributes="0"/>
<Component id="labelSamples" alignment="1" min="-2" max="-2" attributes="0"/>
<Component id="labelLatency" alignment="1" min="-2" max="-2" attributes="0"/>
<Component id="labelLatency1" alignment="1" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="2" pref="2" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="spinnerStart" linkSize="4" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="spinnerStop" linkSize="4" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="spinnerStep" linkSize="4" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="spinnerSamples" linkSize="4" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="spinnerLatency" linkSize="4" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="spinnerThreshold" linkSize="4" alignment="0" min="-2" pref="40" max="-2" attributes="0"/>
</Group>
<EmptySpace max="32767" attributes="0"/>
</Group>
@@ -177,10 +162,7 @@
<Component class="javax.swing.JSpinner" name="spinnerStep">
<Properties>
<Property name="model" type="javax.swing.SpinnerModel" editor="org.netbeans.modules.form.editors2.SpinnerModelEditor">
<SpinnerModel initial="1.0" maximum="10.0" minimum="0.05" numberType="java.lang.Double" stepSize="0.05" type="number"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[64, 20]"/>
<SpinnerModel initial="0.5" maximum="10.0" minimum="0.05" numberType="java.lang.Double" stepSize="0.05" type="number"/>
</Property>
</Properties>
</Component>
@@ -192,10 +174,7 @@
<Component class="javax.swing.JSpinner" name="spinnerStart">
<Properties>
<Property name="model" type="javax.swing.SpinnerModel" editor="org.netbeans.modules.form.editors2.SpinnerModelEditor">
<SpinnerModel initial="0.0" maximum="360.0" minimum="-360.0" numberType="java.lang.Double" stepSize="1.0" type="number"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[64, 20]"/>
<SpinnerModel initial="86.0" maximum="360.0" minimum="-360.0" numberType="java.lang.Double" stepSize="1.0" type="number"/>
</Property>
</Properties>
</Component>
@@ -207,10 +186,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="1" maximum="50" minimum="1" numberType="java.lang.Integer" stepSize="1" type="number"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[64, 20]"/>
<SpinnerModel initial="10" maximum="50" minimum="1" numberType="java.lang.Integer" stepSize="1" type="number"/>
</Property>
</Properties>
</Component>
@@ -222,33 +198,24 @@
<Component class="javax.swing.JSpinner" name="spinnerLatency">
<Properties>
<Property name="model" type="javax.swing.SpinnerModel" editor="org.netbeans.modules.form.editors2.SpinnerModelEditor">
<SpinnerModel initial="0.1" maximum="5.0" minimum="0.0" numberType="java.lang.Double" stepSize="0.01" type="number"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[64, 20]"/>
<SpinnerModel initial="0.4" maximum="5.0" minimum="0.0" numberType="java.lang.Double" stepSize="0.01" type="number"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JSpinner" name="spinnerStop">
<Properties>
<Property name="model" type="javax.swing.SpinnerModel" editor="org.netbeans.modules.form.editors2.SpinnerModelEditor">
<SpinnerModel initial="180.0" maximum="360.0" minimum="-360.0" numberType="java.lang.Double" stepSize="1.0" type="number"/>
<SpinnerModel initial="96.0" maximum="360.0" minimum="-360.0" numberType="java.lang.Double" stepSize="1.0" type="number"/>
</Property>
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[53, 20]"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[64, 20]"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JSpinner" name="spinnerThreshold">
<Properties>
<Property name="model" type="javax.swing.SpinnerModel" editor="org.netbeans.modules.form.editors2.SpinnerModelEditor">
<SpinnerModel initial="500.0" maximum="10000.0" minimum="0.0" numberType="java.lang.Double" stepSize="100.0" type="number"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[64, 20]"/>
<SpinnerModel initial="400" maximum="10000" minimum="0" numberType="java.lang.Integer" stepSize="100" type="number"/>
</Property>
</Properties>
</Component>
@@ -272,17 +239,17 @@
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="1" attributes="0">
<EmptySpace max="32767" attributes="0"/>
<EmptySpace min="-2" pref="30" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="labelEnergy" alignment="1" min="-2" max="-2" attributes="0"/>
<Component id="labelDispersion" alignment="1" min="-2" max="-2" attributes="0"/>
<Component id="labelEnergy" alignment="0" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="-2" pref="4" max="-2" attributes="0"/>
<Group type="103" groupAlignment="1" max="-2" attributes="0">
<Component id="spinnerEnergy" pref="73" max="32767" attributes="0"/>
<Component id="spinnerDispersion" max="32767" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="spinnerDispersion" alignment="0" max="32767" attributes="0"/>
<Component id="spinnerEnergy" alignment="0" max="32767" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<EmptySpace min="-2" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
@@ -310,9 +277,6 @@
<Property name="model" type="javax.swing.SpinnerModel" editor="org.netbeans.modules.form.editors2.SpinnerModelEditor">
<SpinnerModel initial="-0.387" maximum="10.0" minimum="-10.0" numberType="java.lang.Double" stepSize="0.001" type="number"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[64, 20]"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="labelEnergy">
@@ -325,9 +289,6 @@
<Property name="model" type="javax.swing.SpinnerModel" editor="org.netbeans.modules.form.editors2.SpinnerModelEditor">
<SpinnerModel initial="7.1" maximum="10.0" minimum="0.0" numberType="java.lang.Double" stepSize="0.01" type="number"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[64, 20]"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="labelDispersion">
@@ -371,15 +332,20 @@
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace max="32767" attributes="0"/>
<Component id="buttonPhaseSet" min="-2" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
</Group>
<Group type="102" alignment="1" attributes="0">
<EmptySpace max="32767" attributes="0"/>
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="textRefPhase" min="-2" pref="69" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="1" attributes="0">
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="textRefPhase" min="-2" pref="69" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="1" attributes="0">
<Component id="buttonPhaseEdit" linkSize="1" min="-2" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
<Component id="buttonPhaseSet" linkSize="1" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
@@ -393,7 +359,10 @@
<Component id="textRefPhase" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="buttonPhaseSet" min="-2" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="buttonPhaseSet" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="buttonPhaseEdit" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="32767" attributes="0"/>
</Group>
</Group>
@@ -419,6 +388,18 @@
<Property name="editable" type="boolean" value="false"/>
<Property name="horizontalAlignment" type="int" value="0"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="textRefPhaseActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="buttonPhaseEdit">
<Properties>
<Property name="text" type="java.lang.String" value="Edit"/>
<Property name="enabled" type="boolean" value="false"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonPhaseEditActionPerformed"/>
</Events>
</Component>
</SubComponents>
</Container>
@@ -434,16 +415,21 @@
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="32767" attributes="0"/>
<Component id="buttonSetDelay" min="-2" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
</Group>
<Group type="102" alignment="1" attributes="0">
<EmptySpace max="32767" attributes="0"/>
<Component id="jLabel2" min="-2" max="-2" attributes="0"/>
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="textOffset" min="-2" pref="69" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="1" attributes="0">
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
<Component id="jLabel2" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="textOffset" min="-2" pref="69" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="1" attributes="0">
<Component id="buttonDelayEdit" linkSize="2" min="-2" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
<Component id="buttonSetDelay" linkSize="2" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
@@ -457,7 +443,10 @@
<Component id="textOffset" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="buttonSetDelay" min="-2" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="buttonSetDelay" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="buttonDelayEdit" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="32767" attributes="0"/>
</Group>
</Group>
@@ -484,6 +473,15 @@
<Property name="horizontalAlignment" type="int" value="0"/>
</Properties>
</Component>
<Component class="javax.swing.JButton" name="buttonDelayEdit">
<Properties>
<Property name="text" type="java.lang.String" value="Edit"/>
<Property name="enabled" type="boolean" value="false"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonDelayEditActionPerformed"/>
</Events>
</Component>
</SubComponents>
</Container>
</SubComponents>

View File

@@ -41,6 +41,8 @@ public class GunEnergyScan extends Panel {
spinnerEnergy.setEnabled(enabled);
buttonPhaseSet.setEnabled(enabled && !textRefPhase.getText().trim().isEmpty());
buttonSetDelay.setEnabled(enabled && !textOffset.getText().trim().isEmpty());
buttonPhaseEdit.setEnabled(enabled);
buttonDelayEdit.setEnabled(enabled);
}
@Override
@@ -81,10 +83,12 @@ public class GunEnergyScan extends Panel {
jLabel1 = new javax.swing.JLabel();
buttonPhaseSet = new javax.swing.JButton();
textRefPhase = new javax.swing.JTextField();
buttonPhaseEdit = new javax.swing.JButton();
jPanel2 = new javax.swing.JPanel();
jLabel2 = new javax.swing.JLabel();
buttonSetDelay = new javax.swing.JButton();
textOffset = new javax.swing.JTextField();
buttonDelayEdit = new javax.swing.JButton();
setPreferredSize(new java.awt.Dimension(737, 445));
@@ -94,30 +98,24 @@ public class GunEnergyScan extends Panel {
labelStop.setText("Stop:");
spinnerStep.setModel(new javax.swing.SpinnerNumberModel(1.0d, 0.05d, 10.0d, 0.05d));
spinnerStep.setPreferredSize(new java.awt.Dimension(64, 20));
spinnerStep.setModel(new javax.swing.SpinnerNumberModel(0.5d, 0.05d, 10.0d, 0.05d));
labelStep.setText("Step size:");
spinnerStart.setModel(new javax.swing.SpinnerNumberModel(0.0d, -360.0d, 360.0d, 1.0d));
spinnerStart.setPreferredSize(new java.awt.Dimension(64, 20));
spinnerStart.setModel(new javax.swing.SpinnerNumberModel(86.0d, -360.0d, 360.0d, 1.0d));
labelSamples.setText("Nb Samples:");
spinnerSamples.setModel(new javax.swing.SpinnerNumberModel(1, 1, 50, 1));
spinnerSamples.setPreferredSize(new java.awt.Dimension(64, 20));
spinnerSamples.setModel(new javax.swing.SpinnerNumberModel(10, 1, 50, 1));
labelLatency.setText("Latency:");
spinnerLatency.setModel(new javax.swing.SpinnerNumberModel(0.1d, 0.0d, 5.0d, 0.01d));
spinnerLatency.setPreferredSize(new java.awt.Dimension(64, 20));
spinnerLatency.setModel(new javax.swing.SpinnerNumberModel(0.4d, 0.0d, 5.0d, 0.01d));
spinnerStop.setModel(new javax.swing.SpinnerNumberModel(180.0d, -360.0d, 360.0d, 1.0d));
spinnerStop.setModel(new javax.swing.SpinnerNumberModel(96.0d, -360.0d, 360.0d, 1.0d));
spinnerStop.setMinimumSize(new java.awt.Dimension(53, 20));
spinnerStop.setPreferredSize(new java.awt.Dimension(64, 20));
spinnerThreshold.setModel(new javax.swing.SpinnerNumberModel(500.0d, 0.0d, 10000.0d, 100.0d));
spinnerThreshold.setPreferredSize(new java.awt.Dimension(64, 20));
spinnerThreshold.setModel(new javax.swing.SpinnerNumberModel(400, 0, 10000, 100));
labelLatency1.setText("Threshold:");
@@ -126,34 +124,27 @@ public class GunEnergyScan extends Panel {
panelScanParsLayout.setHorizontalGroup(
panelScanParsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(panelScanParsLayout.createSequentialGroup()
.addContainerGap()
.addGroup(panelScanParsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(panelScanParsLayout.createSequentialGroup()
.addComponent(labelLatency)
.addGap(2, 2, 2)
.addComponent(spinnerLatency, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(panelScanParsLayout.createSequentialGroup()
.addComponent(labelStop)
.addGap(2, 2, 2)
.addComponent(spinnerStop, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(panelScanParsLayout.createSequentialGroup()
.addComponent(labelStart)
.addGap(2, 2, 2)
.addComponent(spinnerStart, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(panelScanParsLayout.createSequentialGroup()
.addComponent(labelSamples)
.addGap(2, 2, 2)
.addComponent(spinnerSamples, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(panelScanParsLayout.createSequentialGroup()
.addComponent(labelStep)
.addGap(2, 2, 2)
.addComponent(spinnerStep, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(panelScanParsLayout.createSequentialGroup()
.addComponent(labelLatency1)
.addGap(2, 2, 2)
.addComponent(spinnerThreshold, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(panelScanParsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(labelStart, javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(labelStop, javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(labelStep, javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(labelSamples, javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(labelLatency, javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(labelLatency1, javax.swing.GroupLayout.Alignment.TRAILING))
.addGap(2, 2, 2)
.addGroup(panelScanParsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(spinnerStart, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(spinnerStop, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(spinnerStep, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(spinnerSamples, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(spinnerLatency, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(spinnerThreshold, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
panelScanParsLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {spinnerLatency, spinnerSamples, spinnerStart, spinnerStep, spinnerStop, spinnerThreshold});
panelScanParsLayout.setVerticalGroup(
panelScanParsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(panelScanParsLayout.createSequentialGroup()
@@ -187,12 +178,10 @@ public class GunEnergyScan extends Panel {
panelBeamPars.setBorder(javax.swing.BorderFactory.createTitledBorder("Beam Parameters"));
spinnerDispersion.setModel(new javax.swing.SpinnerNumberModel(-0.387d, -10.0d, 10.0d, 0.001d));
spinnerDispersion.setPreferredSize(new java.awt.Dimension(64, 20));
labelEnergy.setText("p (MeV/c):");
spinnerEnergy.setModel(new javax.swing.SpinnerNumberModel(7.1d, 0.0d, 10.0d, 0.01d));
spinnerEnergy.setPreferredSize(new java.awt.Dimension(64, 20));
labelDispersion.setText("Disp. (m):");
@@ -201,14 +190,14 @@ public class GunEnergyScan extends Panel {
panelBeamParsLayout.setHorizontalGroup(
panelBeamParsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelBeamParsLayout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGap(30, 30, 30)
.addGroup(panelBeamParsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(labelDispersion, javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(labelEnergy))
.addComponent(labelEnergy, javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(labelDispersion, javax.swing.GroupLayout.Alignment.TRAILING))
.addGap(4, 4, 4)
.addGroup(panelBeamParsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addComponent(spinnerEnergy, javax.swing.GroupLayout.DEFAULT_SIZE, 73, Short.MAX_VALUE)
.addComponent(spinnerDispersion, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGroup(panelBeamParsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(spinnerDispersion)
.addComponent(spinnerEnergy))
.addContainerGap())
);
panelBeamParsLayout.setVerticalGroup(
@@ -255,22 +244,41 @@ public class GunEnergyScan extends Panel {
textRefPhase.setEditable(false);
textRefPhase.setHorizontalAlignment(javax.swing.JTextField.CENTER);
textRefPhase.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
textRefPhaseActionPerformed(evt);
}
});
buttonPhaseEdit.setText("Edit");
buttonPhaseEdit.setEnabled(false);
buttonPhaseEdit.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonPhaseEditActionPerformed(evt);
}
});
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(buttonPhaseSet)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(textRefPhase, javax.swing.GroupLayout.PREFERRED_SIZE, 69, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
.addGap(0, 0, Short.MAX_VALUE)
.addComponent(jLabel1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(textRefPhase, javax.swing.GroupLayout.PREFERRED_SIZE, 69, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
.addComponent(buttonPhaseEdit)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(buttonPhaseSet)))
.addContainerGap())
);
jPanel1Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {buttonPhaseEdit, buttonPhaseSet});
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
@@ -279,7 +287,9 @@ public class GunEnergyScan extends Panel {
.addComponent(jLabel1)
.addComponent(textRefPhase, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(buttonPhaseSet)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(buttonPhaseSet)
.addComponent(buttonPhaseEdit))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
@@ -298,21 +308,35 @@ public class GunEnergyScan extends Panel {
textOffset.setEditable(false);
textOffset.setHorizontalAlignment(javax.swing.JTextField.CENTER);
buttonDelayEdit.setText("Edit");
buttonDelayEdit.setEnabled(false);
buttonDelayEdit.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonDelayEditActionPerformed(evt);
}
});
javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
jPanel2.setLayout(jPanel2Layout);
jPanel2Layout.setHorizontalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(buttonSetDelay)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel2)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(textOffset, javax.swing.GroupLayout.PREFERRED_SIZE, 69, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap()
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
.addGap(0, 0, Short.MAX_VALUE)
.addComponent(jLabel2)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(textOffset, javax.swing.GroupLayout.PREFERRED_SIZE, 69, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
.addComponent(buttonDelayEdit)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(buttonSetDelay)))
.addContainerGap())
);
jPanel2Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {buttonDelayEdit, buttonSetDelay});
jPanel2Layout.setVerticalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
@@ -321,7 +345,9 @@ public class GunEnergyScan extends Panel {
.addComponent(jLabel2)
.addComponent(textOffset, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(buttonSetDelay)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(buttonSetDelay)
.addComponent(buttonDelayEdit))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
@@ -344,7 +370,7 @@ public class GunEnergyScan extends Panel {
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)))
.addComponent(plot, javax.swing.GroupLayout.DEFAULT_SIZE, 528, Short.MAX_VALUE)
.addComponent(plot, javax.swing.GroupLayout.DEFAULT_SIZE, 523, Short.MAX_VALUE)
.addContainerGap())
);
layout.setVerticalGroup(
@@ -468,8 +494,38 @@ public class GunEnergyScan extends Panel {
}
}//GEN-LAST:event_buttonSetDelayActionPerformed
private void buttonPhaseEditActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonPhaseEditActionPerformed
try{
String ret =getString("Enter Ref. Phase:", "");
if (ret!=null){
textRefPhase.setText(ret.isBlank() ? "" : String.valueOf(Double.valueOf(ret.trim())));
}
onStateChange(getState(), getState());
} catch (Exception ex) {
showException(ex);
}
}//GEN-LAST:event_buttonPhaseEditActionPerformed
private void buttonDelayEditActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonDelayEditActionPerformed
try{
String ret =getString("Enter Offset:", "");
if (ret!=null){
textOffset.setText(ret.isBlank() ? "" : String.valueOf(Double.valueOf(ret.trim())));
}
onStateChange(getState(), getState());
} catch (Exception ex) {
showException(ex);
}
}//GEN-LAST:event_buttonDelayEditActionPerformed
private void textRefPhaseActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_textRefPhaseActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_textRefPhaseActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton buttonAbort;
private javax.swing.JButton buttonDelayEdit;
private javax.swing.JButton buttonPhaseEdit;
private javax.swing.JButton buttonPhaseSet;
private javax.swing.JButton buttonSetDelay;
private javax.swing.JButton buttonStart;

View File

@@ -1,483 +0,0 @@
/*
* Copyright (c) 2014-2017 Paul Scherrer Institute. All rights reserved.
*/
import ch.psi.pshell.plot.LinePlot;
import ch.psi.pshell.ui.Panel;
import ch.psi.utils.State;
import ch.psi.utils.swing.SwingUtils;
import java.util.ArrayList;
import java.util.List;
import javax.swing.JSpinner;
/**
*
*/
public class GunEnergyScanNew extends Panel {
public GunEnergyScanNew() {
initComponents();
setPersistedComponents(SwingUtils.getComponentsByType(panelScanPars, JSpinner.class));
plot.setStyle(LinePlot.Style.ErrorY);
}
//Overridable callbacks
@Override
public void onInitialize(int runCount) {
}
@Override
public void onStateChange(State state, State former) {
buttonAbort.setEnabled(state.isProcessing());
boolean enabled = (state == State.Ready);
buttonStart.setEnabled(enabled);
spinnerStart.setEnabled(enabled);
spinnerStop.setEnabled(enabled);
spinnerStep.setEnabled(enabled);
spinnerSamples.setEnabled(enabled);
spinnerLatency.setEnabled(enabled);
spinnerDispersion.setEnabled(enabled);
spinnerEnergy.setEnabled(enabled);
buttonPhaseSet.setEnabled(enabled && !textRefPhase.getText().trim().isEmpty());
buttonSetDelay.setEnabled(enabled && !textOffset.getText().trim().isEmpty());
}
@Override
public void onExecutedFile(String fileName, Object result) {
}
//Callback to perform update - in event thread
@Override
protected void doUpdate() {
}
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
panelScanPars = new javax.swing.JPanel();
labelStart = new javax.swing.JLabel();
labelStop = new javax.swing.JLabel();
spinnerStep = new javax.swing.JSpinner();
labelStep = new javax.swing.JLabel();
spinnerStart = new javax.swing.JSpinner();
labelSamples = new javax.swing.JLabel();
spinnerSamples = new javax.swing.JSpinner();
labelLatency = new javax.swing.JLabel();
spinnerLatency = new javax.swing.JSpinner();
spinnerStop = new javax.swing.JSpinner();
panelBeamPars = new javax.swing.JPanel();
spinnerDispersion = new javax.swing.JSpinner();
labelEnergy = new javax.swing.JLabel();
spinnerEnergy = new javax.swing.JSpinner();
labelDispersion = new javax.swing.JLabel();
plot = new ch.psi.pshell.plot.LinePlotJFree();
buttonStart = new javax.swing.JButton();
buttonAbort = new javax.swing.JButton();
jPanel1 = new javax.swing.JPanel();
jLabel1 = new javax.swing.JLabel();
buttonPhaseSet = new javax.swing.JButton();
textRefPhase = new javax.swing.JTextField();
jPanel2 = new javax.swing.JPanel();
jLabel2 = new javax.swing.JLabel();
buttonSetDelay = new javax.swing.JButton();
textOffset = new javax.swing.JTextField();
setPreferredSize(new java.awt.Dimension(737, 445));
panelScanPars.setBorder(javax.swing.BorderFactory.createTitledBorder("Scan Parameters"));
labelStart.setText("Start:");
labelStop.setText("Stop:");
spinnerStep.setModel(new javax.swing.SpinnerNumberModel(1.0d, 0.05d, 10.0d, 0.05d));
spinnerStep.setPreferredSize(new java.awt.Dimension(64, 20));
labelStep.setText("Step size:");
spinnerStart.setModel(new javax.swing.SpinnerNumberModel(0.0d, -360.0d, 360.0d, 1.0d));
spinnerStart.setPreferredSize(new java.awt.Dimension(64, 20));
labelSamples.setText("Nb Samples:");
spinnerSamples.setModel(new javax.swing.SpinnerNumberModel(1, 1, 50, 1));
spinnerSamples.setPreferredSize(new java.awt.Dimension(64, 20));
labelLatency.setText("Latency:");
spinnerLatency.setModel(new javax.swing.SpinnerNumberModel(0.1d, 0.0d, 5.0d, 0.01d));
spinnerLatency.setPreferredSize(new java.awt.Dimension(64, 20));
spinnerStop.setModel(new javax.swing.SpinnerNumberModel(180.0d, -360.0d, 360.0d, 1.0d));
spinnerStop.setMinimumSize(new java.awt.Dimension(53, 20));
spinnerStop.setPreferredSize(new java.awt.Dimension(64, 20));
javax.swing.GroupLayout panelScanParsLayout = new javax.swing.GroupLayout(panelScanPars);
panelScanPars.setLayout(panelScanParsLayout);
panelScanParsLayout.setHorizontalGroup(
panelScanParsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(panelScanParsLayout.createSequentialGroup()
.addContainerGap()
.addGroup(panelScanParsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(panelScanParsLayout.createSequentialGroup()
.addComponent(labelLatency)
.addGap(2, 2, 2)
.addComponent(spinnerLatency, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(panelScanParsLayout.createSequentialGroup()
.addComponent(labelStop)
.addGap(2, 2, 2)
.addComponent(spinnerStop, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(panelScanParsLayout.createSequentialGroup()
.addComponent(labelStart)
.addGap(2, 2, 2)
.addComponent(spinnerStart, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(panelScanParsLayout.createSequentialGroup()
.addComponent(labelSamples)
.addGap(2, 2, 2)
.addComponent(spinnerSamples, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(panelScanParsLayout.createSequentialGroup()
.addComponent(labelStep)
.addGap(2, 2, 2)
.addComponent(spinnerStep, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
panelScanParsLayout.setVerticalGroup(
panelScanParsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(panelScanParsLayout.createSequentialGroup()
.addContainerGap()
.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))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(panelScanParsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(spinnerStop, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(labelStop))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(panelScanParsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(spinnerStep, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(labelStep))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(panelScanParsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(spinnerSamples, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(labelSamples))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(panelScanParsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(spinnerLatency, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(labelLatency))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
panelBeamPars.setBorder(javax.swing.BorderFactory.createTitledBorder("Beam Parameters"));
spinnerDispersion.setModel(new javax.swing.SpinnerNumberModel(-0.387d, -10.0d, 10.0d, 0.001d));
spinnerDispersion.setPreferredSize(new java.awt.Dimension(64, 20));
labelEnergy.setText("p (MeV/c):");
spinnerEnergy.setModel(new javax.swing.SpinnerNumberModel(7.1d, 0.0d, 10.0d, 0.01d));
spinnerEnergy.setPreferredSize(new java.awt.Dimension(64, 20));
labelDispersion.setText("Disp. (m):");
javax.swing.GroupLayout panelBeamParsLayout = new javax.swing.GroupLayout(panelBeamPars);
panelBeamPars.setLayout(panelBeamParsLayout);
panelBeamParsLayout.setHorizontalGroup(
panelBeamParsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelBeamParsLayout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(panelBeamParsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(labelDispersion, javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(labelEnergy))
.addGap(4, 4, 4)
.addGroup(panelBeamParsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addComponent(spinnerEnergy, javax.swing.GroupLayout.DEFAULT_SIZE, 73, Short.MAX_VALUE)
.addComponent(spinnerDispersion, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addContainerGap())
);
panelBeamParsLayout.setVerticalGroup(
panelBeamParsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(panelBeamParsLayout.createSequentialGroup()
.addContainerGap()
.addGroup(panelBeamParsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(spinnerDispersion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(labelDispersion))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(panelBeamParsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(spinnerEnergy, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(labelEnergy))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
plot.setTitle("");
buttonStart.setText("Start");
buttonStart.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonStartActionPerformed(evt);
}
});
buttonAbort.setText("Abort");
buttonAbort.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonAbortActionPerformed(evt);
}
});
jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("Set RF Phase"));
jLabel1.setText("Ref phase:");
buttonPhaseSet.setText("Set");
buttonPhaseSet.setEnabled(false);
buttonPhaseSet.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonPhaseSetActionPerformed(evt);
}
});
textRefPhase.setEditable(false);
textRefPhase.setHorizontalAlignment(javax.swing.JTextField.CENTER);
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(buttonPhaseSet)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(textRefPhase, javax.swing.GroupLayout.PREFERRED_SIZE, 69, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap())
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel1)
.addComponent(textRefPhase, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(buttonPhaseSet)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder("Set Laser Delay "));
jLabel2.setText("Offset:");
buttonSetDelay.setText("Set");
buttonSetDelay.setEnabled(false);
buttonSetDelay.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonSetDelayActionPerformed(evt);
}
});
textOffset.setEditable(false);
textOffset.setHorizontalAlignment(javax.swing.JTextField.CENTER);
javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
jPanel2.setLayout(jPanel2Layout);
jPanel2Layout.setHorizontalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(buttonSetDelay)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel2)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(textOffset, javax.swing.GroupLayout.PREFERRED_SIZE, 69, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap())
);
jPanel2Layout.setVerticalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel2)
.addComponent(textOffset, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(buttonSetDelay)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
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.LEADING, false)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addComponent(buttonStart)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(buttonAbort)
.addGap(15, 15, 15))
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(panelScanPars, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(panelBeamPars, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)))
.addComponent(plot, javax.swing.GroupLayout.DEFAULT_SIZE, 528, Short.MAX_VALUE)
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(plot, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, 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)
.addComponent(panelBeamPars, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 30, Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(buttonStart)
.addComponent(buttonAbort))))
.addGap(14, 14, 14))
);
panelScanPars.getAccessibleContext().setAccessibleDescription("");
}// </editor-fold>//GEN-END:initComponents
private void buttonStartActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonStartActionPerformed
textRefPhase.setText("");
ArrayList parameters = new ArrayList();
parameters.add(spinnerStart.getValue());
parameters.add(spinnerStop.getValue());
parameters.add(spinnerStep.getValue());
parameters.add(spinnerSamples.getValue());
parameters.add(spinnerLatency.getValue());
parameters.add((Double) spinnerDispersion.getValue());
parameters.add((Double) spinnerEnergy.getValue());
parameters.add(plot);
try {
runAsync("RFscan/GunEnergyScanNew", parameters).handle((ret, ex) -> {
if (ex != null) {
getLogger().info("Exception executing scan: " + ex);
showException((Exception) ex);
} else {
List list = (List)ret;
try{
double phase = ((Number)list.get(0)).doubleValue();
double offset = ((Number)list.get(1)).doubleValue();
textRefPhase.setText(String.format("%1.2f",phase));
textOffset.setText(String.format("%1.2f",offset));
buttonPhaseSet.setEnabled(true);
buttonSetDelay.setEnabled(true);
} catch (Exception e) {
showException(e);
}
}
return ret;
});
} catch (Exception ex) {
showException(ex);
}
}//GEN-LAST:event_buttonStartActionPerformed
private void buttonAbortActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonAbortActionPerformed
try {
abort();
} catch (Exception ex) {
showException(ex);
}
}//GEN-LAST:event_buttonAbortActionPerformed
private void buttonPhaseSetActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonPhaseSetActionPerformed
try {
if (!textRefPhase.getText().isEmpty()){
Double phase = Double.parseDouble(textRefPhase.getText());
ArrayList parameters = new ArrayList();
parameters.add(phase);
parameters.add(plot);
try {
//How to get a callback on the end of execution
runAsync("RFscan/GunEnergyScanRfSetNew", parameters).handle((ret, ex) -> {
if (ex != null) {
getLogger().info("Exception executing scan: " + ex);
showException((Exception) ex);
}
return ret;
});
} catch (Exception ex) {
showException(ex);
}
}
} catch (Exception ex) {
showException(ex);
}
}//GEN-LAST:event_buttonPhaseSetActionPerformed
private void buttonSetDelayActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonSetDelayActionPerformed
try {
if (!textOffset.getText().isEmpty()){
Double offset = Double.parseDouble(textOffset.getText());
ArrayList parameters = new ArrayList();
parameters.add(offset);
parameters.add(plot);
try {
//How to get a callback on the end of execution
runAsync("RFscan/GunEnergyScanLasSetNew", parameters).handle((ret, ex) -> {
if (ex != null) {
getLogger().info("Exception executing scan: " + ex);
showException((Exception) ex);
}
return ret;
});
} catch (Exception ex) {
showException(ex);
}
}
} catch (Exception ex) {
showException(ex);
}
}//GEN-LAST:event_buttonSetDelayActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton buttonAbort;
private javax.swing.JButton buttonPhaseSet;
private javax.swing.JButton buttonSetDelay;
private javax.swing.JButton buttonStart;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel2;
private javax.swing.JLabel labelDispersion;
private javax.swing.JLabel labelEnergy;
private javax.swing.JLabel labelLatency;
private javax.swing.JLabel labelSamples;
private javax.swing.JLabel labelStart;
private javax.swing.JLabel labelStep;
private javax.swing.JLabel labelStop;
private javax.swing.JPanel panelBeamPars;
private javax.swing.JPanel panelScanPars;
private ch.psi.pshell.plot.LinePlotJFree plot;
private javax.swing.JSpinner spinnerDispersion;
private javax.swing.JSpinner spinnerEnergy;
private javax.swing.JSpinner spinnerLatency;
private javax.swing.JSpinner spinnerSamples;
private javax.swing.JSpinner spinnerStart;
private javax.swing.JSpinner spinnerStep;
private javax.swing.JSpinner spinnerStop;
private javax.swing.JTextField textOffset;
private javax.swing.JTextField textRefPhase;
// End of variables declaration//GEN-END:variables
}

View File

@@ -86,7 +86,7 @@
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="103" groupAlignment="0" max="-2" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Component id="labelStart" linkSize="2" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="0" max="-2" attributes="0"/>
@@ -97,11 +97,6 @@
<EmptySpace min="-2" pref="0" max="-2" attributes="0"/>
<Component id="spinnerSamples" linkSize="3" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<Component id="labelLatency" linkSize="2" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="0" max="-2" attributes="0"/>
<Component id="spinnerLatency" linkSize="3" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="labelStop" linkSize="2" alignment="0" min="-2" max="-2" attributes="0"/>
@@ -113,6 +108,19 @@
<Component id="spinnerStop" linkSize="3" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<Group type="102" alignment="0" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="labelLatency" linkSize="2" min="-2" max="-2" attributes="0"/>
<Group type="102" alignment="1" attributes="0">
<Component id="labelLatency1" min="-2" max="-2" attributes="0"/>
<EmptySpace min="0" pref="0" max="-2" attributes="0"/>
</Group>
</Group>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="spinnerBunch" max="32767" attributes="0"/>
<Component id="spinnerLatency" linkSize="3" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
</Group>
<EmptySpace max="32767" attributes="0"/>
</Group>
@@ -146,6 +154,11 @@
<Component id="labelLatency" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="spinnerLatency" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="labelLatency1" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="spinnerBunch" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="32767" attributes="0"/>
</Group>
</Group>
@@ -217,6 +230,19 @@
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="labelLatency1">
<Properties>
<Property name="horizontalAlignment" type="int" value="11"/>
<Property name="text" type="java.lang.String" value="Bunch:"/>
</Properties>
</Component>
<Component class="javax.swing.JSpinner" name="spinnerBunch">
<Properties>
<Property name="model" type="javax.swing.SpinnerModel" editor="org.netbeans.modules.form.editors2.SpinnerModelEditor">
<SpinnerModel initial="1" maximum="2" minimum="1" numberType="java.lang.Integer" stepSize="1" type="number"/>
</Property>
</Properties>
</Component>
</SubComponents>
</Container>
<Component class="ch.psi.pshell.plot.LinePlotJFree" name="plot">

View File

@@ -16,6 +16,7 @@ import ch.psi.utils.Convert;
import ch.psi.utils.State;
import ch.psi.utils.swing.SwingUtils;
import java.awt.Color;
import java.awt.Component;
import java.util.ArrayList;
import java.util.List;
import javax.swing.JSpinner;
@@ -44,11 +45,9 @@ public class SchottkyScan extends Panel {
public void onStateChange(State state, State former) {
buttonAbort.setEnabled(state.isProcessing());
buttonStart.setEnabled(state == State.Ready);
spinnerStart.setEnabled(buttonStart.isEnabled());
spinnerStop.setEnabled(buttonStart.isEnabled());
spinnerStep.setEnabled(buttonStart.isEnabled());
spinnerSamples.setEnabled(buttonStart.isEnabled());
spinnerLatency.setEnabled(buttonStart.isEnabled());
for (Component c : SwingUtils.getComponentsByType(panelPars, JSpinner.class)){
c.setEnabled(buttonStart.isEnabled());
}
}
@Override
@@ -77,6 +76,8 @@ public class SchottkyScan extends Panel {
spinnerSamples = new javax.swing.JSpinner();
labelSamples = new javax.swing.JLabel();
spinnerStart = new javax.swing.JSpinner();
labelLatency1 = new javax.swing.JLabel();
spinnerBunch = new javax.swing.JSpinner();
plot = new ch.psi.pshell.plot.LinePlotJFree();
buttonStart.setText("Start");
@@ -120,13 +121,18 @@ public class SchottkyScan extends Panel {
spinnerStart.setModel(new javax.swing.SpinnerNumberModel(-10.0d, -360.0d, 360.0d, 1.0d));
labelLatency1.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
labelLatency1.setText("Bunch:");
spinnerBunch.setModel(new javax.swing.SpinnerNumberModel(1, 1, 2, 1));
javax.swing.GroupLayout panelParsLayout = new javax.swing.GroupLayout(panelPars);
panelPars.setLayout(panelParsLayout);
panelParsLayout.setHorizontalGroup(
panelParsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(panelParsLayout.createSequentialGroup()
.addContainerGap()
.addGroup(panelParsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(panelParsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addGroup(panelParsLayout.createSequentialGroup()
.addComponent(labelStart)
.addGap(0, 0, 0)
@@ -135,10 +141,6 @@ public class SchottkyScan extends Panel {
.addComponent(labelSamples)
.addGap(0, 0, 0)
.addComponent(spinnerSamples, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(panelParsLayout.createSequentialGroup()
.addComponent(labelLatency)
.addGap(0, 0, 0)
.addComponent(spinnerLatency, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(panelParsLayout.createSequentialGroup()
.addGroup(panelParsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(labelStop)
@@ -146,7 +148,16 @@ public class SchottkyScan extends Panel {
.addGap(1, 1, 1)
.addGroup(panelParsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(spinnerStep, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(spinnerStop, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))
.addComponent(spinnerStop, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGroup(panelParsLayout.createSequentialGroup()
.addGroup(panelParsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(labelLatency)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelParsLayout.createSequentialGroup()
.addComponent(labelLatency1)
.addGap(0, 0, 0)))
.addGroup(panelParsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(spinnerBunch)
.addComponent(spinnerLatency, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
@@ -177,6 +188,10 @@ public class SchottkyScan extends Panel {
.addGroup(panelParsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(labelLatency)
.addComponent(spinnerLatency, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(panelParsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(labelLatency1)
.addComponent(spinnerBunch, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
@@ -229,6 +244,7 @@ public class SchottkyScan extends Panel {
parameters.add(spinnerSamples.getValue());
parameters.add(spinnerLatency.getValue());
parameters.add(plot);
parameters.add(spinnerBunch.getValue());
try {
//How to get a callback on the end of execution
runAsync("RFscan/SchottkyScan", parameters).handle((ret, ex) -> {
@@ -260,12 +276,14 @@ public class SchottkyScan extends Panel {
private javax.swing.JButton buttonAbort;
private javax.swing.JButton buttonStart;
private javax.swing.JLabel labelLatency;
private javax.swing.JLabel labelLatency1;
private javax.swing.JLabel labelSamples;
private javax.swing.JLabel labelStart;
private javax.swing.JLabel labelStep;
private javax.swing.JLabel labelStop;
private javax.swing.JPanel panelPars;
private ch.psi.pshell.plot.LinePlotJFree plot;
private javax.swing.JSpinner spinnerBunch;
private javax.swing.JSpinner spinnerLatency;
private javax.swing.JSpinner spinnerSamples;
private javax.swing.JSpinner spinnerStart;

View File

@@ -10,8 +10,9 @@
import datetime
do_elog = True
dry_run = False
do_elog = True
is_panel = get_exec_pars().source != CommandSource.ui #Must be checked before callin "run"
camera_name = "simulation" if dry_run else "SINEG01-DSCR190"
bpm_name = "SINEG01-DBPM340"

View File

@@ -13,4 +13,6 @@ def linfit(x, y):
ssreg = np.sum((yhat - ybar)**2)
sstot = np.sum((y - ybar)**2)
R2 = ssreg / sstot
return (p, x_fit, y_fit, R2)
return (p, x_fit, y_fit, R2)

6
script/Correlation/Correlation.py Executable file → Normal file
View File

@@ -2,7 +2,7 @@ import math
import sys, traceback
from mathutils import fit_polynomial, PolynomialFunction
from plotutils import plot_line, plot_function
from ch.psi.pshell.swing.Shell import STDOUT_COLOR
from ch.psi.pshell.swing.Shell import getColorStdout
import org.apache.commons.math3.stat.correlation.PearsonsCorrelation as PearsonsCorrelation
if get_exec_pars().source == CommandSource.ui:
@@ -120,7 +120,7 @@ try:
#Sample and plot data
if bs == True:
_stream.waitValueNot(_stream.take(), 10000)
(x,y) = _stream.take().values
(x,y) = _stream.take().values()
else:
x=dx.read()
y=dy.read()
@@ -142,7 +142,7 @@ try:
if marker is not None:
p.removeMarker(marker)
marker = p.addMarker(x2+res, p.AxisId.X, s, p.getBackground())
marker.setLabelPaint(STDOUT_COLOR)
marker.setLabelPaint(getColorStdout())
if linear_fit:
#Calculate, print and plot linear fit
pars_lin = (a0,a1) = fit_polynomial(ay, ax, 1)

4
script/Correlation/Correlation2.py Executable file → Normal file
View File

@@ -2,7 +2,7 @@ import math
import sys, traceback
from mathutils import fit_polynomial, PolynomialFunction
from plotutils import plot_line, plot_function
from ch.psi.pshell.swing.Shell import STDOUT_COLOR
from ch.psi.pshell.swing.Shell import getColorStdout
import org.apache.commons.math3.stat.correlation.PearsonsCorrelation as PearsonsCorrelation
import ch.psi.pshell.bs.PipelineServer as PipelineServer
@@ -186,7 +186,7 @@ try:
if marker is not None:
p.removeMarker(marker)
marker = p.addMarker(x2+res, p.AxisId.X, s, p.getBackground())
marker.setLabelPaint(STDOUT_COLOR)
marker.setLabelPaint(getColorStdout())
if linear_fit:
#Calculate, print and plot linear fit
pars_lin = (a0,a1) = fit_polynomial(ay, ax, 1)

30
script/Correlation/CorrelationStream.py Executable file → Normal file
View File

@@ -14,7 +14,7 @@ class CorrelationStream():
self.st=None
self.running = False
self.task=None
def get_channel_list(self):
ch=[]
@@ -41,7 +41,7 @@ class CorrelationStream():
def start_stream(self, channel_list):
try:
self.st=None
print "Starting stream"
log("Starting stream: " + str(self.prefix))
if len(channel_list)==0:
raise Exception ("No channel defined")
self. st = Stream("pulse_id", dispatcher)
@@ -54,19 +54,20 @@ class CorrelationStream():
if self.st.take() is None:
raise Exception("Error initializing data stream")
self.ack_channel_list(channel_list)
print "Stream started"
log("Stream started: " + str(self.prefix))
except:
self.stop_stream()
self.st=None
print sys.exc_info()[1]
log(sys.exc_info()[1])
def stop_stream(self):
log("Closing stream: " + str(self.prefix))
try:
if self.st:
self.st.close()
print "Stream closed"
log("Stream closed: " + str(self.prefix))
except:
print sys.exc_info()[1]
log(sys.exc_info()[1])
finally:
self.st=None
self.ack_channel_list([])
@@ -81,7 +82,7 @@ class CorrelationStream():
buf[1] = num_channels
buf[4] = self.empty_value
#if (self.pid is not None) and ((self.pid+1) != msg.pulseId):
# print "Missing pid: ", (self.pid+1)
# msg("Missing pid: +str(self.pid+1))
self.pid = msg.pulseId
#Count
if buf[2] < size_buffer:
@@ -105,7 +106,7 @@ class CorrelationStream():
def _run(self):
print "Start running correlation stream " + str(self.prefix)
log("Start running thread: " + str(self.prefix))
channel_list = []
try:
@@ -115,11 +116,10 @@ class CorrelationStream():
while self.running:
started = (start_channel.get()==1)
if started and not self.st:
print "Started"
buf[2] = 0
buf[3]= -1
channel_list=self.get_channel_list()
print "Channel list: ", channel_list
log("Started " + str(self.prefix) + " - Channel list: " + str(channel_list) )
self.start_stream(channel_list)
if self.st is not None:
class StreamListener (DeviceListener):
@@ -132,14 +132,14 @@ class CorrelationStream():
self.st.addListener(listener)
elif self.st and not started:
print "Stopped"
log("Stopped " + str(self.prefix))
channel_list=[]
self.stop_stream()
time.sleep(0.1)
except:
print sys.exc_info()[1]
log(sys.exc_info()[1])
finally:
print "Stop running correlation stream " + str(self.prefix)
log("Stop running thread: " + str(self.prefix))
self.stop_stream()
if output_channel: output_channel.close()
if start_channel: start_channel.close()
@@ -155,9 +155,9 @@ class CorrelationStream():
if self.running:
self.running = False
if (self.task is not None):
print "Waiting correlation stream thread to stop..."
log("Waiting correlation stream thread to stop..." + str(self.prefix))
join([self.task,])
print "Done"
log("Done" + str(self.prefix))
def is_running(self):
return (self.task is not None) and not (self.task.isDone())

10
script/Correlation/correlation_stream_mult.py Executable file → Normal file
View File

@@ -1,9 +1,13 @@
run("Correlation/CorrelationStream")
#PREFIX = "SLAAR"
PREFIX = "SLG"
correlation_endstations=["SLAAR-LBSTREAM1","SLAAR-LBSTREAM2", "SLAAR-LBSTREAM3", "SLAAR-LBSTREAM4", "SLAAR-LBSTREAM5", "SLAAR-LBSTREAM6"]
correlation_endstations=[PREFIX+"-LBSTREAM1",PREFIX+"-LBSTREAM2", PREFIX+"-LBSTREAM3", PREFIX+"-LBSTREAM4", PREFIX+"-LBSTREAM5", PREFIX+"-LBSTREAM6"]
correlation_streams = []
log("Initializing...")
for es in correlation_endstations:
correlation_streams.append(CorrelationStream(es))
@@ -14,5 +18,7 @@ try:
cs.run()
time.sleep(10.0)
finally:
log("Finalizing...")
for cs in correlation_streams:
cs.stop()
cs.stop()
log("Quit")

View File

@@ -119,14 +119,14 @@ elements = (
(DWSC, "S30CB05-DWSC440", 340.6330),
(DBPM, "SATDI01-DBPM030", 340.8637),
(DBPM, "SATDI01-DBPM060", 342.7637),
(DWSC, "SATDI01-DWSC065", 342.9837),
(DBPM, "SATDI01-DBPM210", 349.2197),
(DBPM, "S30CB06-DBPM420", 349.3150),
(DBLM, "S30CB06-DBLM445", 349.7625),
(DBLM, "SATDI01-DBLM225", 349.5613),
(DBPM, "SATDI01-DBPM240", 352.1997),
(DBPM, "SATDI01-DBPM270", 355.1797),
#(DWSC, "SATDI01-DWSC290", 356.4797),
(DWSC, "SATDI01-DWSC290", 356.3100),
(DBLM, "SATDI01-DBLM305", 356.5500),
(DBPM, "SATDI01-DBPM320", 357.0907),
(DBPM, "S30CB07-DBPM420", 358.4150),
(DBPM, "SATCB01-DBPM220", 361.5357),

View File

@@ -0,0 +1,68 @@
#CAS.setServerPort(5064)
import java.util.function.BiFunction as BiFunction
class ShellCommand(RegisterBase, RegisterArray):
def __init__(self, name):
RegisterBase.__init__(self, name)
self.val = ""
self.debug=False
self.max_size = 10000
def getSize(self):
return 1
def doRead(self):
if self.debug:
print "READ: ", self.val
return self.val
def doWrite(self, val):
self.val = "RUNNING"
try:
if self.debug:
print "WRITE: ", val
cmd = str(val[0])
class eval_callback(BiFunction):
def apply(self_callback, ret, ex):
try:
if ex is not None:
err=ex.message
if "Exception:" in err:
err = err[err.index("Exception:")+10:].strip()
self.val = "ERR:" + err
else:
self.val = "RET:" + str(ret)
self.val = self.val[0:self.max_size]
except:
err=str(sys.exc_info()[1])
self.val = "EXC: " + err
if self.debug:
print self.val
#self.val = cmd
get_context().evalLineBackgroundAsync(cmd).handle(eval_callback())
except:
err=str(sys.exc_info()[1])
if "Exception:" in err:
err = err[err.index("Exception:")+10:].strip()
self.val = "EXC: " + err
self.val = self.val[0:self.max_size]
if self.debug:
print self.val
add_device(ShellCommand("sc"), True)
cas = CAS("TESTCAS:sc", sc, 'string')
#print caget("TESTCAS:sc","s")
#/Users/gobbo_a/anaconda3/envs/epics/epics/bin/darwin-x86

View File

@@ -0,0 +1,93 @@
import ch.psi.pshell.device.Startable as Startable
import traceback
class StreamListener (DeviceListener):
def __init__(self, merger):
self.merger = merger
def onCacheChanged(self, device, value, former, timestamp, valueChange):
self.merger.update()
class StreamMerger(DeviceBase, Readable):
def __init__(self, name, st1, st2):
DeviceBase.__init__(self, name)
self.st1=st1
self.st2=st2
self.pulseId = -1
self.v1= None
self.v2= None
self.initialize()
self.running=False
self.listener = StreamListener(self)
self.setComponents([st1,st2])
def doUpdate(self):
try:
while True:
has_more_1 = has_more_2 = False
if (self.v1 is None) or ((self.v1 is not None) and (self.v2 is not None) and (self.v1.pulseId < self.v2.pulseId)):
if self.st1.bufferCapacity>0:
tm_value = self.st1.popBuffer()
self.v1 = None if tm_value is None else tm_value.value
has_more_1 = (v1 is not None)
else:
self.v1 = self.st1.take()
if (self.v2 is None) or ((self.v1 is not None) and (self.v2 is not None) and (self.v1.pulseId > self.v2.pulseId)):
if self.st2.bufferCapacity>0:
tm_value = self.st2.popBuffer()
self.v2 = None if tm_value is None else tm_value.value
has_more_2 = (v2 is not None)
else:
self.v2 = self.st2.take()
if ((self.v1 is not None) and (self.v2 is not None) and (self.v1.pulseId == self.v2.pulseId)):
if self.v1.pulseId > self.pulseId:
keys=self.v1.keys()
keys.addAll(self.v2.keys())
values=self.v1.values()
values.addAll(self.v2.values())
self.pulseId = self.v1.pulseId
self.values, self.keys = values, keys
self.setCache(values, None)
self.v1=self.v2=None
else:
if (not has_more_1) and (not has_more_2):
break
except Exception, ex:
print >> sys.stderr, traceback.format_exc()
def doSetMonitored(self,value):
if (value):
self.st1.addListener(self.listener)
self.st2.addListener(self.listener)
else:
self.st1.removeListener(self.listener)
self.st2.removeListener(self.listener)
def doClose(self):
self.doSetMonitored(False)
def getReadables(self):
ret = list(self.st1.children + self.st2.children)
ret = [item for item in ret if type(item)!=Stream.PidReader]
return [self.st1.getPidReader(),] + ret
def read(self):
return self.pulseId
def start(self):
if not self.st1.isStarted():
self.st1.start()
if not self.st2.isStarted():
self.st2.start()
def stop(self):
if self.st1.isStarted():
self.st1.stop()
if self.st2.isStarted():
self.st2.stop()
def isStarted(self):
return self.st1.isStarted() and self.st2.isStarted()
#TODO: Readable children devices

View File

@@ -0,0 +1,8 @@
# change LED EVR delay
blm = "SARMA01-DLLM125"
delta = 5.0 # us
led = caget(blm + ":LED-DELAY-OP.INPA").split()[0]
delay1 = caget(led)
delay2 = delay1 + delta
print(blm, led, delay1, delay2)
caput(led, delay2)

View File

@@ -0,0 +1,16 @@
# shift BLM ROI by desired offset in us and reinitialise ioc
blm = "SATUN22-DBLM005"
ioc = "SARCL02-DBLM469"
offset = 0.040 # us
PIX = 2.33426704 # 1 / (124.8 MHz * 3) = 2.33426704 ns
evr = caget(blm + ":GPAC-DELAY-OP.INPA").split()[0]
delay = caget(evr)
start_b1 = int(caget(blm + ":B1_ROI_START"))
new_start_b1 = int(start_b1 + offset * 1000 / PIX)
print(blm, ioc, delay, offset, start_b1, new_start_b1)
caput(blm + ":B1_ROI_START", new_start_b1)
caput(blm + ":B1_ROI_STOP", new_start_b1 + 18)
caput(blm + ":B2_ROI_START", new_start_b1 + 19)
caput(blm + ":B2_ROI_STOP", new_start_b1 + 37)
print(ioc + ":SYSTEM-INIT.PROC", 1)
caput(ioc + ":SYSTEM-INIT.PROC", 1)

View File

@@ -0,0 +1,36 @@
# shift all ROIs such that the GPAC EVRs have all the same delay, set GPAC delay, reinitialsie ioc
blm_list = {"S10BC01-DBLM065", "S10CB04-DBLM240", "S10CB06-DBLM240", "S10CB08-DBLM240", "S10DI01-DBLM015",
"S10DI01-DBLM045", "S20CB02-DBLM435", "S20SY02-DBLM075", "S20SY03-DBLM025", "S20SY03-DBLM110",
"S30CB02-DBLM445", "S30CB06-DBLM445", "S30CB10-DBLM445", "S30CB14-DBLM445", "SARCL02-DBLM135",
"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", "SATBD01-DBLM205", "SATCB01-DBLM245", "SATCL01-DBLM135",
"SATCL02-DBLM295", "SATCL02-DBLM435", "SATDI01-DBLM095", "SATDI01-DBLM105", "SATDI01-DBLM225",
"SATDI01-DBLM305", "SATMA01-DBLM065", "SATSY03-DBLM085", "SATUN06-DBLM005", "SATUN14-DBLM405",
"SATUN22-DBLM005", "SINDI02-DBLM025", "SINDI02-DBLM085", "SINLH02-DBLM230", "SINLH02-DBLM235"}
ioc_list = {"SARCL02-DBLM469", "S10BC01-DBLM184", "S10CB06-DBLM153", "S10CB04-DBLM130", "SINLH02-DBLM018",
"S10DI01-DBLM113", "S20CB02-DBLM234", "S30CB10-DBLM381", "SINDI02-DBLM084", "S20SY03-DBLM292",
"S30CB02-DBLM310", "S30CB14-DBLM417", "SARUN01-DBLM499", "SARUN04-DBLM516", "SARUN08-DBLM537",
"SARUN11-DBLM546", "SARMA01-DBLM482", "SARUN20-DBLM599", "SATDI01-DBLM344", "SARUN13-DBLM555",
"SATCB01-DBLM355", "S10CB08-DBLM170", "SATCL01-DBLM328", "SARUN15-DBLM567", "S20CB04-DBLM255",
"SARCL02-DBLM457", "SINEG01-DBLM009", "S20SY03-DBLM269"}
PIX = 2.33426704 # 1 / (124.8 MHz * 3) = 2.33426704 ns
for blm in blm_list:
evr = caget(blm + ":GPAC-DELAY-OP.INPA").split()[0]
delay = caget(evr)
offset = delay - 7439.0 # 7439 ns
start_b1 = int(caget(blm + ":B1_ROI_START"))
new_start_b1 = int(start_b1 + offset * 1000 / PIX)
print(delay, offset, start_b1, new_start_b1)
caput(blm + ":B1_ROI_START", new_start_b1)
caput(blm + ":B1_ROI_STOP", new_start_b1 + 18)
caput(blm + ":B2_ROI_START", new_start_b1 + 19)
caput(blm + ":B2_ROI_STOP", new_start_b1 + 37)
for ioc in ioc_list:
caput(ioc + "-EVR0:Pul10-Delay-SP", 7439.0)
caput(ioc + ":SYSTEM-INIT.PROC", 1)
print(ioc + "-EVR0:Pul10-Delay-SP", 7439.0)
print(ioc + ":SYSTEM-INIT.PROC", 1)

View File

@@ -0,0 +1,17 @@
# shift (and scale) the position of the start and end of the LLM GPAC waveform
# delta is in m, scaling may be unphysical (change of signal speed in the fibber)
llmlist = ("SINEG01-DLLM335", "SINDI01-DLLM105", "S10CB09-DLLM110", "S20CB04-DLLM110",
"S30CB05-DLLM110", "S30CB13-DLLM110", "SARMA01-DLLM125", "SARUN15-DLLM075",
"SATSY01-DLLM005", "SATDI01-DLLM305", "SATUN09-DLLM035")
llm = "SATSY01-DLLM005"
delta = 1.0
scale = 1.0 # should not be changed individually (same fibber type-> same signal speed)
z1 = caget(llm + ":Z-START-OP")
z2 = caget(llm + ":Z-STOP-OP")
dz = (z2 - z1) * scale
zc = (z1 + z2) / 2 + delta
z1 = zc - dz / 2
z2 = zc + dz / 2
caput(llm + ":Z-START-OP", z1)
caput(llm + ":Z-STOP-OP", z2)

View File

@@ -0,0 +1,7 @@
# scale globally LLM GPAC waveform length
# the length in m should normally be: 1 / (142.8 MHz * 3) * 2047 * c / (1 + n=1.4585) = 582.7 m
llmlist = ("SINEG01-DLLM335", "SINDI01-DLLM105", "S10CB09-DLLM110", "S20CB04-DLLM110",
"S30CB05-DLLM110", "S30CB13-DLLM110", "SARMA01-DLLM125", "SARUN15-DLLM075",
"SATSY01-DLLM005", "SATDI01-DLLM305", "SATUN09-DLLM035")
for llm in llmlist: caput(llm + ":Z-STOP-OP", caget(llm + ":Z-START-OP") + 582.7)

View File

@@ -0,0 +1,21 @@
# shift LLM ROIs by set amount delta_m in m and init ioc
delta_m = 0.0 # m
llm = "SATSY01-DLLM005"
ioc = "S20SY03-DBLM269"
chlist = [":CH1", ":CH2", ":CH3", ":CH4", ":CH5", ":CH6", ":CH7", ":CH8"]
z_start = caget(llm + ":Z-START-OP")
z_stop = caget(llm + ":Z-STOP-OP")
delta_pt = int(delta_m * 2047 / (z_stop - z_start))
print(delta_pt)
for ch in chlist:
roi_start = int(caget(llm + ch + "_ROI_START"))
roi_stop = int(caget(llm + ch + "_ROI_STOP"))
print(roi_start, roi_stop)
roi_start = roi_start + delta_pt
roi_stop = roi_stop + delta_pt
print(roi_start, roi_stop)
caput(llm + ch + "_ROI_START", roi_start)
caput(llm + ch + "_ROI_STOP", roi_stop)
print(ioc + ":SYSTEM-INIT.PROC", 1)
caput(ioc + ":SYSTEM-INIT.PROC", 1)

View File

@@ -0,0 +1,21 @@
# shift and scale the position of the start and end of the LLM GPAC waveform
# keep llm center unchanged, set step-size to default value
# delta is in m, scaling may be unphysical (change of signal speed in the fibber)
llmlist = ("SINEG01-DLLM335", "SINDI01-DLLM105", "S10CB09-DLLM110", "S20CB04-DLLM110",
"S30CB05-DLLM110", "S30CB13-DLLM110", "SARMA01-DLLM125", "SARUN15-DLLM075",
"SATSY01-DLLM005", "SATDI01-DLLM305", "SATUN09-DLLM035")
llm = "SATUN09-DLLM035"
zllm1 = 429.9
zllm2 = 502.3
zc = (zllm1 + zllm2) / 2
z1i = caget(llm + ":Z-START-OP")
z2i = caget(llm + ":Z-STOP-OP")
stepi = (z2i - z1i) / 2047
n = int((zc - z1i) / stepi)
stepf = 0.28464 # n = 1.4585 (Silica)
z1f = zc - n * stepf
z2f = zc + (2047 - n) * stepf
caput(llm + ":Z-START-OP", z1f)
caput(llm + ":Z-STOP-OP", z2f)

View File

@@ -1,45 +0,0 @@
################################################################################
# s = eps * [[beta, -alpha],
# [-alpha, gamma]]
# R = R(1)->(2)
# s2 = R * s1 * RT
#
# s2_11 = s1_11 * R11**2 + 2 * s1_12 * R11 * R12 + s1_22 * R12**2
#
# A = [[R11,1**2, 2 * R11,1 * R12,1, R12,1**2],
# [R11,2**2, 2 * R11,2 * R12,2, R12,2**2],
# ...
# [R11,n**2, 2 * R11,n * R12,n, R12,n**2],
# B = [s2_11,1,
# s2_11,2,
# ...
# s2_11,n]
# X = [s1_11,
# s1_12,
# s1_22]
#
# A * X = B
################################################################################
import numpy as np
n = 5
bet = [1.74450, 1.34220, 0.99999, 0.71557, 0.48651]
eps = 25.0E-6 # m.rad
R11 = [ 0.85800, 0.71000, 0.56400, 0.42000, 0.27900]
R12 = [ 0.44100, 0.41900, 0.39800, 0.37600, 0.35500]
#A = [[1.0,2.0],[3.0,4.0],[2.0,3.0]]
#B = [[-1.0],[-1.0],[-1.2]]
#X = [[1.0],[-1.0]]
A = []
B = []
for i in range(0, n):
A.append([R11[i]**2, 2 * R11[i] * R12[i], R12[i]**2])
B.append([bet[i] * eps])
A = np.matrix(A)
B = np.matrix(B)
X = np.linalg.inv(A.T.dot(A)).dot(A.T).dot(B)
print(X)

View File

@@ -0,0 +1,14 @@
scaling_factor = 1.002 #SARCL02:SCALE-USER-OP
maglist = ("SARCL02-MQUA310","SARCL02-MQUA350","SARCL02-MQUA460","SARCL02-MQSK300",
"SARCL02-MQUA150","SARCL02-MQSK160","SARCL02-MQUA430","SARCL02-MQSK420",
"SARCL02-MQUA130","SARCL02-MQUA210","SARCL02-MQUA250")
I1, I2 = {}, {}
for mag in maglist:
I = caget(mag + ":I-SET")
I1[mag] = I
I2[mag] = I * scaling_factor
print I1,I2
for mag in maglist: caputq(mag + ":I-SET", I2[mag])

View File

@@ -0,0 +1,35 @@
# stop the beam
caput("SARCL02-MBND100:USER-DELTA-ENE-STATE", 1)
caput("SIN-TIMAST-TMA:Beam-RF-OnDelay-Sel", 1)
caput("SIN-TIMAST-TMA:Beam-Apply-Cmd.PROC", 1)
# read channels
dE = caget("SARCL02-MBND100:USER-DELTA-ENE")
S30_GAIN = caget("S30:SET-E-GAIN-OP")
SARCL02_P_SET = caget("SARCL02-MBND100:P-SET")
SARBD01_P_SET = caget("SARBD01-MBND100:P-SET")
# set new energy set-points
S30_GAIN = S30_GAIN + dE
SARCL02_P_SET = SARCL02_P_SET + dE
SARBD01_P_SET = SARBD01_P_SET + dE
caput("S30:SET-E-GAIN-OP", S30_GAIN)
caput("SARCL02-MBND100:P-SET", SARCL02_P_SET)
caput("SARBD01-MBND100:P-SET", SARBD01_P_SET)
# adjust optics to new energy
caput("S30:OPTICS-ONOFF-OP", 1)
caput("SAR:OPTICS-ONOFF-OP", 1)
time.sleep(10)
# start the beam at 1 Hz
caput("SIN-TIMAST-TMA:Beam-RF-OnDelay-Sel", 0)
caput("SIN-TIMAST-TMA:Bunch-1-Freq-Sel", 10)
caput("SIN-TIMAST-TMA:Bunch-2-Freq-Sel", 10)
caput("SIN-TIMAST-TMA:Beam-Apply-Cmd.PROC", 1)
time.sleep(10)
# beam at 10 Hz
caput("SIN-TIMAST-TMA:Bunch-1-Freq-Sel", 6)
caput("SIN-TIMAST-TMA:Bunch-2-Freq-Sel", 6)
caput("SIN-TIMAST-TMA:Beam-Apply-Cmd.PROC", 1)
time.sleep(10)
# optics feedback off
caput("S30:OPTICS-ONOFF-OP", 0)
caput("SAR:OPTICS-ONOFF-OP", 0)
caput("SARCL02-MBND100:USER-DELTA-ENE-STATE", 0)

View File

@@ -0,0 +1,14 @@
#import epics as ep
#import numpy as np
monoenePVset = 'SAROP11-ARAMIS:ENERGY_SP'
pbps122PVrb = 'SAROP11-PBPS122:INTENSITY'
startval = caget(monoenePVset)
for i in range(2485, 2515, 2):
caput(monoenePVset, i)
sleep(5)
#ep.caget(pbps122)
caput(monoenePVset, startval)

View File

View File

@@ -0,0 +1,60 @@
IN_POSITION_BAND = 10.0
# muss auskommentiert bleiben
#Keithley = Channel("SATOP31-CSSU-PCEL1381:READOUT",'d', monitored ='True')
#K_avg = create_averager(Keithley, 10, interval = -1)
def beam_ok():
I0 = caget ("SATFE10-PEPG046:PHOTON-ENERGY-PER-PULSE-AVG")
if I0 > 100:
return "Yes"
else :
return "Yes"
def before_sampling(rec):
while beam_ok() == "No":
time.sleep(0.1)
print(".")
def after_sampling(rec):
if beam_ok() == "No":
rec.invalidate()
#i0 = Channel("SATFE10-PEPG046:PHOTON-ENERGY-PER-PULSE-AVG",'d')
#i_avg = create_averager(i0, 10, interval = -1)
K=Channel("SATOP31-CSSU-PCEL1381:READOUT")
#K_avg = create_averager(K, 10, interval = -1)
my_keithley_avg= create_averager("ca://SATOP31-CSSU-PCEL1381:READOUT", count=10,interval=-1,name="my_keithley_avg")
class VLSSGM(RegisterBase):
def doWrite(self, value):
caput ("SATOP11-OSGM087:SetEnergy", value)
time.sleep(0.2)
cawait('SATOP11-OSGM087:MOVING', 1, timeout = 20.0, type = 'i')
def doRead(self):
return caget("SATOP11-OSGM087:photonenergy")
athos = VLSSGM()
athos.initialize()
lscan( athos, my_keithley_avg, 398.7, 401.0, 0.02, 0.2, setpoints=True,zigzag=True) # Scans mit PSCR136
#lscan( athos, my_keithley_avg, 200.0, 201.0, 0.01, 0.2, setpoints=True,zigzag=True) # Scans mit PSCR136#lscan( athos, [K], 870.0 , 885.00, 0.1, 0.5, setpoints=True,zigzag=True) # Scans mit PSCR136
#lscan( athos, [K], 856.0 , 865.00, 0.1, 0.5, setpoints=True,zigzag=True) # Scans mit PSCR136
#lscan( athos, [i0,K_avg], 833.5, 837, 0.05, 0.5, setpoints=True,zigzag=True) # Scans mit PCEL
#lscan( athos, [i0,i_avg], 760.0, 820.0, 2.0, 0.5, setpoints=True,zigzag=True) # Scans mit PSCR136
#lscan( athos, [i0,i_avg], 380.0, 410.0, 1.0, 0.5, setpoints=True,zigzag=True) # Scans mit PSCR136
#caput ("ATHOS:SetEnergy", 680.0)
#tscan( [i], 10, 1 , passes=1)

View File

@@ -0,0 +1,66 @@
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.stream.waitCacheChange(-1)
i= cam_server.stream.getChild("intensity")
i_avg = create_averager(i, 20, interval = -1)
# muss auskommentiert bleiben
#Keithley = Channel("SATOP31-CSSU-PCEL1381:READOUT",'d', monitored ='True')
#K_avg = create_averager(Keithley, 5, interval = -1)
def beam_ok():
I0 = caget ("SATFE10-PEPG046:PHOTON-ENERGY-PER-PULSE-AVG")
if I0 > 100:
return "Yes"
else :
return "Yes"
def before_sampling(rec):
while beam_ok() == "No":
time.sleep(0.1)
print(".")
def after_sampling(rec):
if beam_ok() == "No":
rec.invalidate()
i0 = Channel("SATFE10-PEPG046:PHOTON-ENERGY-PER-PULSE-AVG",'d')
K=Channel("SATOP31-CSSU-PCEL1381:READOUT")
class VLSSGM(RegisterBase):
def doWrite(self, value):
caput ("SATOP11-OSGM087:SetEnergy", value)
time.sleep(0.2)
cawait('SATOP11-OSGM087:MOVING', 1, timeout = 20.0, type = 'i')
def doRead(self):
return caget("SATOP11-OSGM087:photonenergy")
athos = VLSSGM()
athos.initialize()
lscan( athos, [i0,i_avg], 370.0, 420.0, 1.0, 0.5, setpoints=True,zigzag=True) # Scans mit PSCR136
#lscan( athos, [i0,K_avg], 833.5, 837, 0.05, 0.5, setpoints=True,zigzag=True) # Scans mit PCEL
#lscan( athos, [i0,i_avg], 760.0, 820.0, 2.0, 0.5, setpoints=True,zigzag=True) # Scans mit PSCR136
#lscan( athos, [i0,i_avg], 380.0, 410.0, 1.0, 0.5, setpoints=True,zigzag=True) # Scans mit PSCR136
#caput ("ATHOS:SetEnergy", 680.0)
#tscan( [i], 10, 1 , passes=1)

18
script/RFscan/GunEnergyScan.py Executable file → Normal file
View File

@@ -22,7 +22,7 @@ else:
stop = 95.0
step = 0.5
nb = 3
lat = 0.15
lat = 0.4
disp = -0.387
p0 = 7.1
plt = plot(None, title="Output")[0]
@@ -44,7 +44,8 @@ plt.setLegendVisible(True)
#Creating Phase positioner
if dry_run:
phase = Positioner("Gun Phase", "SINEG01-RSYS:SET-BEAM-PHASE-SIM", "SINEG01-RSYS:SET-BEAM-PHASE-SIM")
#phase = Positioner("Gun Phase", "SINEG01-RSYS:SET-BEAM-PHASE-SIM", "SINEG01-RSYS:SET-BEAM-PHASE-SIM")
phase = DummyPositioner("Gun Phase")
camera_name = "simulation"
else:
phase = Positioner("Gun Phase", "SINEG01-RSYS:SET-BEAM-PHASE", "SINEG01-RSYS:GET-BEAM-PHASE")
@@ -88,7 +89,7 @@ def after_sample(record, scan):
#The scan loop
try:
phase.write(start)
time.sleep(2.0)
time.sleep(1.0)
r = lscan(phase, [x_averager, dx_averager], start, stop, step , latency=lat, after_read = after_sample)
finally:
phase.write(phase0)
@@ -142,14 +143,11 @@ if do_elog:
title = "Gun Energy Scan"
Laser = str(caget("SLG-LGEN:WHICH_LASER"))
log_msg = "Data file: " + get_exec_pars().path + "\n\n"
log_msg = log_msg + "Laser: " + Laser + "\n"
if Laser == "Alcor":
log_msg = log_msg + "Bunch: " + Laser + "\n"
if Laser == "Bunch 1":
log_msg = log_msg + "Energy plate Alcor: %0.2f" % caget("SLAUV01-LATN100:MOT.RBV") + " deg \n"
elif Laser == "Jaguar":
log_msg = log_msg + "Energy plate Jaguar: %0.2f" % caget("SLJUV01-LATN100:MOT.RBV") + " deg \n"
elif Laser == "Both":
log_msg = log_msg + "Energy plate Alcor: %0.2f" % caget("SLAUV01-LATN100:MOT.RBV") + " deg \n"
log_msg = log_msg + "Energy plate Jaguar: %0.2f" % caget("SLJUV01-LATN100:MOT.RBV") + " deg \n"
elif Laser == "Bunch 2":
log_msg = log_msg + "Energy plate Mizar: %0.2f" % caget("SLMUV01-LATN100:MOT.RBV") + " deg \n"
if caget("SLAUV01-LAPT100:IRIS-POS-GET") == "IRIS":
log_msg = log_msg + "Collimator Alcor: IRIS %0.2f" % caget("SLAUV01-LAPT100:SIZE-GET") + " mm \n"
else:

32
script/RFscan/RfEnergyCalib.py Executable file → Normal file
View File

@@ -1,20 +1,38 @@
station = "S10CB09"
dE = 233.5# MeV
# single station calibration, dE is the desired energy gain (measured with bends: station on-station off)
# the scaling factors A,P are updated, the Acc voltage is set to dE, the V-Sum Amplitude and power should not change
station = "SINSB01"
dE = 77.25 # MeV
do_elog = True
# set RF on-delay
caput("SIN-TIMAST-TMA:Beam-RF-OnDelay-Sel", 1)
caput("SIN-TIMAST-TMA:Beam-Apply-Cmd.PROC", 1)
# scale RF calibration
A1 = caget(station + "-RSYS:SET-VSUM-AMPLT-SCALE") # MV/unit
P1 = caget(station + "-RSYS:SET-VOLT-POWER-SCALE") # MW/MV^2
VSA = caget(station + "-RSYS:GET-VSUM-AMPLT") # unit
PWR = caget(station + "-RSYS:GET-KLY-POWER-GATED") # MW
ACC1 = caget(station + "-RSYS:SET-ACC-VOLT") # MV
print(A1,P1,VSA,PWR,ACC1)
A2 = dE / VSA
P2 = PWR / dE**2
ACC2 = ACC1 * A2 / A1
ACC2 = dE
caput(station + "-RSYS:SET-VSUM-AMPLT-SCALE", A2)
caput(station + "-RSYS:SET-VOLT-POWER-SCALE", P2)
time.sleep(2.0)
caput(station + "-RSYS:SET-ACC-VOLT", ACC2)
print(A2,P2,ACC2)
time.sleep(2.0)
VSA = caget(station + "-RSYS:GET-VSUM-AMPLT") # unit
PWR = caget(station + "-RSYS:GET-KLY-POWER-GATED") # MW
print(A2,P2,VSA,PWR,ACC2)
#caget S30CB01-RSYS:{SET-VSUM-AMPLT-SCALE,SET-VOLT-POWER-SCALE,GET-VSUM-AMPLT,GET-KLY-POWER-GATED,SET-ACC-VOLT}
#Elog entry
if do_elog:
title = "Energy calibration" + station
log_msg = "Old energy gain: %0.2f" % ACC1 + " MeV/c\n"
log_msg = log_msg + "New energy gain: %0.2f" % ACC2 + " MeV/c\n\n"
log_msg = log_msg + " A1 A2 P1 P2 \n"
log_msg = log_msg + station + "%10.2f%10.2f%10.6f%10.6f" % (A1,A2,P1,P2) + " \n"
attachments = None
elog(title, log_msg)

57
script/RFscan/RfEnergyCalibGlobal.py Executable file → Normal file
View File

@@ -1,47 +1,60 @@
E1 = 1962.0 # old energy gain
E2 = 1950.0 # new energy gain
# 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
do_elog = True
#stationlist = ("SINSB01","SINSB02","SINSB03","SINSB04","SINXB01")
#stationlist = ("S10CB01","S10CB02","S10CB03","S10CB04","S10CB05","S10CB06","S10CB07","S10CB08","S10CB09")
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 = ("S10CB01","S10CB02","S10CB03","S10CB04","S10CB05","S10CB06","S10CB07","S10CB08","S10CB09")
do_VRF = True
VRFGAIN = "S10:SET-E-GAIN-OP"
#VRFGAIN = "S20:SET-E-GAIN-OP"
#VRFGAIN = "S30:SET-E-GAIN-OP"
# set RF on-delay
caput("SIN-TIMAST-TMA:Beam-RF-OnDelay-Sel", 1)
caput("SIN-TIMAST-TMA:Beam-Apply-Cmd.PROC", 1)
time.sleep(1.0)
# energy calibration
A1, A2 = {}, {}
P1, P2 = {}, {}
new_acc_volt = {}
A1, P1, VSA1, PWR1, ACC1 = {}, {}, {}, {}, {}
A2, P2, VSA2, PWR2, ACC2 = {}, {}, {}, {}, {}
for station in stationlist:
A = caget(station + "-RSYS:SET-VSUM-AMPLT-SCALE") # MV/unit
P = caget(station + "-RSYS:SET-VOLT-POWER-SCALE") # MW/MV^2
vsum_ampl = caget(station + "-RSYS:GET-VSUM-AMPLT") # unit
VSA = caget(station + "-RSYS:GET-VSUM-AMPLT") # unit
PWR = caget(station + "-RSYS:GET-KLY-POWER-GATED") # MW
ACC = caget(station + "-RSYS:SET-ACC-VOLT") # MV
A1[station] = A
A2[station] = A * E2 / E1
P1[station] = P
P2[station] = P * (E1 / E2)**2
new_acc_volt[station] = vsum_ampl * A2[station]
for station in stationlist:
VSA1[station] = VSA
PWR1[station] = PWR
ACC1[station] = ACC
A2[station] = A * dE2 / dE1
P2[station] = P * (dE1 / dE2)**2
ACC2[station] = ACC * dE2 / dE1
caput(station + "-RSYS:SET-VSUM-AMPLT-SCALE", A2[station])
caput(station + "-RSYS:SET-VOLT-POWER-SCALE", P2[station])
caput(station + "-RSYS:SET-ACC-VOLT", new_acc_volt[station])
# set RF on-beam
caput("SIN-TIMAST-TMA:Beam-RF-OnDelay-Sel", 0)
caput("SIN-TIMAST-TMA:Beam-Apply-Cmd.PROC", 1)
caput(station + "-RSYS:SET-ACC-VOLT", ACC2[station])
if do_VRF:
caput(VRFGAIN, dE2)
time.sleep(10.0)
for station in stationlist:
VSA = caget(station + "-RSYS:GET-VSUM-AMPLT") # unit
PWR = caget(station + "-RSYS:GET-KLY-POWER-GATED") # MW
VSA2[station] = VSA
PWR2[station] = PWR
#Elog entry
if do_elog:
title = "Energy calibration scaling"
log_msg = "Old energy gain: %0.2f" % E1 + " MeV/c\n"
log_msg = log_msg + "New energy gain: %0.2f" % E2 + " MeV/c\n\n"
log_msg = log_msg + " A1 A2 P1 P2 \n"
log_msg = "Old energy gain: %0.2f" % dE1 + " MeV/c\n"
log_msg = log_msg + "New energy gain: %0.2f" % dE2 + " MeV/c\n\n"
log_msg = log_msg + " AmpScale1 AmpScale2 PwrScale1 PwrScale2 Acc-Volt1 Acc-Volt2 VSA1 VSA2 Power1 Power2\n"
for station in stationlist:
log_msg = log_msg + station + "%10.2f%10.2f%10.6f%10.6f" % (A1[station],A2[station],P1[station],P2[station]) + " \n"
log_msg = log_msg + station + "%12.2f%12.2f%12.6f%12.6f%12.2f%12.2f%12.4f%12.4f%12.2f%12.2f" % (A1[station],A2[station],P1[station],P2[station],ACC1[station],ACC2[station],VSA1[station],VSA2[station],PWR1[station],PWR2[station]) + "\n"
attachments = None
elog(title, log_msg)

7
script/RFscan/SchottkyScan.py Executable file → Normal file
View File

@@ -12,6 +12,7 @@ if is_panel:
nb = int(args[3])
lat = args[4]
plt = args[5]
bunch = args[6]
else:
start = -10.0
stop = 150.0
@@ -19,6 +20,7 @@ else:
nb = 1
lat = 0.110 # lat is applied after each step (but not between samples)
plt = plot(None, title="Output")[0]
bunch = 1
#Plot setup
plt.clear()
@@ -26,7 +28,7 @@ plt.removeMarker(None)
plt.setStyle(plt.Style.ErrorY)
plt.addSeries(LinePlotErrorSeries("Charge", Color.red))
plt.getAxis(plt.AxisId.X).setLabel("Gun Beam Phase (deg)")
plt.getAxis(plt.AxisId.Y).setLabel("SINEG01-DICT215:B1_CHARGE (pC)")
plt.getAxis(plt.AxisId.Y).setLabel("Bunch Charge (pC)")
plt.setLegendVisible(True)
if dry_run:
@@ -38,7 +40,7 @@ if dry_run:
else:
bph = Positioner("Beam phase", "SINEG01-RSYS:SET-BEAM-PHASE", "SINEG01-RSYS:GET-BEAM-PHASE")
rph = ChannelDouble("RF phase", "SINEG01-RSYS:SET-VSUM-PHASE")
q = ChannelDouble("Charge", "SINEG01-DICT215:B1_CHARGE")
q = ChannelDouble("Charge", "SINEG01-DICT215:B" + str(bunch) + "_CHARGE")
q.initialize()
q.monitored=True
@@ -49,6 +51,7 @@ bph.config.resolution = 0.5 # set and get have to be within resolution
bph.config.rotation = True # will go back to zero if > 360 deg
bph.config.save()
bph.initialize()
bph.update()
bph0 = bph.read() % 360.0
rph.initialize()
rph.monitored=True

View File

@@ -0,0 +1,13 @@
# TDS calibration from phase jitter, to be completed...
run('Tools/CameraCorrelation')
start_camera_correlation("SATMA02-RLLE-DSP:PHASE-VS",
"SATBD02-DSCR050_sp1 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)

View File

@@ -11,11 +11,15 @@ if is_panel:
bpm_ch = args[1]
bpm_field = args[2]
else:
#station = "SATCB01"
#bpm_ch = "SATBD02-DBPM010"
station = "STEST01"
bpm_ch = "SINBC02-DBPM140"
bpm_field = "X1"
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"
start = caget(station + "-RSYS:SET-SCAN-START")
stop = caget(station + "-RSYS:SET-SCAN-STOP")
step = caget(station + "-RSYS:SET-SCAN-STEP")
@@ -78,7 +82,7 @@ def after(rec):
#scan and plot
try:
phase.write(start)
time.sleep(2.0)
time.sleep(5.0)
x_averager = create_averager(x, nb, lat)
r = lscan(phase, x_averager, start, stop, step, latency=lat, after_read = after)
rf_phase = r.getPositions(0)

7
script/RFscan/setRFphaseGlobal.py Executable file → Normal file
View File

@@ -1,3 +1,4 @@
# change V-sum offset base globally (for example to compensate a laser delay change), dph is the desired phase shift
dph = 34.0
stationlist0 = ("SINSB01","SINSB02","SINSB03","SINSB04","SINXB01")
@@ -9,9 +10,9 @@ stationlist = stationlist1 + stationlist2 + stationlist3
Ph = {}
for station in stationlist:
ph0 = caget(station + "-RSYS:SET-VSUM-PHASE-OFFSET-BASE") # deg
Ph[station] = ph0 - dph
Ph[station] = (ph0 - dph) % 360
for station in stationlist:
#caput(station + "-RSYS:SET-VSUM-PHASE-OFFSET-BASE", Ph[station])
print(Ph[station])
caput(station + "-RSYS:SET-VSUM-PHASE-OFFSET-BASE", Ph[station])
print(station + "-RSYS:SET-VSUM-PHASE-OFFSET-BASE", Ph[station])

6
script/RFscan/setRFscanRange.py Executable file → Normal file
View File

@@ -1,11 +1,11 @@
scan_range = 80.0
# set scan parameters globally for the qt phasing tool
scan_range = 100.0
nb_steps = 21
#stationlist = ("SINSB01","SINSB02","SINSB03","SINSB04","SINXB01")
#stationlist = ("S10CB01","S10CB02","S10CB03","S10CB04","S10CB05","S10CB06","S10CB07","S10CB08","S10CB09")
#stationlist = ("S20CB01","S20CB02","S20CB03","S20CB04")
stationlist = ("S20CB01","S20CB02","S20CB03","S20CB04","S30CB01","S30CB02","S30CB03","S30CB04","S30CB05","S30CB06","S30CB07","S30CB08","S30CB09","S30CB10","S30CB11","S30CB12","S30CB13")
stationlist = ("S30CB01","S30CB02","S30CB03","S30CB04","S30CB05","S30CB06","S30CB07","S30CB08","S30CB09","S30CB10","S30CB11","S30CB12","S30CB13")
P1, P2 = {}, {}
for station in stationlist:

View File

@@ -0,0 +1,8 @@
MO_FREQ = 142.8e6 # MO = 142.8 MHz
rf_period = 1 / MO_FREQ / 21 / 1e-12 # ps
delay = caget("SLGOS01-TSPL-ALC:NEW_DELTA_T")
delay = delay + rf_period
print("SLGOS01-TSPL-ALC:NEW_DELTA_T", delay)
print("SLGOS01-TSPL-ALC:SET_NEW_PHASE.PROC", 1)
caput("SLGOS01-TSPL-ALC:NEW_DELTA_T", delay)
caput("SLGOS01-TSPL-ALC:SET_NEW_PHASE.PROC", 1)

View File

@@ -0,0 +1,8 @@
MO_FREQ = 142.8e6 # MO = 142.8 MHz
rf_period = 1 / MO_FREQ / 21 / 1e-12 # ps
delay = caget("SLGOS01-TSPL-ALC:NEW_DELTA_T")
delay = delay - rf_period
print("SLGOS01-TSPL-ALC:NEW_DELTA_T", delay)
print("SLGOS01-TSPL-ALC:SET_NEW_PHASE.PROC", 1)
caput("SLGOS01-TSPL-ALC:NEW_DELTA_T", delay)
caput("SLGOS01-TSPL-ALC:SET_NEW_PHASE.PROC", 1)

View File

@@ -0,0 +1,8 @@
MO_FREQ = 142.8e6 # MO = 142.8 MHz
rf_period = 1 / MO_FREQ / 21 / 1e-12 # ps
delay = caget("SLGOS01-TSPL-MIZ:NEW_DELTA_T")
delay = delay + rf_period
print("SLGOS01-TSPL-MIZ:NEW_DELTA_T", delay)
print("SLGOS01-TSPL-MIZ:SET_NEW_PHASE.PROC", 1)
caput("SLGOS01-TSPL-MIZ:NEW_DELTA_T", delay)
caput("SLGOS01-TSPL-MIZ:SET_NEW_PHASE.PROC", 1)

View File

@@ -0,0 +1,8 @@
MO_FREQ = 142.8e6 # MO = 142.8 MHz
rf_period = 1 / MO_FREQ / 21 / 1e-12 # ps
delay = caget("SLGOS01-TSPL-MIZ:NEW_DELTA_T")
delay = delay - rf_period
print("SLGOS01-TSPL-MIZ:NEW_DELTA_T", delay)
print("SLGOS01-TSPL-MIZ:SET_NEW_PHASE.PROC", 1)
caput("SLGOS01-TSPL-MIZ:NEW_DELTA_T", delay)
caput("SLGOS01-TSPL-MIZ:SET_NEW_PHASE.PROC", 1)

View File

@@ -0,0 +1,29 @@
#Parameters
is_panel = get_exec_pars().source != CommandSource.ui # run from panel
if is_panel:
tds = args[0]
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)
# beam stopper and coll.
if tds == "SINDI01":
caput("S10CB01-RSYS:REQUIRED-OP", 0)
caput("S10CB02-RSYS:REQUIRED-OP", 0)
caput("S10DI01-MBND100:P-SET", 297.0)
if tds == "S30CB14":
caput("SARMA02-MBNP100:REQUEST", 1)
#caput("SARCL01-DCOL030:GAP", 5.0)
caput("SARCL02-VCOL290:GAP", 8.0)
# set optics
quads = tds_data[tds]["quads"]
k1l = tds_data[tds]["K1L-meas"]
for i in range(len(quads)):
caput(quads[i] + ":K1L-SET", k1l[i])

View File

@@ -0,0 +1,26 @@
#Parameters
is_panel = get_exec_pars().source != CommandSource.ui # run from panel
if is_panel:
tds = args[0]
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)
# beam stopper and coll.
if tds == "S30CB14":
#caput("SARCL01-DCOL030:GAP", 5.0)
caput("SARCL02-VCOL290:GAP", 5.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])
# show message: restore optics and coll.

View File

@@ -0,0 +1,261 @@
import ch.psi.pshell.epics.Positioner as Positioner
from mathutils import fit_polynomial
#Parameters
dry_run = False
do_elog = True
USE_SCREEN_PANEL = True
MO_FREQ = 142.8e6 # MO = 142.8 MHz
is_panel = get_exec_pars().source != CommandSource.ui # run from panel
if is_panel:
start = args[0]
stop = args[1] + 0.001 # needed to get the last point
step = args[2]
nb = int(args[3])
lat = args[4]
thr = args[5]
tds = args[6]
bunch = args[7]
plt11 = args[8]
plt12 = args[9]
plt21 = args[10]
plt22 = args[11]
else:
start = -0.1
stop = 0.1 + 0.001
step = 0.05
nb = 5
lat = 2.0
thr = 250
tds = "S30CB14"
bunch = "Bunch1"
plt11 = plot(None, title="Output")[0]
plt12 = plot(None, title="Output")[0]
plt21 = plot(None, title="Output")[0]
plt22 = plot(None, title="Output")[0]
run("Tools/BunchLengthTDSdata.py")
#Record callback: update of output plot
def update_plot(record, scan, plt):
com_mean, com_stdev = record[0].mean, record[0].stdev
rms_mean, rms_stdev = record[1].mean, record[1].stdev
fw_mean, fw_stdev = record[2].mean, record[2].stdev
fit_mean, fit_stdev = record[3].mean, record[3].stdev
phase = record.positions[0]
plt.getSeries(0).appendData(phase, com_mean, com_stdev)
plt.getSeries(1).appendData(phase, rms_mean, rms_stdev)
plt.getSeries(2).appendData(phase, fw_mean, fw_stdev)
plt.getSeries(3).appendData(phase, fit_mean, fit_stdev)
def update_plot_1(record, scan):
global plt11
update_plot(record, scan, plt11)
def update_plot_2(record, scan):
global plt12
update_plot(record, scan, plt12)
#Plot setup
def init_plots(plt1, plt2):
plt1.clear()
plt1.removeMarker(None)
plt1.setStyle(plt1.Style.ErrorY)
plt1.addSeries(LinePlotErrorSeries("Bunch center of mass", Color.red))
plt1.addSeries(LinePlotErrorSeries("Bunch length rms", Color.yellow, 2))
plt1.addSeries(LinePlotErrorSeries("Bunch length fw", Color.green, 2))
plt1.addSeries(LinePlotErrorSeries("Bunch length gauss fit", Color.blue, 2))
plt1.getAxis(plt1.AxisId.X).setLabel("TDS Phase (deg)")
plt1.getAxis(plt1.AxisId.Y).setLabel("Bunch center of mass (um)")
plt1.getAxis(plt1.AxisId.Y2).setLabel("Bunch length (um)")
plt1.setLegendVisible(True)
plt2.clear()
plt2.removeMarker(None)
plt2.setStyle(plt2.Style.Normal)
plt2.getAxis(plt2.AxisId.X).setLabel("Time (fs)")
plt2.getAxis(plt2.AxisId.Y).setLabel("Current (kA)")
plt2.setLegendVisible(False)
init_plots(plt11, plt21)
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"]
phase.config.minValue = -90.0
phase.config.maxValue = 270.0
phase.config.precision = 4
phase.config.resolution = 0.05
phase.config.rotation = True
phase.config.save()
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.setThreshold(thr)
cam_server.setBackgroundSubtraction(False)
cam_server.setGoodRegion(0.1, 3.0)
print "Waiting for y_fw and y_fit"
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):
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")
#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)
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]
phase.write(start)
time.sleep(1.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)
r2 = lscan(phase, sensor_list, start, stop, step , latency=lat, after_read = update_plot_2)
finally:
phase.write(phase0)
phase.close()
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)
else:
caput(blm[i] + strg, 1)
#output
def write_output(r, plt):
phase_pos = r.getPositions(0)
rf_period = 1 / MO_FREQ / tds_data[tds]["harm"]
time_pos = [val / 360.0 * rf_period * 1e15 for val in phase_pos] # in fs
bunch_center = [val.mean for val in r.getReadable(0)]
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
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_fs = []
profiles_kA = []
for i in range(len(r[y_axis])):
delta_um = profiles_com[i] - com
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]))
profiles_kA.append([val / total_dig * bunch_charge / step_fs for val in profiles_dig[i]]) # pC / fs = kA
for i in range(len(profiles_um)):
plt.addSeries(LinePlotSeries("Bunch current " + str(i), Color.red))
plt.getSeries(i).setData(profiles_fs[i], profiles_kA[i])
return bunch_length_rms_average, bunch_length_fw_average, bunch_length_fit_average, calib
bunch_length_rms_average1, bunch_length_fw_average1, bunch_length_fit_average1, calib1 = write_output(r1, plt21)
bunch_length_rms_average2, bunch_length_fw_average2, bunch_length_fit_average2, calib2 = write_output(r2, plt22)
bunch_length_rms = (bunch_length_rms_average1 + bunch_length_rms_average2) / 2
bunch_length_fw = (bunch_length_fw_average1 + bunch_length_fw_average2) / 2
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)
#Elog entry
if do_elog:
if get_option("Generated data file:\n" + get_exec_pars().path +"\n\n" + "Save to ELOG?", "YesNo") == "Yes":
title = "Bunch length Scan"
log_msg = "Data file: " + get_exec_pars().path + "\n\n"
log_msg = log_msg + "TDS: " + tds + "\n"
log_msg = log_msg + "Bunch: " + bunch + "\n\n"
log_msg = log_msg + "#### 0 deg ####\n"
log_msg = log_msg + "Bunch length rms: %0.1f" % bunch_length_rms_average1 + " fs\n"
log_msg = log_msg + "Bunch length fw: %0.1f" % bunch_length_fw_average1 + " fs\n"
log_msg = log_msg + "Bunch length fit: %0.1f" % bunch_length_fit_average1 + " fs\n"
log_msg = log_msg + "Calibration: %0.4f" % calib1 + " fs/um\n\n"
log_msg = log_msg + "#### 180 deg ####\n"
log_msg = log_msg + "Bunch length rms: %0.1f" % bunch_length_rms_average2 + " fs\n"
log_msg = log_msg + "Bunch length fw: %0.1f" % bunch_length_fw_average2 + " fs\n"
log_msg = log_msg + "Bunch length fit: %0.1f" % bunch_length_fit_average2 + " fs\n"
log_msg = log_msg + "Calibration: %0.4f" % calib2 + " fs/um\n\n"
log_msg = log_msg + "#### mean ####\n"
log_msg = log_msg + "Bunch length rms: %0.1f" % bunch_length_rms + " fs\n"
log_msg = log_msg + "Bunch length fw: %0.1f" % bunch_length_fw + " fs\n"
log_msg = log_msg + "Bunch length fit: %0.1f" % bunch_length_fit + " fs\n"
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")
file_name2 = os.path.abspath(get_context().setup.getContextPath() + "/BunchLengthCurrent1.png")
plt21.saveSnapshot(file_name2, "png")
file_name3 = os.path.abspath(get_context().setup.getContextPath() + "/BunchLengthScanPlot2.png")
plt12.saveSnapshot(file_name3, "png")
file_name4 = os.path.abspath(get_context().setup.getContextPath() + "/BunchLengthCurrent2.png")
plt22.saveSnapshot(file_name4, "png")
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,
bunch_length_rms_average2, bunch_length_fw_average2, bunch_length_fit_average2, calib2,
bunch_length_rms, bunch_length_fw, bunch_length_fit, calib])

View File

@@ -0,0 +1,47 @@
#tds config
tds_data = {'SINDI01': {"harm": 21, "screen": "SINDI02-DSCR075",
"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",
"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",
"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",
"quads":
["SATBD01-MQUA010", "SATBD01-MQUA030", "SATBD01-MQUA050",
"SATBD01-MQUA070", "SATBD01-MQUA090"],
"K1L-nom":
[ 0.150000, -0.185000, 0.040000,
0.140000, -0.225000],
"K1L-meas":
[-0.090111, 0.108271, 0.025250,
-0.072006, -0.382500],
"BLM": []}}

View File

@@ -0,0 +1,119 @@
import math
import sys, traceback
from mathutils import fit_polynomial, PolynomialFunction
from plotutils import plot_line, plot_function
from ch.psi.pshell.swing.Shell import getColorStdout
import org.apache.commons.math3.stat.correlation.PearsonsCorrelation as PearsonsCorrelation
import ch.psi.pshell.bs.StreamMerger as StreamMerger
_stop_exec = False
_task = None
_dispatcher_stream = None
def start_camera_correlation(dispatcer_channel, camera_channel, samples=50, modulo=1, offset=0, plt=None):
global _stop_exec, _task, _dispatcher_stream
stop_camera_correlation()
if plt:
for s in plt.getAllSeries():
plt.removeSeries(s)
class LinearFit(ReadonlyAsyncRegisterBase, ReadonlyRegisterArray):
def getSize(self):
return 2
def set(self, pars):
self.onReadout(to_array(pars, 'd'))
class Correlation(ReadonlyAsyncRegisterBase):
def set(self, val):
self.onReadout(val)
add_device(LinearFit("linear_fit"), True)
add_device(Correlation("correlation"), True)
try:
_dispatcher_stream = Stream("corr_stream", dispatcher)
_dispatcher_stream.addScalar(dispatcer_channel, dispatcer_channel, modulo, offset)
_dispatcher_stream.initialize()
_dispatcher_stream.start(True)
_dispatcher_stream.setBufferCapacity(500)
camera_name, camera_channel = camera_channel.split(" ")
shared = camera_name.endswith("_sp1")
cam_server.start(camera_name, shared )
camera_stream = cam_server.stream
camera_stream.setBufferCapacity(500)
camera_stream.waitCacheChange(10000);
def merger_task():
merger = StreamMerger("stream", _dispatcher_stream, camera_stream)
try:
if plt:
sd = LinePlotSeries("Data")
plt.addSeries(sd)
sd.setLinesVisible(False)
sd.setPointSize(4)
else:
ax,ay = [],[]
merger.monitored=True
merger.start()
merger.waitCacheChange(5000)
dx=merger.getChild(dispatcer_channel)
dy=merger.getChild(camera_channel)
while(not _stop_exec):
merger.waitCacheChange(10000)
x=dx.read()
y=dy.read()
if plt:
sd.appendData(x, y)
while len(sd.x) > samples:
sd.token.remove(0) #Remove First Element
ax,ay = sd.x,sd.y
else:
ax.append(x); ay.append(y)
while len(ax) > samples:
ax.pop(0); ay.pop(0)
if len(ax)>2:
x1, x2 = min(ax), max(ax)
if x1!=x2:
#Display correlation
corr= PearsonsCorrelation().correlation(to_array(ax,'d'), to_array(ay,'d'))
correlation.set(corr)
pars_lin = (a0,a1) = fit_polynomial(ay, ax, 1)
linear_fit.set(pars_lin)
y1,y2 = poly(x1, pars_lin), poly(x2, pars_lin)
if plt:
invoke((plot_line,(plt, x1, y1, x2, y2, 2, Color.BLUE, "Fit Linear")), False)
finally:
merger.close()
_task = fork(merger_task)
except:
stop_camera_correlation()
raise
def stop_camera_correlation():
global _stop_exec, _task, _dispatcher_stream
_stop_exec = True
if _task:
join(_task)
cam_server.stop()
if _dispatcher_stream:
_dispatcher_stream.close()
_stop_exec = False
_task = None
_dispatcher_stream = None
#Testing
start_camera_correlation("SINEG01-DICT215:B1_CHARGE", "SATES31-CAMS187-RIXS1_sp1 intensity", samples = 40, plt=plot(None)[0])
try:
time.sleep(10.0)
finally:
stop_camera_correlation()

View File

@@ -0,0 +1,15 @@
#Parameters
is_panel = get_exec_pars().source != CommandSource.ui # run from panel
if is_panel:
tds = args[0]
phase = args[1]
else:
tds = "S30CB14"
phase = 0.0
# set beam phase offset
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)

View File

@@ -0,0 +1,15 @@
print "Connecting to camera: " + str(CAMERA)
CAMERA_URL = caget(CAMERA + ":BSREADCONFIG").replace("tcp://daq", "tcp://")
print "Url: " + str(CAMERA_URL)
st1 = Stream("st1", CAMERA_URL, SocketType.PULL)
st1.initialize()
st1.start()
st1.waitCacheChange(3000)
try:
r=bscan (st1, records=10, timeout =10.0, save=False, enabled_plots=[st1,])
v= st1.getValues()
finally:
st1.close()

View File

@@ -0,0 +1,45 @@
import requests
import json
dispatcher_url = "https://dispatcher-api.psi.ch/sf"
def get_dispatcher(path):
response = requests.get(url=dispatcher_url+path)
if response.status_code != 200:
raise Exception(response.text)
return json.loads(response.text)
def post_dispatcher(path, data):
response = requests.post(url=dispatcher_url+path, json=data)
if response.status_code != 200:
raise Exception(response.text)
return json.loads(response.text)
def get_dispatcher_info(regex):
return post_dispatcher("/channels/live",{"regex": regex})[0]
def get_dispatcher_channels(regex):
return get_dispatcher_info(regex)["channels"]
def get_dispatcher_channel_info(channel_name):
return get_dispatcher_info(channel_name)["channels"][0]
def get_dispatcher_channel_modulo(channel_name):
return get_dispatcher_channel_info(channel_name)
def get_dispatcher_channel_modulo(channel_name):
return get_dispatcher_channel_info(channel_name).get("modulo", 1)
def get_dispatcher_channel_offset(channel_name):
return get_dispatcher_channel_info(channel_name).get("offset", 0)
def get_dispatcher_stream(channel_names):
channels = []
for channel_name in channel_names:
#info = get_dispatcher_channel_info(channel_name)
#channels.append({"name":channel_name,"backend":"sf-databuffer","modulo":info.get("modulo", 1), "offset":info.get("offset", 0)})
channels.append({"name":channel_name,"backend":"sf-databuffer","modulo":None, "offset":None})
return post_dispatcher("/stream",{"channels": channels})

1
script/Undulators/1DscanEarthField.py Executable file → Normal file
View File

@@ -1,6 +1,5 @@
import ch.psi.pshell.epics.ChannelDouble as ChannelDouble
A1 = ChannelDouble("Actuator1", "SARUN07-UIND030:I-SET")
#S1 = ChannelDouble("Sensor1", "SARFE10-PBPG050:PHOTON-ENERGY-PER-PULSE-US")
S1 = ChannelDouble("Sensor1", "SARFE10-PBPG050:HAMP-INTENSITY-CAL")
A1.initialize()
S1.initialize()

View File

@@ -1,14 +1,18 @@
import ch.psi.pshell.epics.ChannelDouble as ChannelDouble
A1 = ChannelDouble("K value", "SARUN15-UIND030:K_SET")
S1 = ChannelDouble("Energy per pulse (uJ)", "SARFE10-PBPG050:PHOTON-ENERGY-PER-PULSE-US")
import ch.psi.pshell.epics.ChannelDouble as ChannelDouble
from mathutils import fit_polynomial, PolynomialFunction
A1 = ChannelDouble("K value", "SARUN08-UIND030:K_SET")
#S1 = ChannelDouble("Energy per pulse (uJ)", "SARFE10-PBPG050:PHOTON-ENERGY-PER-PULSE-US")
#S1 = ChannelDouble("Energy per pulse (uJ)", "SARFE10-PBPG050:HAMP-INTENSITY-CAL")
S1 = ChannelDouble("Hamp RAW", "SARFE10-PBIG050-EVR0:CALCI")
A1.initialize()
S1.initialize()
A1_init = A1.read()
A1i = A1_init - 0.005
A1f = A1_init + 0.005
nstep = 21
lat = 1.0
nav = 5
nstep = 10
lat = 0.01
nav = 100
wait = 3
plt = plot(None, title="Output")[0]
plt.clear()
plt.setStyle(plt.Style.ErrorY)
@@ -20,7 +24,7 @@ def after_sample(record, scan):
try:
S1_averager = create_averager(S1, nav, lat)
A1.write(A1i)
time.sleep(30.0)
time.sleep(wait)
r = lscan(A1, (S1_averager), A1i, A1f, nstep, latency=5.0, after_read = after_sample)
Act1 = r.getPositions(0)
S1mean = [val.mean for val in r.getReadable(0)]
@@ -29,3 +33,15 @@ finally:
A1.write(A1_init)
A1.close()
S1.close()
## add fitting:
pars_polynomial = fit_polynomial(S1mean, Act1, 3)
p1 = PolynomialFunction(pars_polynomial)
resolution = (A1f - A1i)/100
fit_polinomial = []
for x in frange(A1i, A1f, resolution, True):
fit_polinomial.append(p1.value(x))
x = frange(A1i, A1f+resolution, resolution)
#plot(x, fit_polinomial)
plots = plot([S1mean, fit_polinomial] ,
["data", "polinomial"], xdata = [Act1,x], title="Data")

View File

@@ -0,0 +1,28 @@
import ch.psi.pshell.epics.ChannelDouble as ChannelDouble
A1 = ChannelDouble("Phase (deg.)", "SARUN10-UPHS060:PHI_SET")
S1 = ChannelDouble("energy per pulse (uJ)", "SARFE10-PBIG050-EVR0:CALCI")
A1.initialize()
S1.initialize()
A1_init = A1.read()
A1i = 0.
A1f = 360.
nstep = 20
lat = 1.
nav = 10
plt = plot(None, title="Output")[0]
plt.clear()
plt.setStyle(plt.Style.ErrorY)
plt.addSeries(LinePlotErrorSeries("Sensor1", Color.red))
def after_sample(record, scan):
plt.getSeries(0).appendData(record.positions[0], record.readables[0].mean, record.readables[0].stdev)
try:
S1_averager = create_averager(S1, nav, lat)
r = lscan(A1, S1_averager, A1i, A1f, nstep, latency=2.0, after_read = after_sample)
Act1 = r.getPositions(0)
S1mean = [val.mean for val in r.getReadable(0)]
S1rms = [val.stdev for val in r.getReadable(0)]
finally:
A1.write(A1_init)
A1.close()
S1.close()

View File

@@ -0,0 +1,23 @@
udlylist = ("SATUN06","SATUN07","SATUN08","SATUN09","SATUN10",
"SATUN11","SATUN12","SATUN13","SATUN15","SATUN16",
"SATUN17","SATUN18","SATUN19","SATUN20","SATUN21")
#for udly in udlylist: caputq(udly + "-UDLY060:OFF-OP", caget(udly + "-CHIC:OFFSET"))
#for udly in udlylist: caputq(udly + "-UDLY060:DEL-OP", caget(udly + "-CHIC:DELAY"))
#for udly in udlylist: caputq(udly + "-UDLY060:PH-SHIFT-OP", caget(udly + "-CHIC:PHASE"))
#for udly in udlylist: caputq(udly + "-UDLY060:GAP-U-SET-OP", caget(udly + "-CHIC:G1"))
#for udly in udlylist: caputq(udly + "-UDLY060:GAP-D-SET-OP", caget(udly + "-CHIC:G2"))
#for udly in udlylist: caputq(udly + "-UDLY060:GAP-U-SET-OP", caget(udly + "-UDLY060:GAP-U-SET"))
#for udly in udlylist: caputq(udly + "-UDLY060:GAP-D-SET-OP", caget(udly + "-UDLY060:GAP-D-SET"))
#for udly in udlylist: caputq(udly + "-UDLY060:OFF-OP", 0.0)
#for udly in udlylist: caputq(udly + "-UDLY060:DEL-OP", 0.600)
#for udly in udlylist: caputq(udly + "-UDLY060:GAP-U-SET", 75)
#for udly in udlylist: caputq(udly + "-UDLY060:GAP-D-SET", 75)
for udly in udlylist: caputq(udly + "-UDLY060:PH-SHIFT-OP", 0.0)
#for udly in udlylist: caputq(udly + "-CHIC:OFFSET", 50.0)
#for udly in udlylist: caputq(udly + "-CHIC:DELAY", 0.600)
#for udly in udlylist: caputq(udly + "-CHIC:G1", 32)
#for udly in udlylist: caputq(udly + "-CHIC:G2", 28)
#for udly in udlylist: caputq(udly + "-CHIC:PHASE", 0.0)

View File

@@ -0,0 +1,22 @@
udlylist = ("SATUN06","SATUN07","SATUN08","SATUN09","SATUN10",
"SATUN11","SATUN12","SATUN13","SATUN15","SATUN16",
"SATUN17","SATUN18","SATUN19","SATUN20","SATUN21")
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: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: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"))
#caputq("SATCB01:ENE-FILT-OP-SIMU", caget("SATCB01:ENE-FILT-OP"))

View File

@@ -0,0 +1,65 @@
caputq("SATUN06-UDLY060:GAP-U-SET-SIMU", 45.5284121698225)
caputq("SATUN06-UDLY060:GAP-D-SET-SIMU", 45.7245793466707)
caputq("SATUN07-UDLY060:GAP-U-SET-SIMU", 45.6122875866939)
caputq("SATUN07-UDLY060:GAP-D-SET-SIMU", 45.5495116792557)
caputq("SATUN08-UDLY060:GAP-U-SET-SIMU", 45.0316550113184)
caputq("SATUN08-UDLY060:GAP-D-SET-SIMU", 45.0726322443132)
caputq("SATUN09-UDLY060:GAP-U-SET-SIMU", 45.1859352796807)
caputq("SATUN09-UDLY060:GAP-D-SET-SIMU", 45.2128432714865)
caputq("SATUN10-UDLY060:GAP-U-SET-SIMU", 46.7937047025798)
caputq("SATUN10-UDLY060:GAP-D-SET-SIMU", 46.7513031527526)
caputq("SATUN11-UDLY060:GAP-U-SET-SIMU", 52.9447733636882)
caputq("SATUN11-UDLY060:GAP-D-SET-SIMU", 53.5729790819476)
caputq("SATUN12-UDLY060:GAP-U-SET-SIMU", 53.7916892349295)
caputq("SATUN12-UDLY060:GAP-D-SET-SIMU", 53.8300506580993)
caputq("SATUN13-UDLY060:GAP-U-SET-SIMU", 50.4352560592426)
caputq("SATUN13-UDLY060:GAP-D-SET-SIMU", 50.4669477318729)
caputq("SATUN15-UDLY060:GAP-U-SET-SIMU", 64.6414630104251)
caputq("SATUN15-UDLY060:GAP-D-SET-SIMU", 64.6278536657919)
caputq("SATUN16-UDLY060:GAP-U-SET-SIMU", 70.4210617446455)
caputq("SATUN16-UDLY060:GAP-D-SET-SIMU", 70.4253663428239)
caputq("SATUN17-UDLY060:GAP-U-SET-SIMU", 72.8843248347666)
caputq("SATUN17-UDLY060:GAP-D-SET-SIMU", 72.8889551373701)
caputq("SATUN18-UDLY060:GAP-U-SET-SIMU", 68.716248761714)
caputq("SATUN18-UDLY060:GAP-D-SET-SIMU", 68.7308510402703)
caputq("SATUN19-UDLY060:GAP-U-SET-SIMU", 73.4248071668705)
caputq("SATUN19-UDLY060:GAP-D-SET-SIMU", 73.414136218251)
caputq("SATUN20-UDLY060:GAP-U-SET-SIMU", 71.6780919568848)
caputq("SATUN20-UDLY060:GAP-D-SET-SIMU", 71.5809359122368)
caputq("SATUN21-UDLY060:GAP-U-SET-SIMU", 69.6290129308302)
caputq("SATUN21-UDLY060:GAP-D-SET-SIMU", 69.4142627102515)
caputq("SATUN06-UIND030:K_SET_SIMU", 1.51136800800815)
caputq("SATUN07-UIND030:K_SET_SIMU", 2.02084710399842)
caputq("SATUN08-UIND030:K_SET_SIMU", 1.53640591569033)
caputq("SATUN09-UIND030:K_SET_SIMU", 2.54178242706297)
caputq("SATUN10-UIND030:K_SET_SIMU", 2.54185323315769)
caputq("SATUN11-UIND030:K_SET_SIMU", 2.54186507638525)
caputq("SATUN12-UIND030:K_SET_SIMU", 2.54190460717311)
caputq("SATUN13-UIND030:K_SET_SIMU", 2.5418814596268)
caputq("SATUN15-UIND030:K_SET_SIMU", 2.54190138849029)
caputq("SATUN16-UIND030:K_SET_SIMU", 2.54186507638525)
caputq("SATUN17-UIND030:K_SET_SIMU", 2.54190460717311)
caputq("SATUN18-UIND030:K_SET_SIMU", 2.54190138849029)
caputq("SATUN19-UIND030:K_SET_SIMU", 2.54186507638525)
caputq("SATUN20-UIND030:K_SET_SIMU", 2.54186507638525)
caputq("SATUN21-UIND030:K_SET_SIMU", 2.54186507638525)
caputq("SATUN22-UIND030:K_SET_SIMU", 2.54182934195365)
caputq("SATUN06-UDLY060:PH-SHIFT-OP-SIMU", -14.0)
caputq("SATUN07-UDLY060:PH-SHIFT-OP-SIMU", -108.5)
caputq("SATUN08-UDLY060:PH-SHIFT-OP-SIMU", 101.0)
caputq("SATUN09-UDLY060:PH-SHIFT-OP-SIMU", -58.0)
caputq("SATUN10-UDLY060:PH-SHIFT-OP-SIMU", 158.0)
caputq("SATUN11-UDLY060:PH-SHIFT-OP-SIMU", -129.5)
caputq("SATUN12-UDLY060:PH-SHIFT-OP-SIMU", -48.5)
caputq("SATUN13-UDLY060:PH-SHIFT-OP-SIMU", 180.0)
caputq("SATUN15-UDLY060:PH-SHIFT-OP-SIMU", -12.8)
caputq("SATUN16-UDLY060:PH-SHIFT-OP-SIMU", 47.7)
caputq("SATUN17-UDLY060:PH-SHIFT-OP-SIMU", -9.0)
caputq("SATUN18-UDLY060:PH-SHIFT-OP-SIMU", 28.0)
caputq("SATUN19-UDLY060:PH-SHIFT-OP-SIMU", 14.1)
caputq("SATUN20-UDLY060:PH-SHIFT-OP-SIMU", -119.4)
caputq("SATUN21-UDLY060:PH-SHIFT-OP-SIMU", 112.5)

View File

@@ -0,0 +1,16 @@
caputq("SATUN06-UIND030:K_SET_SIMU", 2.04088453330036)
caputq("SATUN07-UIND030:K_SET_SIMU", 2.59901953158514)
caputq("SATUN08-UIND030:K_SET_SIMU", 2.06761290521536)
caputq("SATUN09-UIND030:K_SET_SIMU", 3.18987112455146)
caputq("SATUN10-UIND030:K_SET_SIMU", 3.18995231615947)
caputq("SATUN11-UIND030:K_SET_SIMU", 3.18996589651639)
caputq("SATUN12-UIND030:K_SET_SIMU", 3.19001122560207)
caputq("SATUN13-UIND030:K_SET_SIMU", 3.18998468281204)
caputq("SATUN15-UIND030:K_SET_SIMU", 3.19000753480694)
caputq("SATUN16-UIND030:K_SET_SIMU", 3.18996589651639)
caputq("SATUN17-UIND030:K_SET_SIMU", 3.19001122560207)
caputq("SATUN18-UIND030:K_SET_SIMU", 3.19000753480694)
caputq("SATUN19-UIND030:K_SET_SIMU", 3.18996589651639)
caputq("SATUN20-UIND030:K_SET_SIMU", 3.18996589651639)
caputq("SATUN21-UIND030:K_SET_SIMU", 3.18996589651639)
caputq("SATUN22-UIND030:K_SET_SIMU", 3.18992492068136)

3
script/Undulators/K-calc_AR.py Executable file → Normal file
View File

@@ -3,7 +3,8 @@ Eph2 = 2.425 # desired photon energy in keV. Don't forget .0 at the end!!
do_elog = True
undlist = ("SARUN03","SARUN04","SARUN05","SARUN06","SARUN07","SARUN08","SARUN09","SARUN10","SARUN11","SARUN12","SARUN13","SARUN14","SARUN15")
undlist = ("SARUN03","SARUN04","SARUN05","SARUN06","SARUN07","SARUN08","SARUN09",
"SARUN10","SARUN11","SARUN12","SARUN13","SARUN14","SARUN15")
K1, K2 = {}, {}
for und in undlist:

3
script/Undulators/K-calc_AT.py Executable file → Normal file
View File

@@ -3,7 +3,8 @@ Eph2 = 0.710 # desired photon energy in keV. Don't forget .0 at the end!!
do_elog = False
undlist = ("SATUN06", "SATUN07", "SATUN08","SATUN09","SATUN10","SATUN11","SATUN12","SATUN13","SATUN15","SATUN16","SATUN17","SATUN18","SATUN19","SATUN20","SATUN21","SATUN22")
undlist = ("SATUN06","SATUN07","SATUN08","SATUN09","SATUN10","SATUN11","SATUN12","SATUN13",
"SATUN15","SATUN16","SATUN17","SATUN18","SATUN19","SATUN20","SATUN21","SATUN22")
K1, K2 = {}, {}
for und in undlist:

View File

@@ -0,0 +1,20 @@
from random import random
undlist = ("SARUN03","SARUN04","SARUN05","SARUN06","SARUN07","SARUN08","SARUN09",
"SARUN10","SARUN11","SARUN12","SARUN13","SARUN14","SARUN15")
i = 0
for und in undlist:
K_taper = (-1)**i * 0.25 + random() * 0.050 - 0.025
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
if K + K_taper < K_min:
K_taper = K_min - K + random() * 0.025
print(K, K_taper, K + K_taper)
caputq(und + "-UIND030:K_TAPER_SET", K_taper)
set_return("Success")

10
script/Undulators/K_AR_scale.py Executable file → Normal file
View File

@@ -3,9 +3,11 @@ Eph1 = caget("SARUN:FELPHOTENE")
Eph2 = Eph1 + dEph
do_elog = True
#do_elog = True
do_elog = False
undlist = ("SARUN03","SARUN04","SARUN05","SARUN06","SARUN07","SARUN08","SARUN09","SARUN10","SARUN11","SARUN12","SARUN13","SARUN14","SARUN15")
undlist = ("SARUN03","SARUN04","SARUN05","SARUN06","SARUN07","SARUN08","SARUN09",
"SARUN10","SARUN11","SARUN12","SARUN13","SARUN14","SARUN15")
K1, K2 = {}, {}
for und in undlist:
@@ -18,7 +20,7 @@ for und in undlist: caputq(und + "-UIND030:K_SET", K2[und])
#Elog entry
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"
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)

View File

@@ -0,0 +1,21 @@
print "ENTER"
taper_lin = caget("SARUN:TAPER-LIN") * 1e-6
taper_qua = caget("SARUN:TAPER-QUA") * 1e-6
taper_lin_start = caget("SARUN:TAPER-LIN-START.RVAL")
taper_lin_stop = caget("SARUN:TAPER-LIN-STOP.RVAL")
taper_qua_start = caget("SARUN:TAPER-QUA-START.RVAL")
taper_qua_stop = caget("SARUN:TAPER-QUA-STOP.RVAL")
undlist = ("SARUN03","SARUN04","SARUN05","SARUN06","SARUN07","SARUN08","SARUN09",
"SARUN10","SARUN11","SARUN12","SARUN13","SARUN14","SARUN15")
u = 0
i, j = 0, 0
for und in undlist:
K_taper = taper_lin * i + taper_qua * j**2
if taper_lin_start <= u <= taper_lin_stop: i = i + 1
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

@@ -0,0 +1,10 @@
undlist = ("SARUN03","SARUN04","SARUN05","SARUN06","SARUN07","SARUN08","SARUN09",
"SARUN10","SARUN11","SARUN12","SARUN13","SARUN14","SARUN15")
for und in undlist:
K = caget(und + "-UIND030:K_SET")
K_taper = caget(und + "-UIND030:K_TAPER_SET")
K = K + K_taper
caputq(und + "-UIND030:K_SET", K)
caputq(und + "-UIND030:K_TAPER_SET", 0.0)

View File

@@ -0,0 +1,20 @@
from random import random
undlist = ("SATUN06","SATUN07","SATUN08","SATUN09",
"SATUN10","SATUN11","SATUN12","SATUN13")
i = 0
for und in undlist:
K_taper = (-1)**i * 0.25 + random() * 0.050 - 0.025
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
if K + K_taper < K_min:
K_taper = K_min - K + random() * 0.025
print(K, K_taper, K + K_taper)
caputq(und + "-UIND030:K_TAPER_SET", K_taper)
set_return("Success")

View File

@@ -0,0 +1,20 @@
from random import random
undlist = ("SATUN15","SATUN16","SATUN17","SATUN18",
"SATUN19","SATUN20","SATUN21","SATUN22")
i = 0
for und in undlist:
K_taper = (-1)**i * 0.25 + random() * 0.050 - 0.025
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
if K + K_taper < K_min:
K_taper = K_min - K + random() * 0.025
print(K, K_taper, K + K_taper)
caputq(und + "-UIND030:K_TAPER_SET", K_taper)
set_return("Success")

View File

@@ -0,0 +1,22 @@
from random import random
undlist = ("SATUN06","SATUN07","SATUN08","SATUN09",
"SATUN10","SATUN11","SATUN12","SATUN13",
"SATUN15","SATUN16","SATUN17","SATUN18",
"SATUN19","SATUN20","SATUN21","SATUN22")
i = 0
for und in undlist:
K_taper = (-1)**i * 0.25 + random() * 0.180 - 0.090
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
if K + K_taper < K_min:
K_taper = K_min - K + random() * 0.025
print(K_taper)
caputq(und + "-UIND030:K_TAPER_SET", K_taper)
set_return("Success")

Some files were not shown because too many files have changed in this diff Show More