From 7a0da7c48c5d86f71ef3db8d1275c25a786ec0a8 Mon Sep 17 00:00:00 2001 From: gobbo_a Date: Tue, 14 Jan 2025 16:18:27 +0100 Subject: [PATCH] 01.2025 --- config/config.properties | 14 +- config/preferences.json | 25 +- config/variables.properties | 8 +- devices/CurrentCamera.properties | 20 +- devices/DLAC motor.properties | 24 +- devices/Image Integrator.properties | 25 ++ devices/TDS Phase.properties | 4 +- devices/WireScanner motor.properties | 7 +- devices/cam_server.properties | 10 +- devices/dispatcher.properties | 11 +- plugins/BunchLength.form | 247 +++++++++++----- plugins/BunchLength.java | 278 +++++++++++++----- plugins/WireScan.java | 8 +- plugins/errors | 59 ++++ script/CPython/hfitoff.py | 18 +- script/CPython/wrapper.py | 2 + script/Correlation/Correlation2.py | 2 +- script/Correlation/correlation_stream_mult.py | 4 +- script/Devices/Elements.py | 6 +- script/Diagnostics/BLM_ROI_finetune.py | 8 +- script/Diagnostics/CamtoolScan.py | 2 +- script/Diagnostics/DLACScan.py | 43 ++- script/Diagnostics/WireScan.py | 64 ++-- script/GenericScans/2Dscan01.py | 2 +- script/GenericScans/Scan6.py | 2 +- script/Photonics/Athos/scan_athos.py | 8 +- script/Photonics/KValueScan.py | 2 +- script/Photonics/PhaseShifterScan.py | 2 +- script/Photonics/PhaseShifterScan_DV.py | 2 +- script/RFscan/GunEnergyScan.py | 6 +- script/RFscan/RfEnergyCalibGlobal.py | 12 +- script/RFscan/SchottkyScan.py | 2 +- script/RFscan/TDScalibration.py | 5 +- script/RFscan/phase_scan_caqtdm.py | 158 +++++----- script/RFscan/phase_scan_caqtdm_set.py | 35 +-- script/RFscan/phase_scan_data.py | 47 +++ script/RFscan/phase_scan_global.py | 11 + script/RFscan/setRFscanRange.py | 44 ++- script/Tools/BunchLengthPrep.py | 35 ++- script/Tools/BunchLengthRestore.py | 27 +- script/Tools/BunchLengthScan.py | 148 +++++----- script/Tools/BunchLengthTDSdata.py | 43 ++- script/Tools/CameraCorrelation.py | 4 +- script/Tools/SetTdsBeamPhase.py | 2 +- script/Tools/save_camera_data.py | 2 +- script/Tools/save_snapshot.py | 6 +- script/Undulators/CHICtestSimu.py | 14 +- script/Undulators/K-calc_AR.py | 4 +- script/Undulators/K-calc_AT.py | 4 +- script/Undulators/K_AR_lasing_off.py | 12 +- script/Undulators/K_AR_scale.py | 2 +- script/Undulators/K_AR_taperToK.py | 3 +- script/Undulators/K_AT_lasing_off.py | 12 +- script/Undulators/K_AT_scale.py | 2 + script/Undulators/K_AT_scale1.py | 2 + script/Undulators/K_AT_scale2.py | 2 + script/Undulators/K_AT_taper.py | 1 + script/Undulators/K_AT_taper1.py | 1 + script/Undulators/K_AT_taper2.py | 1 + script/Undulators/K_AT_taperToK.py | 2 +- script/Undulators/scan_athos.py | 6 +- script/local.py | 5 +- script/test/CheckCamServerCameras.py | 139 +++++++++ script/test/SaveCamera.py | 3 +- script/test/TestBsreadCamera.py | 24 +- script/test/TestCreateDeviceCam.py | 2 +- script/test/TestMergeCorrelation.py | 4 +- script/test/TestMergeStreams.py | 2 +- script/test/TestScanAverager.py | 6 +- script/test/TestWireScan.py | 161 ++++++++++ script/test/TestWireScanStreamChannels.py | 23 ++ script/test/Test_SAROP21-ATT01.py | 4 + script/test/bs5.py | 23 +- script/test/bs6.py | 3 +- script/test/didier_test.py | 8 + script/test/dummy.py | 2 + script/test/image.sources | 268 +++++++++++++++++ script/test/save_snapshot.py | 6 +- script/test/test_bsf.py | 10 + script/test/test_didier.py | 33 +++ 80 files changed, 1698 insertions(+), 590 deletions(-) create mode 100644 devices/Image Integrator.properties create mode 100644 plugins/errors mode change 100755 => 100644 script/CPython/hfitoff.py mode change 100755 => 100644 script/Diagnostics/WireScan.py mode change 100755 => 100644 script/RFscan/phase_scan_caqtdm.py mode change 100755 => 100644 script/RFscan/phase_scan_caqtdm_set.py create mode 100644 script/RFscan/phase_scan_data.py create mode 100644 script/RFscan/phase_scan_global.py mode change 100755 => 100644 script/Tools/save_camera_data.py mode change 100755 => 100644 script/Tools/save_snapshot.py create mode 100644 script/test/CheckCamServerCameras.py create mode 100644 script/test/TestWireScan.py create mode 100644 script/test/TestWireScanStreamChannels.py create mode 100644 script/test/Test_SAROP21-ATT01.py create mode 100644 script/test/didier_test.py create mode 100644 script/test/dummy.py create mode 100644 script/test/image.sources create mode 100644 script/test/test_bsf.py create mode 100644 script/test/test_didier.py diff --git a/config/config.properties b/config/config.properties index efa2c6e..b5767a3 100755 --- a/config/config.properties +++ b/config/config.properties @@ -1,4 +1,4 @@ -#Thu May 04 15:07:35 CEST 2023 +#Fri May 24 11:38:19 CEST 2024 xscanMoveTimeout=600 autoSaveScanData=true simulation=false @@ -30,32 +30,33 @@ userManagement=false disableEmbeddedAttributes=false instanceName=OP dataServerPort=-1 -serverPort=8090 hideServerMessages=false +serverPort=8090 versionTrackingEnabled=true dataPath={data}/{year}/{month}/{day}/{date}_{time}_{name} serverEnabled=true -depthDimension=0 dataScanReleaseRecords=false +depthDimension=0 dataScanPreserveTypes=false logLevel=Fine dataScanFlushRecords=false -logPath={logs}/{date}_{time} filePermissionsLogs=Public +logPath={logs}/{date}_{time} dataLayout=sf disableDataFileLogs=false +dataScanSaveTimestamps=false sessionHandling=Off deviceUpdateStrategyFile={config}/update.properties terminalEnabled=false -notificationLevel=Off filePermissionsScripts=Public +notificationLevel=Off terminalPort=3579 xscanCrlogicPrefix=null tasksFile={config}/tasks.properties dataTransferUser=null filePermissionsData=Default -xscanCrlogicAbortable=true xscanContinuousUpdate=false +xscanCrlogicAbortable=true createSessionFiles=false versionTrackingLogin={context}/svcusr-hlapp_robot noBytecodeFiles=false @@ -63,4 +64,5 @@ versionTrackingRemote=git@git.psi.ch\:pshell_config/sf-op.git dataProvider=default xscanCrlogicIoc=null dataScanLazyTableCreation=false +pythonHome= saveCommandStatistics=false diff --git a/config/preferences.json b/config/preferences.json index f8761ed..184eae7 100644 --- a/config/preferences.json +++ b/config/preferences.json @@ -37,7 +37,7 @@ "fontTerminal" : { "name" : "Monospaced", "style" : 0, - "size" : 14 + "size" : 12 }, "tabSize" : 4, "contentWidth" : 0, @@ -46,7 +46,7 @@ "simpleEditor" : false, "hideEditorLineNumbers" : false, "hideEditorContextMenu" : false, - "consoleLocation" : "Document", + "consoleLocation" : "Left", "dataPanelLocation" : null, "openDataFilesInDocTab" : false, "noVariableEvaluationPropagation" : false, @@ -93,6 +93,9 @@ }, { "deviceClassName" : "ch.psi.pshell.device.Motor", "panelClassName" : "ch.psi.pshell.swing.MotorPanel" + }, { + "deviceClassName" : "ch.psi.pshell.device.MasterPositioner", + "panelClassName" : "ch.psi.pshell.swing.MasterPositionerPanel" }, { "deviceClassName" : "ch.psi.pshell.device.ProcessVariable", "panelClassName" : "ch.psi.pshell.swing.ProcessVariablePanel" @@ -109,10 +112,22 @@ "deviceClassName" : "ch.psi.pshell.device.Slit", "panelClassName" : "ch.psi.pshell.swing.SlitPanel" }, { - "deviceClassName" : "ch.psi.pshell.device.ReadonlyRegister$ReadonlyRegisterArray", - "panelClassName" : "ch.psi.pshell.swing.DeviceValueChart" + "deviceClassName" : "ch.psi.pshell.device.HistogramGenerator", + "panelClassName" : "ch.psi.pshell.swing.HistogramGeneratorPanel" }, { - "deviceClassName" : "ch.psi.pshell.device.ReadonlyRegister$ReadonlyRegisterMatrix", + "deviceClassName" : "ch.psi.pshell.bs.Stream", + "panelClassName" : "ch.psi.pshell.swing.StreamPanel" + }, { + "deviceClassName" : "ch.psi.pshell.bs.StreamChannel", + "panelClassName" : "ch.psi.pshell.swing.StreamChannelPanel" + }, { + "deviceClassName" : "ch.psi.pshell.camserver.CamServerStream", + "panelClassName" : "ch.psi.pshell.swing.CamServerStreamPanel" + }, { + "deviceClassName" : "ch.psi.pshell.camserver.CamServerService", + "panelClassName" : "ch.psi.pshell.swing.CamServerServicePanel" + }, { + "deviceClassName" : "ch.psi.pshell.device.ReadonlyRegister", "panelClassName" : "ch.psi.pshell.swing.DeviceValueChart" } ], "scriptPopupDialog" : "None" diff --git a/config/variables.properties b/config/variables.properties index 1d7ed1e..ee80b01 100755 --- a/config/variables.properties +++ b/config/variables.properties @@ -1,4 +1,4 @@ -#Thu Aug 17 14:59:44 CEST 2023 -LastRunDate=230817 -FileSequentialNumber=10016 -DaySequentialNumber=5 +#Mon Jan 13 17:07:30 CET 2025 +LastRunDate=250113 +FileSequentialNumber=13116 +DaySequentialNumber=4 diff --git a/devices/CurrentCamera.properties b/devices/CurrentCamera.properties index 418f820..6e282c5 100755 --- a/devices/CurrentCamera.properties +++ b/devices/CurrentCamera.properties @@ -1,4 +1,6 @@ -#Thu Aug 17 15:16:51 CEST 2023 +#Mon Jan 13 15:40:25 CET 2025 +\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000= +\u0000\u0000\u0000\u0000\u0000= \u0000\u0000\u0000= \u0000\u0000= \u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000= @@ -8,30 +10,28 @@ \u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000= \u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000= \u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000= -\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000= -\u0000\u0000\u0000\u0000\u0000= colormapLogarithmic=false -spatialCalScaleX=-12.508648760497415 -spatialCalScaleY=-12.345679012345679 +spatialCalScaleX=-1.0 +spatialCalScaleY=-1.0 serverURL=null rescaleOffset=0.0 roiWidth=-1 colormap=Flame imageWidth=1744 invert=false -colormapMin=NaN +colormapMin=72.0 rotationCrop=false roiHeight=-1 -colormapAutomatic=false +colormapAutomatic=true roiY=0 roiX=0 -spatialCalOffsetY=-523.4304458333334 -spatialCalOffsetX=-865.4470498186071 +spatialCalOffsetY=-50.00000000000001 +spatialCalOffsetX=-50.0 scale=1.0 regionStart= grayscale=false rtY=1 -colormapMax=NaN +colormapMax=3000.0 spat= rotation=0.0 rescaleFactor=1.0 diff --git a/devices/DLAC motor.properties b/devices/DLAC motor.properties index d67d56b..c5ebf94 100755 --- a/devices/DLAC motor.properties +++ b/devices/DLAC motor.properties @@ -1,15 +1,19 @@ -#Thu Jul 13 13:32:57 CEST 2017 -defaultSpeed=1.0 -estbilizationDelay=0 -hasEnable=false -homingType=None -maxSpeed=1.0 -maxValue=346.0 -minSpeed=0.05 -minValue=130.0 +#Wed Sep 11 09:24:49 CEST 2024 offset=0.0 +maxValue=346.0 precision=5 -resolution=8.0E-4 rotation=false scale=1.0 +description=null +estbilizationDelay=0 +maxSpeed=1.0 +resolution=8.0E-4 +homingType=None +startRetries=1 +minValue=130.0 unit=mm +defaultSpeed=1.0 +hasEnable=false +sign_bit=0 +monitorByPosition=false +minSpeed=0.05 diff --git a/devices/Image Integrator.properties b/devices/Image Integrator.properties new file mode 100644 index 0000000..490f62e --- /dev/null +++ b/devices/Image Integrator.properties @@ -0,0 +1,25 @@ +#Thu Nov 14 10:39:29 CET 2024 +colormapLogarithmic=false +spatialCalScaleX=-35.21126970307918 +spatialCalScaleY=-48.38709738725674 +rescaleOffset=0.0 +roiWidth=-1 +colormap=Flame +invert=false +colormapMin=3138.731 +rotationCrop=false +roiHeight=-1 +colormapAutomatic=false +roiY=0 +roiX=0 +spatialCalOffsetY=-99.00000232640186 +spatialCalOffsetX=-173.99999471338924 +scale=1.0 +grayscale=false +colormapMax=11709.881 +rotation=0.0 +rescaleFactor=1.0 +spatialCalUnits=null +flipVertically=false +flipHorizontally=false +transpose=false diff --git a/devices/TDS Phase.properties b/devices/TDS Phase.properties index 5a832ee..2e0e77a 100644 --- a/devices/TDS Phase.properties +++ b/devices/TDS Phase.properties @@ -1,8 +1,8 @@ -#Mon May 01 20:02:47 CEST 2023 +#Mon Sep 11 08:15:49 CEST 2023 minValue=-90.0 unit=deg offset=0.0 -maxValue=270.0 +maxValue=360.0 rotation=true precision=4 sign_bit=0 diff --git a/devices/WireScanner motor.properties b/devices/WireScanner motor.properties index 18419d3..9aeab0d 100755 --- a/devices/WireScanner motor.properties +++ b/devices/WireScanner motor.properties @@ -1,15 +1,16 @@ -#Sun Jul 03 07:32:46 CEST 2022 +#Mon Jan 13 16:51:03 CET 2025 offset=0.0 -maxValue=140000.0 +maxValue=68500.0 precision=1 rotation=false scale=1.0 +description=PPMAC motor record estbilizationDelay=0 maxSpeed=2000.0 resolution=0.1 homingType=None startRetries=1 -minValue=-56400.0 +minValue=-57027.0 unit=um defaultSpeed=2000.0 hasEnable=false diff --git a/devices/cam_server.properties b/devices/cam_server.properties index 53733cd..7e46a8a 100755 --- a/devices/cam_server.properties +++ b/devices/cam_server.properties @@ -1,11 +1,11 @@ -#Thu Aug 17 14:27:37 CEST 2023 -spatialCalOffsetY=-50.048828125 -spatialCalOffsetX=-50.03909304143862 +#Mon Dec 09 10:29:03 CET 2024 +spatialCalOffsetY=-819.9999871547424 +spatialCalOffsetX=-861.0000211619925 colormapLogarithmic=false scale=1.0 grayscale=false -spatialCalScaleX=-1.0 -spatialCalScaleY=-1.0 +spatialCalScaleX=-18.90359092620482 +spatialCalScaleY=-19.37984500632817 colormapMax=NaN rescaleOffset=0.0 roiWidth=-1 diff --git a/devices/dispatcher.properties b/devices/dispatcher.properties index 0ce46e5..6234fa3 100755 --- a/devices/dispatcher.properties +++ b/devices/dispatcher.properties @@ -1,16 +1,17 @@ -#Fri Jun 16 10:34:26 CEST 2023 +#Fri Oct 20 12:06:55 CEST 2023 +sendStrategy=complete_all dropIncomplete=false keepListeningOnStop=false disableCompression=false parallelHandlerProcessing=true sendBuildChannelConfig=at_startup +analizeHeader=false +sendAwaitFirstMessage=false +headerReservingAllocator=false socketType=DEFAULT validationInconsistency=adjust_global byteBufferAllocator=false +alignmentRetries=20 mappingIncomplete=fill_null sendIncompleteMessages=true sendSyncTimeout=0 -sendStrategy=complete_all -sendAwaitFirstMessage=false -headerReservingAllocator=false -alignmentRetries=20 diff --git a/plugins/BunchLength.form b/plugins/BunchLength.form index e91239e..f25d25a 100755 --- a/plugins/BunchLength.form +++ b/plugins/BunchLength.form @@ -23,36 +23,49 @@ - - - - - - - - - - + + + + + + + + + + + - - + + + + + + + - - - - + + - + - + + + + + + - + + + + + @@ -61,36 +74,48 @@ - - - - - - - - - - - - - - - - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - @@ -111,42 +136,71 @@ - + + - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + @@ -178,15 +232,6 @@ - - - - - - - - - @@ -229,7 +274,7 @@ - + @@ -260,7 +305,7 @@ - + @@ -279,6 +324,9 @@ + + + @@ -295,6 +343,25 @@ + + + + + + + + + + + + + + + + + + + @@ -355,7 +422,7 @@ - + @@ -363,7 +430,7 @@ - + @@ -396,5 +463,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/plugins/BunchLength.java b/plugins/BunchLength.java index 734ecd9..3bc2480 100755 --- a/plugins/BunchLength.java +++ b/plugins/BunchLength.java @@ -2,6 +2,7 @@ * Copyright (c) 2014-2017 Paul Scherrer Institute. All rights reserved. */ +import ch.psi.pshell.core.Context; import ch.psi.pshell.plot.LinePlot; import ch.psi.pshell.plot.LinePlotSeries; import ch.psi.pshell.ui.Panel; @@ -9,7 +10,10 @@ import ch.psi.utils.State; import ch.psi.utils.swing.SwingUtils; import java.awt.Color; import java.util.ArrayList; +import java.util.HashMap; import java.util.List; +import java.util.Map; +import javax.script.ScriptException; import javax.swing.JSpinner; /** @@ -36,6 +40,7 @@ public class BunchLength extends Panel { buttonAbort.setEnabled(state.isProcessing()); boolean enabled = (state == State.Ready); buttonPrepare.setEnabled(enabled); + buttonRestore.setEnabled(enabled); buttonSetPhase.setEnabled(enabled); buttonStart.setEnabled(enabled); spinnerStart.setEnabled(enabled); @@ -46,6 +51,10 @@ public class BunchLength extends Panel { spinnerThreshold.setEnabled(enabled); spinnerStation.setEnabled(enabled); spinnerBunch.setEnabled(enabled); + spinnerScreen.setEnabled(enabled); + spinnerPhase.setEnabled(enabled); + jRadioButtonUserCalib.setEnabled(enabled); + spinnerUserCalib.setEnabled(enabled); } @Override @@ -56,6 +65,43 @@ public class BunchLength extends Panel { @Override protected void doUpdate() { } + + + void updateDefaults() throws Exception{ + this.run("Tools/BunchLengthTDSdata.py", null, true); + String station=spinnerStation.getValue().toString(); + Map tdsData = (Map)this.getGlobalVar("tds_data"); + Map stationData = (Map)tdsData.get(station); + Map defaults = (Map)stationData.getOrDefault("DEFAULTS", new HashMap()); + Number start = (Number)defaults.getOrDefault("Start", null); + Number stop = (Number)defaults.getOrDefault("Stop", null); + Number step = (Number)defaults.getOrDefault("Step", null); + Number nb = (Number)defaults.getOrDefault("Nb", null); + Number lat = (Number)defaults.getOrDefault("Lat", null); + Number thr = (Number)defaults.getOrDefault("Thr", null); + String scr = (String)defaults.getOrDefault("Scr", null); + if (start!=null){ + spinnerStart.setValue(start); + } + if (stop!=null){ + spinnerStop.setValue(stop); + } + if (step!=null){ + spinnerStep.setValue(step); + } + if (nb!=null){ + spinnerSamples.setValue(nb); + } + if (lat!=null){ + spinnerLatency.setValue(lat); + } + if (thr!=null){ + spinnerThreshold.setValue(thr); + } + if (scr!=null){ + spinnerScreen.setValue(scr); + } + } @SuppressWarnings("unchecked") // //GEN-BEGIN:initComponents @@ -78,6 +124,8 @@ public class BunchLength extends Panel { spinnerStation = new javax.swing.JSpinner(); spinnerBunch = new javax.swing.JSpinner(); labelBunch = new javax.swing.JLabel(); + spinnerScreen = new javax.swing.JSpinner(); + labelScreen = new javax.swing.JLabel(); plot11 = new ch.psi.pshell.plot.LinePlotJFree(); buttonStart = new javax.swing.JButton(); buttonAbort = new javax.swing.JButton(); @@ -89,6 +137,10 @@ public class BunchLength extends Panel { plot21 = new ch.psi.pshell.plot.LinePlotJFree(); plot12 = new ch.psi.pshell.plot.LinePlotJFree(); plot22 = new ch.psi.pshell.plot.LinePlotJFree(); + buttonRestore = new javax.swing.JButton(); + labelUserCalib = new javax.swing.JLabel(); + jRadioButtonUserCalib = new javax.swing.JRadioButton(); + spinnerUserCalib = new javax.swing.JSpinner(); setPreferredSize(new java.awt.Dimension(737, 445)); @@ -106,7 +158,7 @@ public class BunchLength extends Panel { labelSamples.setText("Nb samples:"); - spinnerSamples.setModel(new javax.swing.SpinnerNumberModel(10, 1, 100, 1)); + spinnerSamples.setModel(new javax.swing.SpinnerNumberModel(5, 1, 100, 1)); labelLatency.setText("Latency:"); @@ -116,50 +168,80 @@ public class BunchLength extends Panel { labelThreshold.setText("Threshold:"); - spinnerThreshold.setModel(new javax.swing.SpinnerNumberModel(7000, 0, 50000, 1)); + spinnerThreshold.setModel(new javax.swing.SpinnerNumberModel(250, 0, 50000, 1)); labelStation.setText("TDS Station:"); spinnerStation.setModel(new javax.swing.SpinnerListModel(new String[] {"S30CB14", "SATMA02", "SINDI01"})); + spinnerStation.addChangeListener(new javax.swing.event.ChangeListener() { + public void stateChanged(javax.swing.event.ChangeEvent evt) { + spinnerStationStateChanged(evt); + } + }); spinnerBunch.setModel(new javax.swing.SpinnerListModel(new String[] {"Bunch1", "Bunch2"})); labelBunch.setText("Bunch:"); + spinnerScreen.setModel(new javax.swing.SpinnerListModel(new String[] {"SARCL01-DSCR170", "SARCL02-DSCR280", "SATBD01-DSCR120", "SATBD02-DSCR050", "SINDI02-DSCR075", "simulation"})); + + labelScreen.setText("Screen:"); + javax.swing.GroupLayout panelScanParsLayout = new javax.swing.GroupLayout(panelScanPars); panelScanPars.setLayout(panelScanParsLayout); panelScanParsLayout.setHorizontalGroup( panelScanParsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(panelScanParsLayout.createSequentialGroup() + .addGap(0, 0, 0) .addGroup(panelScanParsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(panelScanParsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(labelStop, javax.swing.GroupLayout.Alignment.TRAILING) - .addComponent(labelStart, javax.swing.GroupLayout.Alignment.TRAILING) - .addComponent(labelSamples, javax.swing.GroupLayout.Alignment.TRAILING) - .addComponent(labelStep, javax.swing.GroupLayout.Alignment.TRAILING) - .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelScanParsLayout.createSequentialGroup() - .addGroup(panelScanParsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) - .addComponent(labelThreshold) - .addComponent(labelLatency)) - .addGap(2, 2, 2))) - .addComponent(labelStation) - .addComponent(labelBunch, javax.swing.GroupLayout.Alignment.TRAILING)) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addGroup(panelScanParsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) - .addComponent(spinnerStart) - .addComponent(spinnerStation) - .addComponent(spinnerBunch) - .addComponent(spinnerThreshold) - .addComponent(spinnerLatency) - .addComponent(spinnerSamples) - .addComponent(spinnerStep) - .addComponent(spinnerStop)) - .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addGroup(panelScanParsLayout.createSequentialGroup() + .addGroup(panelScanParsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(labelStation) + .addComponent(labelBunch) + .addComponent(labelScreen)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(panelScanParsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(spinnerStation) + .addComponent(spinnerBunch) + .addComponent(spinnerScreen))) + .addGroup(panelScanParsLayout.createSequentialGroup() + .addGroup(panelScanParsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(panelScanParsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(labelSamples, javax.swing.GroupLayout.Alignment.TRAILING) + .addGroup(panelScanParsLayout.createSequentialGroup() + .addGap(1, 1, 1) + .addGroup(panelScanParsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(labelStop) + .addComponent(labelStart)))) + .addComponent(labelStep) + .addComponent(labelLatency) + .addComponent(labelThreshold)) + .addGap(124, 124, 124) + .addGroup(panelScanParsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(spinnerLatency) + .addComponent(spinnerSamples) + .addComponent(spinnerStep) + .addComponent(spinnerStop) + .addComponent(spinnerStart) + .addComponent(spinnerThreshold, javax.swing.GroupLayout.Alignment.TRAILING)))) + .addGap(0, 0, 0)) ); panelScanParsLayout.setVerticalGroup( panelScanParsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(panelScanParsLayout.createSequentialGroup() .addContainerGap() + .addGroup(panelScanParsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(spinnerStation, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(labelStation)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 11, Short.MAX_VALUE) + .addGroup(panelScanParsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(spinnerBunch, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(labelBunch)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(panelScanParsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(spinnerScreen, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(labelScreen)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(panelScanParsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(spinnerStart, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(labelStart)) @@ -183,14 +265,7 @@ public class BunchLength extends Panel { .addGroup(panelScanParsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(labelThreshold) .addComponent(spinnerThreshold, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addGroup(panelScanParsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(spinnerStation, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(labelStation)) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addGroup(panelScanParsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(spinnerBunch, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(labelBunch))) + .addContainerGap()) ); plot11.setTitle(""); @@ -237,13 +312,13 @@ public class BunchLength extends Panel { panelOutputLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(panelOutputLayout.createSequentialGroup() .addContainerGap() - .addComponent(jTextAreaOutput) + .addComponent(jTextAreaOutput, javax.swing.GroupLayout.DEFAULT_SIZE, 621, Short.MAX_VALUE) .addContainerGap()) ); panelOutputLayout.setVerticalGroup( panelOutputLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(panelOutputLayout.createSequentialGroup() - .addComponent(jTextAreaOutput, javax.swing.GroupLayout.DEFAULT_SIZE, 142, Short.MAX_VALUE) + .addComponent(jTextAreaOutput, javax.swing.GroupLayout.DEFAULT_SIZE, 134, Short.MAX_VALUE) .addContainerGap()) ); @@ -253,64 +328,95 @@ public class BunchLength extends Panel { plot22.setTitle(""); + buttonRestore.setText("Restore"); + buttonRestore.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + RestoreActionPerformed(evt); + } + }); + + labelUserCalib.setText("User calib. (mm/deg):"); + labelUserCalib.setToolTipText(""); + + spinnerUserCalib.setModel(new javax.swing.SpinnerNumberModel(1.0d, 0.01d, 100.0d, 0.1d)); + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); this.setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addContainerGap() - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) - .addComponent(panelOutput, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(panelScanPars, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(buttonPrepare) .addGroup(layout.createSequentialGroup() - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(buttonPrepare) - .addGroup(layout.createSequentialGroup() - .addComponent(buttonStart) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(buttonAbort)) + .addComponent(buttonStart) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(buttonAbort)) + .addComponent(buttonRestore) + .addGroup(layout.createSequentialGroup() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addGroup(layout.createSequentialGroup() .addComponent(buttonSetPhase) - .addGap(0, 0, 0) - .addComponent(spinnerPhase, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addComponent(panelScanPars, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGap(55, 55, 55)) + .addGroup(layout.createSequentialGroup() + .addComponent(labelUserCalib) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jRadioButtonUserCalib) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED))) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(plot21, javax.swing.GroupLayout.DEFAULT_SIZE, 475, Short.MAX_VALUE) - .addComponent(plot11, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(spinnerPhase, javax.swing.GroupLayout.PREFERRED_SIZE, 92, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(spinnerUserCalib, javax.swing.GroupLayout.PREFERRED_SIZE, 92, javax.swing.GroupLayout.PREFERRED_SIZE)))) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) - .addComponent(plot12, javax.swing.GroupLayout.DEFAULT_SIZE, 438, Short.MAX_VALUE) + .addComponent(plot11, javax.swing.GroupLayout.DEFAULT_SIZE, 390, Short.MAX_VALUE) + .addComponent(plot21, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(plot12, javax.swing.GroupLayout.DEFAULT_SIZE, 390, Short.MAX_VALUE) .addComponent(plot22, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) - .addGap(28, 28, 28)) + .addContainerGap()) + .addGroup(layout.createSequentialGroup() + .addComponent(panelOutput, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(0, 483, Short.MAX_VALUE)) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addContainerGap() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(layout.createSequentialGroup() - .addComponent(panelScanPars, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(buttonPrepare) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(buttonSetPhase) - .addComponent(spinnerPhase, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(buttonStart) - .addComponent(buttonAbort))) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) .addComponent(plot11, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(plot12, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGap(0, 0, 0) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(plot22, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(plot21, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(panelOutput, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addContainerGap(19, Short.MAX_VALUE)) + .addComponent(plot21, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addGap(0, 3, Short.MAX_VALUE)) + .addGroup(layout.createSequentialGroup() + .addComponent(panelScanPars, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addGroup(layout.createSequentialGroup() + .addComponent(buttonPrepare) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(buttonSetPhase) + .addComponent(spinnerPhase, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(buttonStart) + .addComponent(buttonAbort)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(buttonRestore) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(labelUserCalib) + .addComponent(spinnerUserCalib, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addComponent(jRadioButtonUserCalib)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))) + .addComponent(panelOutput, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) ); panelScanPars.getAccessibleContext().setAccessibleDescription(""); @@ -326,6 +432,9 @@ public class BunchLength extends Panel { parameters.add(spinnerThreshold.getValue()); parameters.add(spinnerStation.getValue()); parameters.add(spinnerBunch.getValue()); + parameters.add(spinnerScreen.getValue()); + parameters.add(jRadioButtonUserCalib.isSelected()); + parameters.add(spinnerUserCalib.getValue()); parameters.add(plot11); parameters.add(plot12); parameters.add(plot21); @@ -411,20 +520,49 @@ public class BunchLength extends Panel { } }//GEN-LAST:event_buttonSetPhaseActionPerformed + private void RestoreActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_RestoreActionPerformed + ArrayList parameters = new ArrayList(); + parameters.add(spinnerStation.getValue()); + try { + runAsync("Tools/BunchLengthRestore", parameters).handle((ret, ex) -> { + if (ex != null) { + String message = "Exception executing scan: " + ex; + getLogger().info(message); + showException((Exception) ex); + } + return ret; + }); + } catch (Exception ex) { + showException(ex); + } + }//GEN-LAST:event_RestoreActionPerformed + + private void spinnerStationStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_spinnerStationStateChanged + try { + updateDefaults(); + } catch (Exception ex) { + showException(ex); + } + }//GEN-LAST:event_spinnerStationStateChanged + // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton buttonAbort; private javax.swing.JButton buttonPrepare; + private javax.swing.JButton buttonRestore; private javax.swing.JButton buttonSetPhase; private javax.swing.JButton buttonStart; + private javax.swing.JRadioButton jRadioButtonUserCalib; private javax.swing.JTextArea jTextAreaOutput; private javax.swing.JLabel labelBunch; private javax.swing.JLabel labelLatency; private javax.swing.JLabel labelSamples; + private javax.swing.JLabel labelScreen; private javax.swing.JLabel labelStart; private javax.swing.JLabel labelStation; private javax.swing.JLabel labelStep; private javax.swing.JLabel labelStop; private javax.swing.JLabel labelThreshold; + private javax.swing.JLabel labelUserCalib; private javax.swing.JPanel panelOutput; private javax.swing.JPanel panelScanPars; private ch.psi.pshell.plot.LinePlotJFree plot11; @@ -435,10 +573,12 @@ public class BunchLength extends Panel { private javax.swing.JSpinner spinnerLatency; private javax.swing.JSpinner spinnerPhase; private javax.swing.JSpinner spinnerSamples; + private javax.swing.JSpinner spinnerScreen; private javax.swing.JSpinner spinnerStart; private javax.swing.JSpinner spinnerStation; private javax.swing.JSpinner spinnerStep; private javax.swing.JSpinner spinnerStop; private javax.swing.JSpinner spinnerThreshold; + private javax.swing.JSpinner spinnerUserCalib; // End of variables declaration//GEN-END:variables } diff --git a/plugins/WireScan.java b/plugins/WireScan.java index 0556078..fa2a14e 100755 --- a/plugins/WireScan.java +++ b/plugins/WireScan.java @@ -314,6 +314,7 @@ public class WireScan extends Panel { } + JDialog dlgRaw; void showBlmRawData(String blm){ try { if ((blm==null) || (blm.isEmpty())){ @@ -324,10 +325,11 @@ public class WireScan extends Panel { //dev.setPolling(1000); dev.setMonitored(true); dev.initialize(); - DeviceValueChart chart = new DeviceValueChart(); - JDialog dlg = SwingUtils.showDialog((Window)this.getTopLevel(), blm, new Dimension(600,400), chart); + DeviceValueChart chart = new DeviceValueChart(); + dlgRaw= SwingUtils.showDialog((Window)this.getTopLevel(), blm, new Dimension(600,400), chart); chart.setDevice(dev); - dlg.addWindowListener(new WindowAdapter() { + chart.setInterval(200); + dlgRaw.addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent e) { try { diff --git a/plugins/errors b/plugins/errors new file mode 100644 index 0000000..d28fb4b --- /dev/null +++ b/plugins/errors @@ -0,0 +1,59 @@ + +javax.script.ScriptException: Exception: Scan didn't conmplete in