From 3edd5ecda968f6818b26ea43dce6ecf980617139 Mon Sep 17 00:00:00 2001 From: gac-bernina Date: Mon, 19 Feb 2024 16:44:57 +0100 Subject: [PATCH] --- config/config.properties | 27 +- config/devices.properties | 31 +- config/devices_psss.properties | 16 + config/jcae.properties | 2 +- config/plugins.properties | 3 +- config/preferences.json | 116 ++++++++ config/setup.properties | 22 +- config/variables.properties | 8 +- devices/CameraServer.properties | 25 ++ devices/CurrentCamera.properties | 28 +- devices/Time.properties | 3 +- devices/aperture_offset_height.properties | 19 ++ devices/aperture_offset_width.properties | 19 ++ devices/aperture_slope_height.properties | 19 ++ devices/aperture_slope_width.properties | 19 ++ devices/attenuator.properties | 11 + devices/cam_server.properties | 14 +- devices/dispatcher.properties | 4 +- devices/histo_center.properties | 7 +- devices/histo_fwhm.properties | 3 +- devices/psss_center_average.properties | 3 +- devices/psss_fwhm_average.properties | 3 +- devices/psss_spectrum_y_average.properties | 3 +- plugins/Pointing.form | 191 ++++++++++++ plugins/Pointing.java | 281 ++++++++++++++++++ script/Correlation/Correlation2.py | 21 +- .../demo_histogram.py | 2 +- .../prof_att_histogram.py | 2 +- .../prof_monitor_statistics.py | 2 +- .../prof_monitor_statistics_debug.py | 2 +- .../prof_mono_histogram.py | 2 +- script/beam_jitter_measurements/xeye.py | 2 +- script/local.py | 4 +- script/pointing/check_offset.py | 5 + script/pointing/config.py | 18 ++ script/pointing/end.py | 3 + script/pointing/local.py | 14 + script/pointing/main.py | 63 ++++ script/pointing/reference_offset.py | 40 +++ script/pointing/start.py | 17 ++ script/psss/psss.py | 2 +- script/test/TestBsreadCamera.py | 28 ++ script/test/demo_histogram.py | 2 +- script/test/demo_histogram2.py | 2 +- script/test/demo_histogram3.py | 2 +- script/test/demo_histogram4.py | 2 +- script/test/test_corr_psss.py | 5 + script/test/test_cpython.py | 0 script/test/test_screenpanel_pipeline.py | 2 +- script/users/roman/correlation_bs.py | 136 +++++++++ 50 files changed, 1166 insertions(+), 89 deletions(-) mode change 100755 => 100644 config/devices.properties create mode 100755 config/devices_psss.properties mode change 100755 => 100644 config/plugins.properties create mode 100644 config/preferences.json mode change 100755 => 100644 config/variables.properties create mode 100644 devices/CameraServer.properties mode change 100755 => 100644 devices/CurrentCamera.properties mode change 100755 => 100644 devices/Time.properties create mode 100644 devices/aperture_offset_height.properties create mode 100644 devices/aperture_offset_width.properties create mode 100644 devices/aperture_slope_height.properties create mode 100644 devices/aperture_slope_width.properties create mode 100644 devices/attenuator.properties mode change 100755 => 100644 devices/cam_server.properties mode change 100755 => 100644 devices/dispatcher.properties mode change 100644 => 100755 devices/psss_center_average.properties mode change 100644 => 100755 devices/psss_fwhm_average.properties mode change 100644 => 100755 devices/psss_spectrum_y_average.properties create mode 100644 plugins/Pointing.form create mode 100644 plugins/Pointing.java mode change 100755 => 100644 script/local.py create mode 100644 script/pointing/check_offset.py create mode 100644 script/pointing/config.py create mode 100644 script/pointing/end.py create mode 100644 script/pointing/local.py create mode 100644 script/pointing/main.py create mode 100644 script/pointing/reference_offset.py create mode 100644 script/pointing/start.py mode change 100755 => 100644 script/psss/psss.py create mode 100644 script/test/TestBsreadCamera.py mode change 100755 => 100644 script/test/demo_histogram.py mode change 100755 => 100644 script/test/demo_histogram2.py mode change 100755 => 100644 script/test/demo_histogram3.py mode change 100755 => 100644 script/test/demo_histogram4.py create mode 100644 script/test/test_corr_psss.py mode change 100644 => 100755 script/test/test_cpython.py mode change 100755 => 100644 script/test/test_screenpanel_pipeline.py create mode 100644 script/users/roman/correlation_bs.py diff --git a/config/config.properties b/config/config.properties index 1ca3935..998ec0b 100755 --- a/config/config.properties +++ b/config/config.properties @@ -1,45 +1,60 @@ -#Wed Apr 28 09:43:14 CEST 2021 +#Mon May 15 09:51:30 CEST 2023 +xscanMoveTimeout=600 autoSaveScanData=true simulation=false commandExecutionEvents=false logDaysToLive=50 +xscanCrlogicChannel=null dataScanSaveOutput=false +xscanCrlogicSimulated=false userAuthenticator= logLevelConsole=Off +filePermissionsConfig=Public scanStreamerPort=-1 dataScanSaveScript=false dataScanSaveSetpoints=false notifiedTasks=null parallelInitialization=false +fdaSerialization=false dataTransferPath=null saveConsoleSessionFiles=false +xscanAppendSuffix=true versionTrackingManual=true -dataTransferMode=null +dataTransferMode=Off hostName=null userManagement=false -instanceName=BE disableEmbeddedAttributes=false +instanceName=BE dataServerPort=-1 -hideServerMessages=false serverPort=8080 +hideServerMessages=false versionTrackingEnabled=true dataPath={data}/{year}_{month}/{date}/{date}_{time}_{name} serverEnabled=false -dataScanReleaseRecords=false depthDimension=0 +dataScanReleaseRecords=false dataScanPreserveTypes=false logLevel=Info dataScanFlushRecords=false logPath={logs}/{date}_{time} +filePermissionsLogs=Public dataLayout=default disableDataFileLogs=false -sessionHandling=null +sessionHandling=Off terminalEnabled=false notificationLevel=Off +filePermissionsScripts=Public terminalPort=3579 +xscanCrlogicPrefix=null dataTransferUser=null +filePermissionsData=Default +xscanCrlogicAbortable=true +xscanContinuousUpdate=false createSessionFiles=false versionTrackingLogin={context}/svcusr-hlapp_robot +noBytecodeFiles=false versionTrackingRemote=git@git.psi.ch\:pshell_config/saresb.git dataProvider=h5 +xscanCrlogicIoc=null +dataScanLazyTableCreation=false saveCommandStatistics=false diff --git a/config/devices.properties b/config/devices.properties old mode 100755 new mode 100644 index a6a48a3..336a709 --- a/config/devices.properties +++ b/config/devices.properties @@ -6,15 +6,22 @@ cam_s=ch.psi.pshell.imaging.MjpegSource|http://bernina-cam-s/axis-cgi/mjpg/video cam_w=ch.psi.pshell.imaging.MjpegSource|http://bernina-cam-w/axis-cgi/mjpg/video.cgi reopen||-200| cam_mobile=ch.psi.pshell.imaging.MjpegSource|http://bernina-cam-mobile/axis-cgi/mjpg/video.cgi reopen||-200| energy_machine=ch.psi.pshell.epics.ChannelDouble|SARFE10-PBPG050:ENERGY|||true -psss_energy=ch.psi.pshell.epics.ChannelDouble|SARFE10-PSSS059:ENERGY|||true -psss_spectrum_x=ch.psi.pshell.epics.ChannelDoubleArray|SARFE10-PSSS059:SPECTRUM_X -1 -3|||true -psss_spectrum_y=ch.psi.pshell.epics.ChannelDoubleArray|SARFE10-PSSS059:SPECTRUM_Y -1 -3|||true -psss_center=ch.psi.pshell.epics.ChannelDouble|SARFE10-PSSS059:SPECTRUM_CENTER|||true -psss_fwhm=ch.psi.pshell.epics.ChannelDouble|SARFE10-PSSS059:SPECTRUM_FWHM|||true -psss_roi_min=ch.psi.pshell.epics.ChannelInteger|SARFE10-PSSS059:SPC_ROI_YMIN|||true -psss_roi_max=ch.psi.pshell.epics.ChannelInteger|SARFE10-PSSS059:SPC_ROI_YMAX|||true -histo_center=ch.psi.pshell.device.HistogramGenerator|psss_center|||true -histo_fwhm=ch.psi.pshell.device.HistogramGenerator|psss_fwhm|||true -psss_spectrum_y_average=ch.psi.pshell.device.ArrayAverager|psss_spectrum_y|||true -psss_center_average=ch.psi.pshell.device.Averager|psss_center|||true -psss_fwhm_average=ch.psi.pshell.device.Averager|psss_fwhm|||true +camera_screen=ch.psi.pshell.epics.DiscretePositioner|SAROP21-PPRM094:PROBE_SP|||true +beamline_name=ch.psi.pshell.epics.ChannelString|SAROP-ARAMIS:BEAMLINE||| +aperture_slope_width=ch.psi.pshell.epics.Motor|SAROP21-OAPU092:MOTOR_W|||true +aperture_slope_height=ch.psi.pshell.epics.Motor|SAROP21-OAPU092:MOTOR_H|||true +$aperture_offset_width=ch.psi.pshell.epics.Motor|SARFE10-OAPU044:MOTOR_W|||true +$aperture_offset_height=ch.psi.pshell.epics.Motor|SARFE10-OAPU044:MOTOR_H|||true +attenuator=ch.psi.pshell.epics.Positioner|SARFE10-OATT053:UsrRec.TD SARFE10-OATT053:UsrRec.TR1|||true +#psss_energy=ch.psi.pshell.epics.ChannelDouble|SARFE10-PSSS059:ENERGY|||true +#psss_spectrum_x=ch.psi.pshell.epics.ChannelDoubleArray|SARFE10-PSSS059:SPECTRUM_X -1 -3|||true +#psss_spectrum_y=ch.psi.pshell.epics.ChannelDoubleArray|SARFE10-PSSS059:SPECTRUM_Y -1 -3|||true +#psss_center=ch.psi.pshell.epics.ChannelDouble|SARFE10-PSSS059:SPECTRUM_CENTER|||true +#psss_fwhm=ch.psi.pshell.epics.ChannelDouble|SARFE10-PSSS059:SPECTRUM_FWHM|||true +#psss_roi_min=ch.psi.pshell.epics.ChannelInteger|SARFE10-PSSS059:SPC_ROI_YMIN|||true +#psss_roi_max=ch.psi.pshell.epics.ChannelInteger|SARFE10-PSSS059:SPC_ROI_YMAX|||true +#histo_center=ch.psi.pshell.device.HistogramGenerator|psss_center|||true +#histo_fwhm=ch.psi.pshell.device.HistogramGenerator|psss_fwhm|||true +#psss_spectrum_y_average=ch.psi.pshell.device.ArrayAverager|psss_spectrum_y|||true +#psss_center_average=ch.psi.pshell.device.Averager|psss_center|||true +#psss_fwhm_average=ch.psi.pshell.device.Averager|psss_fwhm|||true diff --git a/config/devices_psss.properties b/config/devices_psss.properties new file mode 100755 index 0000000..1a9eafc --- /dev/null +++ b/config/devices_psss.properties @@ -0,0 +1,16 @@ +psss_fwhm_avg=ch.psi.pshell.epics.ChannelDouble|SARFE10-PSSS059:REL-E-SPREAD|||true +dispatcher=ch.psi.pshell.bs.Dispatcher|https://dispatcher-api.psi.ch/sf||| +cam_server=ch.psi.pshell.bs.PipelineServer|sf-daqsync-01:8889||| +energy_machine=ch.psi.pshell.epics.ChannelDouble|SARFE10-PBPG050:ENERGY|||true +psss_energy=ch.psi.pshell.epics.ChannelDouble|SARFE10-PSSS059:ENERGY|||true +psss_spectrum_x=ch.psi.pshell.epics.ChannelDoubleArray|SARFE10-PSSS059:SPECTRUM_X -1 -3|||true +psss_spectrum_y=ch.psi.pshell.epics.ChannelDoubleArray|SARFE10-PSSS059:SPECTRUM_Y -1 -3|||true +psss_center=ch.psi.pshell.epics.ChannelDouble|SARFE10-PSSS059:SPECTRUM_CENTER|||true +psss_fwhm=ch.psi.pshell.epics.ChannelDouble|SARFE10-PSSS059:SPECTRUM_FWHM|||true +psss_roi_min=ch.psi.pshell.epics.ChannelInteger|SARFE10-PSSS059:SPC_ROI_YMIN|||true +psss_roi_max=ch.psi.pshell.epics.ChannelInteger|SARFE10-PSSS059:SPC_ROI_YMAX|||true +histo_center=ch.psi.pshell.device.HistogramGenerator|psss_center|||true +histo_fwhm=ch.psi.pshell.device.HistogramGenerator|psss_fwhm|||true +psss_spectrum_y_average=ch.psi.pshell.device.ArrayAverager|psss_spectrum_y|||true +psss_center_average=ch.psi.pshell.device.Averager|psss_center|||true +psss_fwhm_average=ch.psi.pshell.device.Averager|psss_fwhm|||true diff --git a/config/jcae.properties b/config/jcae.properties index 0e02d88..1628d5e 100755 --- a/config/jcae.properties +++ b/config/jcae.properties @@ -1,4 +1,4 @@ -#Mon Feb 22 20:35:07 CET 2021 +#Wed Aug 25 11:03:01 CEST 2021 ch.psi.jcae.ContextFactory.addressList= ch.psi.jcae.ContextFactory.serverPort= ch.psi.jcae.ContextFactory.maxArrayBytes=50000000 diff --git a/config/plugins.properties b/config/plugins.properties old mode 100755 new mode 100644 index 4886f34..0ba2d44 --- a/config/plugins.properties +++ b/config/plugins.properties @@ -1,10 +1,11 @@ +Pointing.java=enabled Correlation.java=disabled ScreenPanel2.java=disabled ScreenPanel3.java=disabled ScreenPanel4.java=disabled ScreenPanel5.java=disabled ScreenPanel6.java=disabled -PSSS.java=enabled +PSSS.java=disabled MonitoringCameras.java=disabled Chris.java=disabled SfCamera.java=enabled diff --git a/config/preferences.json b/config/preferences.json new file mode 100644 index 0000000..5a9e485 --- /dev/null +++ b/config/preferences.json @@ -0,0 +1,116 @@ +{ + "fontShellPanel" : { + "name" : "Monospaced", + "style" : 0, + "size" : 13 + }, + "fontShellCommand" : { + "name" : "SansSerif", + "style" : 0, + "size" : 13 + }, + "fontOutput" : { + "name" : "Monospaced", + "style" : 0, + "size" : 13 + }, + "fontEditor" : { + "name" : "Monospaced", + "style" : 0, + "size" : 13 + }, + "fontPlotLabel" : { + "name" : "SansSerif", + "style" : 0, + "size" : 11 + }, + "fontPlotTick" : { + "name" : "SansSerif", + "style" : 0, + "size" : 10 + }, + "fontPlotTitle" : { + "name" : "SansSerif", + "style" : 1, + "size" : 13 + }, + "fontTerminal" : null, + "tabSize" : 4, + "contentWidth" : 0, + "editorBackground" : null, + "editorForeground" : null, + "simpleEditor" : false, + "hideEditorLineNumbers" : false, + "hideEditorContextMenu" : false, + "consoleLocation" : "Left", + "dataPanelLocation" : null, + "openDataFilesInDocTab" : false, + "noVariableEvaluationPropagation" : false, + "processingScripts" : [ ], + "asyncViewersUpdate" : false, + "scanPlotDisabled" : false, + "scanTableDisabled" : false, + "cachedDataPanel" : false, + "dataExtensions" : null, + "dataSubFiles" : null, + "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, + "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.HistogramGenerator", + "panelClassName" : "ch.psi.pshell.swing.HistogramGeneratorPanel" + }, { + "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" : "Exception" +} \ No newline at end of file diff --git a/config/setup.properties b/config/setup.properties index d5a5f27..7d15c51 100755 --- a/config/setup.properties +++ b/config/setup.properties @@ -1,23 +1,25 @@ -#Thu Feb 25 14:38:29 CET 2021 +#Tue Aug 16 17:03:47 CEST 2022 sessionsPath={outp}/sessions scriptPath={home}/script -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 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 -imagesPath={outp}/images configFile={config}/config.properties -scriptType=py 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={outp}/images +scriptType=py diff --git a/config/variables.properties b/config/variables.properties old mode 100755 new mode 100644 index 80e1aad..be7acc5 --- a/config/variables.properties +++ b/config/variables.properties @@ -1,4 +1,4 @@ -#Thu Apr 29 13:47:57 CEST 2021 -LastRunDate=210429 -FileSequentialNumber=86 -DaySequentialNumber=5 +#Tue Dec 12 12:48:24 CET 2023 +LastRunDate=231212 +DaySequentialNumber=3 +FileSequentialNumber=6 diff --git a/devices/CameraServer.properties b/devices/CameraServer.properties new file mode 100644 index 0000000..b8b6bca --- /dev/null +++ b/devices/CameraServer.properties @@ -0,0 +1,25 @@ +#Mon Dec 19 15:35:22 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 diff --git a/devices/CurrentCamera.properties b/devices/CurrentCamera.properties old mode 100755 new mode 100644 index 909aa35..8235f62 --- a/devices/CurrentCamera.properties +++ b/devices/CurrentCamera.properties @@ -1,32 +1,26 @@ -#Tue May 04 13:01:49 CEST 2021 -\u0000\u0000\u0000\u0000= -=0 -spatialCalOffsetY=0.0 -spatialCalOffsetX=0.0 +#Mon Feb 19 14:45:17 CET 2024 +spatialCalOffsetY=-213.43204623518318 +spatialCalOffsetX=-415.6307007415859 colormapLogarithmic=false scale=1.0 grayscale=false -spatialCalScaleX=-1.0 -spatialCalScaleY=-1.0 -colormapMax=15848.0 -Y=0 +spatialCalScaleX=-15.057748904706497 +spatialCalScaleY=-11.764705882352942 +colormapMax=65535.0 rescaleOffset=0.0 roiWidth=-1 -colormap=Temperature -imageWidth=1280 +colormap=Flame invert=false -colormapMin=69.0 +colormapMin=63.0 rotation=0.0 rotationCrop=false +false= rescaleFactor=1.0 -imageHeight=1024 -spatialCalUnits=mm +spatialCalUnits=null flipVertically=false roiHeight=-1 flipHorizontally=false -colormapAutomatic=false +colormapAutomatic=true roiY=0 roiX=0 transpose=false -regionStartX=1 -regionStartY=1 diff --git a/devices/Time.properties b/devices/Time.properties old mode 100755 new mode 100644 index b1a9d76..c404060 --- a/devices/Time.properties +++ b/devices/Time.properties @@ -1,4 +1,4 @@ -#Wed Feb 26 11:49:58 CET 2020 +#Wed Oct 04 17:47:35 CEST 2023 minValue=NaN unit=null offset=0.0 @@ -7,4 +7,5 @@ rotation=false precision=-1 sign_bit=0 scale=1.0 +description=null resolution=NaN diff --git a/devices/aperture_offset_height.properties b/devices/aperture_offset_height.properties new file mode 100644 index 0000000..62f39b6 --- /dev/null +++ b/devices/aperture_offset_height.properties @@ -0,0 +1,19 @@ +#Wed Nov 15 15:55:09 CET 2023 +precision=3 +scale=1.0 +description=width Y +estbilizationDelay=0 +resolution=0.01 +minValue=0.0 +defaultSpeed=0.3 +sign_bit=0 +monitorByPosition=false +minSpeed=0.1 +offset=0.0 +maxValue=5.0 +rotation=false +maxSpeed=0.3 +homingType=None +startRetries=1 +unit=mm +hasEnable=false diff --git a/devices/aperture_offset_width.properties b/devices/aperture_offset_width.properties new file mode 100644 index 0000000..ac40b0f --- /dev/null +++ b/devices/aperture_offset_width.properties @@ -0,0 +1,19 @@ +#Wed Nov 15 15:54:55 CET 2023 +precision=3 +scale=1.0 +description=width X +estbilizationDelay=0 +resolution=0.01 +minValue=0.0 +defaultSpeed=0.3 +sign_bit=0 +monitorByPosition=false +minSpeed=0.1 +offset=0.0 +maxValue=5.0 +rotation=false +maxSpeed=0.3 +homingType=None +startRetries=1 +unit=mm +hasEnable=false diff --git a/devices/aperture_slope_height.properties b/devices/aperture_slope_height.properties new file mode 100644 index 0000000..977722c --- /dev/null +++ b/devices/aperture_slope_height.properties @@ -0,0 +1,19 @@ +#Wed Nov 15 15:55:18 CET 2023 +precision=3 +description=width Y +scale=1.0 +estbilizationDelay=0 +resolution=0.01 +minValue=0.0 +defaultSpeed=0.3 +sign_bit=0 +monitorByPosition=false +minSpeed=0.1 +offset=0.0 +maxValue=5.0 +rotation=false +maxSpeed=0.3 +homingType=None +startRetries=1 +unit=mm +hasEnable=false diff --git a/devices/aperture_slope_width.properties b/devices/aperture_slope_width.properties new file mode 100644 index 0000000..2fd5723 --- /dev/null +++ b/devices/aperture_slope_width.properties @@ -0,0 +1,19 @@ +#Wed Nov 15 15:55:34 CET 2023 +precision=3 +description=width X +scale=1.0 +estbilizationDelay=0 +resolution=0.01 +minValue=0.0 +defaultSpeed=0.3 +sign_bit=0 +monitorByPosition=false +minSpeed=0.1 +offset=0.0 +maxValue=5.0 +rotation=false +maxSpeed=0.3 +homingType=None +startRetries=1 +unit=mm +hasEnable=false diff --git a/devices/attenuator.properties b/devices/attenuator.properties new file mode 100644 index 0000000..250009b --- /dev/null +++ b/devices/attenuator.properties @@ -0,0 +1,11 @@ +#Mon Feb 19 15:18:22 CET 2024 +offset=0.0 +maxValue=1.0 +rotation=false +precision=3 +scale=1.0 +description=null +resolution=0.01 +minValue=0.0 +unit=% +sign_bit=0 diff --git a/devices/cam_server.properties b/devices/cam_server.properties old mode 100755 new mode 100644 index bcbfd43..98c5fd7 --- a/devices/cam_server.properties +++ b/devices/cam_server.properties @@ -1,15 +1,15 @@ -#Sun May 02 17:05:06 CEST 2021 -spatialCalOffsetY=-50.02315886984715 -spatialCalOffsetX=-50.01953888237593 +#Mon Feb 19 10:07:14 CET 2024 +spatialCalOffsetY=-213.43204623518318 +spatialCalOffsetX=-415.6307007415859 colormapLogarithmic=false scale=1.0 grayscale=false -spatialCalScaleX=-1.0 -spatialCalScaleY=-1.0 +spatialCalScaleX=-15.057748904706497 +spatialCalScaleY=-11.764705882352942 colormapMax=255.0 rescaleOffset=0.0 roiWidth=-1 -colormap=Temperature +colormap=Flame invert=false colormapMin=0.0 rotationCrop=false @@ -19,7 +19,7 @@ spatialCalUnits=mm flipVertically=false roiHeight=-1 flipHorizontally=false -colormapAutomatic=false +colormapAutomatic=true roiY=0 roiX=0 transpose=false diff --git a/devices/dispatcher.properties b/devices/dispatcher.properties old mode 100755 new mode 100644 index 9891517..a751a0a --- a/devices/dispatcher.properties +++ b/devices/dispatcher.properties @@ -1,11 +1,13 @@ -#Wed Jun 03 18:45:57 CEST 2020 +#Sun Dec 03 11:20:04 CET 2023 sendStrategy=complete_all dropIncomplete=false keepListeningOnStop=false disableCompression=false parallelHandlerProcessing=true sendBuildChannelConfig=at_startup +analizeHeader=false sendAwaitFirstMessage=false +headerReservingAllocator=false socketType=DEFAULT validationInconsistency=keep_as_is byteBufferAllocator=false diff --git a/devices/histo_center.properties b/devices/histo_center.properties index e0a9c8d..152a1a0 100755 --- a/devices/histo_center.properties +++ b/devices/histo_center.properties @@ -1,6 +1,7 @@ -#Fri Apr 30 14:09:41 CEST 2021 +#Tue Aug 16 17:03:53 CEST 2022 bins=1000 -min=11240.0 -max=11160.0 +min=11050.0 +max=10900.0 precision=-1 +description=null numberOfSamples=10000 diff --git a/devices/histo_fwhm.properties b/devices/histo_fwhm.properties index da35091..c635f67 100755 --- a/devices/histo_fwhm.properties +++ b/devices/histo_fwhm.properties @@ -1,6 +1,7 @@ -#Fri Apr 30 07:45:13 CEST 2021 +#Tue Aug 16 17:03:53 CEST 2022 bins=1000 min=0.0 max=40.0 precision=-1 +description=null numberOfSamples=10000 diff --git a/devices/psss_center_average.properties b/devices/psss_center_average.properties old mode 100644 new mode 100755 index 6a20991..5a40d82 --- a/devices/psss_center_average.properties +++ b/devices/psss_center_average.properties @@ -1,4 +1,5 @@ -#Mon May 03 09:21:35 CEST 2021 +#Tue Aug 16 17:03:53 CEST 2022 measures=10 precision=-1 +description=null interval=-1 diff --git a/devices/psss_fwhm_average.properties b/devices/psss_fwhm_average.properties old mode 100644 new mode 100755 index 6aeec64..5a40d82 --- a/devices/psss_fwhm_average.properties +++ b/devices/psss_fwhm_average.properties @@ -1,4 +1,5 @@ -#Mon May 03 09:21:52 CEST 2021 +#Tue Aug 16 17:03:53 CEST 2022 measures=10 precision=-1 +description=null interval=-1 diff --git a/devices/psss_spectrum_y_average.properties b/devices/psss_spectrum_y_average.properties old mode 100644 new mode 100755 index 2c2e72a..ca19b27 --- a/devices/psss_spectrum_y_average.properties +++ b/devices/psss_spectrum_y_average.properties @@ -1,5 +1,6 @@ -#Mon May 03 09:15:04 CEST 2021 +#Tue Aug 16 17:03:53 CEST 2022 measures=10 precision=-1 +description=null interval=-1 integrate=false diff --git a/plugins/Pointing.form b/plugins/Pointing.form new file mode 100644 index 0000000..811c9bb --- /dev/null +++ b/plugins/Pointing.form @@ -0,0 +1,191 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/plugins/Pointing.java b/plugins/Pointing.java new file mode 100644 index 0000000..d2a2de0 --- /dev/null +++ b/plugins/Pointing.java @@ -0,0 +1,281 @@ + +import ch.psi.pshell.ui.CamServerViewer; +import ch.psi.pshell.ui.Panel; +import ch.psi.utils.State; +import java.io.IOException; +import java.util.List; +import java.util.logging.Level; +import java.util.logging.Logger; + +/** + * + */ +public class Pointing extends Panel { + + public Pointing() { + initComponents(); + try { + viewer.initialize(CamServerViewer.SourceSelecionMode.Single); + viewer.setCameraServerUrl("sf-daqsync-01:8888"); + viewer.setPipelineServerUrl("sf-daqsync-01:8889"); + viewer.setStartupStream(TOOL_TIP_TEXT_KEY); + viewer.setToolbarVisible(false); + viewer.setZoom(2.0); + } catch (Exception ex) { + showException(ex); + } + } + + //Overridable callbacks + @Override + public void onInitialize(int runCount) { + try { + viewer.setStream("SAROP21-PPRM094_sp"); + } catch (Exception ex) { + showException(ex); + } + this.startTimer(1000, 1000); + } + + @Override + public void onStateChange(State state, State former) { + buttonStart.setEnabled(state.isReady()); + } + + @Override + public void onExecutedFile(String fileName, Object result) { + } + + @Override + protected void onTimer() { + try{ + Object img = viewer.getStreamDevice().take().getValue("image"); + this.setGlobalVar("plugin_img", img); + Object ret = eval("get_saturated_pixels(plugin_img)", true); + textSaturated.setText((ret==null) ? "" : ret.toString()); + } catch (Exception ex){ + textSaturated.setText(""); + this.getLogger().severe(ex.getMessage()); + } + + if (ckOffsetCheck.isSelected()){ + try{ + Object ret = this.run("pointing/check_offset", null, true); + List offset = (List) ret; + Double offX = (Double) offset.get(0); + Double offY = (Double) offset.get(1); + textOffX.setText(String.format("%1.3f",offX)); + textOffY.setText(String.format("%1.3f",offY)); + } catch (Exception ex){ + textOffX.setText(""); + textOffY.setText(""); + //showException(ex); + } + } + + } + + @Override + protected void onLoaded() { + + } + + @Override + protected void onUnloaded() { + + } + + //Invoked by 'update()' to update components in the event thread + @Override + protected void doUpdate() { + } + + @SuppressWarnings("unchecked") + // //GEN-BEGIN:initComponents + private void initComponents() { + + viewer = new ch.psi.pshell.ui.CamServerViewer(); + processVariablePanel1 = new ch.psi.pshell.swing.ProcessVariablePanel(); + jLabel1 = new javax.swing.JLabel(); + textSaturated = new javax.swing.JTextField(); + buttonStart = new javax.swing.JButton(); + buttonRefOffAp = new javax.swing.JButton(); + buttonEnd = new javax.swing.JButton(); + jLabel2 = new javax.swing.JLabel(); + textOffX = new javax.swing.JTextField(); + jLabel3 = new javax.swing.JLabel(); + textOffY = new javax.swing.JTextField(); + ckOffsetCheck = new javax.swing.JCheckBox(); + + processVariablePanel1.setDeviceName("attenuator"); + processVariablePanel1.setShowLimitButtons(false); + processVariablePanel1.setShowSlider(false); + processVariablePanel1.setShowStop(false); + processVariablePanel1.setStepIncrement(0.01); + processVariablePanel1.setStepSize(0.01); + + jLabel1.setText("Saturated Pixels:"); + + textSaturated.setEditable(false); + textSaturated.setHorizontalAlignment(javax.swing.JTextField.CENTER); + + buttonStart.setText("Start"); + buttonStart.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + buttonStartActionPerformed(evt); + } + }); + + buttonRefOffAp.setText("Reference Offset Aperture"); + buttonRefOffAp.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + buttonRefOffApActionPerformed(evt); + } + }); + + buttonEnd.setText("End"); + buttonEnd.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + buttonEndActionPerformed(evt); + } + }); + + jLabel2.setText("Off X:"); + + textOffX.setEditable(false); + textOffX.setHorizontalAlignment(javax.swing.JTextField.CENTER); + + jLabel3.setText("Off Y:"); + + textOffY.setEditable(false); + textOffY.setHorizontalAlignment(javax.swing.JTextField.CENTER); + + ckOffsetCheck.setText("Enable Offset Check"); + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); + this.setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addComponent(viewer, javax.swing.GroupLayout.PREFERRED_SIZE, 469, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGap(18, 18, 18) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(processVariablePanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addGroup(layout.createSequentialGroup() + .addGap(75, 75, 75) + .addComponent(jLabel1) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(textSaturated, javax.swing.GroupLayout.PREFERRED_SIZE, 95, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(0, 181, Short.MAX_VALUE)))) + .addGroup(layout.createSequentialGroup() + .addGap(130, 130, 130) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(buttonRefOffAp, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(buttonEnd, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(ckOffsetCheck) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) + .addGroup(layout.createSequentialGroup() + .addComponent(jLabel3) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(textOffY)) + .addGroup(layout.createSequentialGroup() + .addComponent(jLabel2) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(textOffX, javax.swing.GroupLayout.PREFERRED_SIZE, 136, javax.swing.GroupLayout.PREFERRED_SIZE))))) + .addGap(0, 0, Short.MAX_VALUE))) + .addContainerGap()) + .addGroup(layout.createSequentialGroup() + .addGap(165, 165, 165) + .addComponent(buttonStart) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))) + ); + + layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {buttonEnd, buttonRefOffAp, buttonStart}); + + layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {textOffX, textOffY, textSaturated}); + + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addContainerGap() + .addComponent(viewer, javax.swing.GroupLayout.PREFERRED_SIZE, 716, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGroup(layout.createSequentialGroup() + .addGap(86, 86, 86) + .addComponent(buttonStart) + .addGap(73, 73, 73) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel1) + .addComponent(textSaturated, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(18, 18, 18) + .addComponent(processVariablePanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(97, 97, 97) + .addComponent(buttonRefOffAp) + .addGap(74, 74, 74) + .addComponent(ckOffsetCheck) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel2) + .addComponent(textOffX, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(3, 3, 3) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel3) + .addComponent(textOffY, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(18, 18, 18) + .addComponent(buttonEnd))) + .addContainerGap(106, Short.MAX_VALUE)) + ); + }// //GEN-END:initComponents + + private void buttonStartActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonStartActionPerformed + try{ + runAsync("pointing/start").handle((ret,ex)->{ + return ret; + }); + } catch (Exception ex){ + showException(ex); + } + }//GEN-LAST:event_buttonStartActionPerformed + + private void buttonRefOffApActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonRefOffApActionPerformed + try{ + runAsync("pointing/reference_offset").handle((ret,ex)->{ + return ret; + }); + } catch (Exception ex){ + showException(ex); + } + }//GEN-LAST:event_buttonRefOffApActionPerformed + + private void buttonEndActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonEndActionPerformed + try{ + runAsync("pointing/end").handle((ret,ex)->{ + return ret; + }); + } catch (Exception ex){ + showException(ex); + } + }//GEN-LAST:event_buttonEndActionPerformed + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JButton buttonEnd; + private javax.swing.JButton buttonRefOffAp; + private javax.swing.JButton buttonStart; + private javax.swing.JCheckBox ckOffsetCheck; + private javax.swing.JLabel jLabel1; + private javax.swing.JLabel jLabel2; + private javax.swing.JLabel jLabel3; + private ch.psi.pshell.swing.ProcessVariablePanel processVariablePanel1; + private javax.swing.JTextField textOffX; + private javax.swing.JTextField textOffY; + private javax.swing.JTextField textSaturated; + private ch.psi.pshell.ui.CamServerViewer viewer; + // End of variables declaration//GEN-END:variables +} diff --git a/script/Correlation/Correlation2.py b/script/Correlation/Correlation2.py index 0efe6b9..2068d46 100755 --- a/script/Correlation/Correlation2.py +++ b/script/Correlation/Correlation2.py @@ -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 @@ -13,15 +13,17 @@ TYPE_CAMERA= 2 if get_exec_pars().source == CommandSource.ui: dx = "SINDI01-RLLE-STA:SLAVE1-CPUTIMER" + dx="SARFE10-PBPS053:INTENSITY" #dx = "SLG-LCAM-C042 x_rms" dxtype = TYPE_STREAM - dxtype = TYPE_CHANNEL + #dxtype = TYPE_CHANNEL #dxtype = TYPE_CAMERA - #dy = "SINDI01-RLLE-STA:SLAVE1-DLTIMER" - dy = "SLG-LCAM-C042 y_rms" + dy = "SINDI01-RLLE-STA:SLAVE1-DLTIMER" + #dy = "SLG-LCAM-C042 y_rms" + dy="SARFE10-PBPS053:INTENSITY" dytype = TYPE_STREAM - dytype = TYPE_CHANNEL - dytype = TYPE_CAMERA + #dytype = TYPE_CHANNEL + #dytype = TYPE_CAMERA interval = 0.10 window = 40 p = plot(None)[0] @@ -115,7 +117,7 @@ try: _stream.initialize() _stream.start(True) if _camname != None: - shared = _camname.endswith("_sp1") + shared = _camname.endswith("_sp") print "Camera: " , _camname, " shared: ", shared cam_server.start(_camname, shared ) cam_server.stream.waitCacheChange(10000); @@ -140,7 +142,8 @@ try: #Sample and plot data if bs == True: _stream.waitValueNot(_stream.take(), 10000) - bsdata = list(_stream.take().values) + bsdata = list(_stream.take().values()) + #print bsdata if dxtype==TYPE_CHANNEL: x=dx.read() @@ -174,7 +177,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) diff --git a/script/beam_jitter_measurements/demo_histogram.py b/script/beam_jitter_measurements/demo_histogram.py index 63bb3bb..af28bb7 100755 --- a/script/beam_jitter_measurements/demo_histogram.py +++ b/script/beam_jitter_measurements/demo_histogram.py @@ -3,7 +3,7 @@ import ch.psi.pshell.device.HistogramGenerator as HistogramGenerator CAMERA_NAME = "SARES20-PROF141-M1" CHANNEL = "intensity" -cam_server.start(CAMERA_NAME + "_sp", CAMERA_NAME + "_sp1") #Start or connect to ScreenPanel pipeline +cam_server.start(CAMERA_NAME + "_sp", True) #Start or connect to ScreenPanel pipeline cam_server.stream.waitCacheChange(2000) dev = cam_server.stream.getChild(CHANNEL) add_device(dev, True) #To see it in Device panel diff --git a/script/beam_jitter_measurements/prof_att_histogram.py b/script/beam_jitter_measurements/prof_att_histogram.py index 38bb32a..c0ceaad 100755 --- a/script/beam_jitter_measurements/prof_att_histogram.py +++ b/script/beam_jitter_measurements/prof_att_histogram.py @@ -3,7 +3,7 @@ import ch.psi.pshell.device.HistogramGenerator as HistogramGenerator CAMERA_NAME = "SAROP21-PPRM138" -cam_server.start(CAMERA_NAME + "_sp", CAMERA_NAME + "_sp1") #Start or connect to ScreenPanel pipeline +cam_server.start(CAMERA_NAME + "_sp", True) #Start or connect to ScreenPanel pipeline cam_server.stream.waitCacheChange(2000) diff --git a/script/beam_jitter_measurements/prof_monitor_statistics.py b/script/beam_jitter_measurements/prof_monitor_statistics.py index aa134ad..06ea09b 100755 --- a/script/beam_jitter_measurements/prof_monitor_statistics.py +++ b/script/beam_jitter_measurements/prof_monitor_statistics.py @@ -20,7 +20,7 @@ bins = 100 panels = OrderedDict() -cam_server.start(CAMERA_NAME + "_sp", CAMERA_NAME + "_sp1") #Start or connect to ScreenPanel pipeline +cam_server.start(CAMERA_NAME + "_sp", True) #Start or connect to ScreenPanel pipeline cam_server.stream.waitCacheChange(2000) for channel in CHANNELS: diff --git a/script/beam_jitter_measurements/prof_monitor_statistics_debug.py b/script/beam_jitter_measurements/prof_monitor_statistics_debug.py index 25db623..6677ebd 100755 --- a/script/beam_jitter_measurements/prof_monitor_statistics_debug.py +++ b/script/beam_jitter_measurements/prof_monitor_statistics_debug.py @@ -22,7 +22,7 @@ panels = OrderedDict() CAMERA_NAME='SAROP21-PPRM138' -cam_server.start(CAMERA_NAME + "_sp", CAMERA_NAME + "_sp1") #Start or connect to ScreenPanel pipeline +cam_server.start(CAMERA_NAME + "_sp", True) #Start or connect to ScreenPanel pipeline cam_server.stream.waitCacheChange(2000) for channel in CHANNELS: diff --git a/script/beam_jitter_measurements/prof_mono_histogram.py b/script/beam_jitter_measurements/prof_mono_histogram.py index 7423da6..17423e0 100755 --- a/script/beam_jitter_measurements/prof_mono_histogram.py +++ b/script/beam_jitter_measurements/prof_mono_histogram.py @@ -3,7 +3,7 @@ import ch.psi.pshell.device.HistogramGenerator as HistogramGenerator CAMERA_NAME = "SAROP21-PPRM102" #CAMERA_NAME = "SAROP21-PPRM138" -cam_server.start(CAMERA_NAME + "_sp", CAMERA_NAME + "_sp1") #Start or connect to ScreenPanel pipeline +cam_server.start(CAMERA_NAME + "_sp", True) #Start or connect to ScreenPanel pipeline cam_server.stream.waitCacheChange(2000) diff --git a/script/beam_jitter_measurements/xeye.py b/script/beam_jitter_measurements/xeye.py index ca3f3e5..c29d7d9 100755 --- a/script/beam_jitter_measurements/xeye.py +++ b/script/beam_jitter_measurements/xeye.py @@ -3,7 +3,7 @@ import ch.psi.pshell.device.HistogramGenerator as HistogramGenerator CAMERA_NAME = "SARES20-PROF142-M1" -cam_server.start(CAMERA_NAME + "_sp", CAMERA_NAME + "_sp1") #Start or connect to ScreenPanel pipeline +cam_server.start(CAMERA_NAME + "_sp", True) #Start or connect to ScreenPanel pipeline cam_server.stream.waitCacheChange(2000) diff --git a/script/local.py b/script/local.py old mode 100755 new mode 100644 index bf95a49..443fbca --- a/script/local.py +++ b/script/local.py @@ -8,7 +8,9 @@ from mathutils import PolynomialFunction, Gaussian, HarmonicOscillator, Gaussian from plotutils import plot_function, plot_data import java.awt.Color as Color -run("psss/psss") +#run("psss/psss") +run ("pointing/local") + ################################################################################################### # DRY RUN diff --git a/script/pointing/check_offset.py b/script/pointing/check_offset.py new file mode 100644 index 0000000..f5a0ba5 --- /dev/null +++ b/script/pointing/check_offset.py @@ -0,0 +1,5 @@ +st.waitCacheChange(5000) +val=st.take() +fit_pos = val["x_fit_mean"], val["y_fit_mean"] +offset = fit_pos[0] - marker_pos[0], fit_pos[1] - marker_pos[1] +set_return(offset) diff --git a/script/pointing/config.py b/script/pointing/config.py new file mode 100644 index 0000000..8042ec7 --- /dev/null +++ b/script/pointing/config.py @@ -0,0 +1,18 @@ +BEAMLINE_NAME = "Bernina" +CAMERA_NAME = "SAROP21-PPRM094" + + +APERTURE_SLOPE_W_MIN = 0.2 +APERTURE_SLOPE_H_MIN = 0.2 +APERTURE_OFFSET_W_MIN = 0.2 +APERTURE_OFFSET_H_MIN = 0.2 + + +APERTURE_SLOPE_W_DEFAULT = 5.0 +APERTURE_SLOPE_H_DEFAULT = 5.0 +APERTURE_OFFSET_W_DEFAULT = 5.0 +APERTURE_OFFSET_H_DEFAULT = 5.0 + + +ATENUATOR_CAL = 0.01 +ATENUATOR_DEFAULT = 0.05 \ No newline at end of file diff --git a/script/pointing/end.py b/script/pointing/end.py new file mode 100644 index 0000000..e1b862c --- /dev/null +++ b/script/pointing/end.py @@ -0,0 +1,3 @@ +attenuator.write(ATENUATOR_DEFAULT) + +st.close() diff --git a/script/pointing/local.py b/script/pointing/local.py new file mode 100644 index 0000000..e82c678 --- /dev/null +++ b/script/pointing/local.py @@ -0,0 +1,14 @@ +run("pointing/config") + +def check(): + if beamline_name.read() != BEAMLINE_NAME: + raise "Invalid beamline mode" + + +camera_screen.setSettlingCondition(ChannelSettlingCondition("SAROP21-PPRM094:IN_POS", 1, None, 'i')) + + + +def get_saturated_pixels(img): + img = flatten(img) + return sum([1 if v>=4095 else 0 for v in img]) \ No newline at end of file diff --git a/script/pointing/main.py b/script/pointing/main.py new file mode 100644 index 0000000..540a7ed --- /dev/null +++ b/script/pointing/main.py @@ -0,0 +1,63 @@ +#check() +run("pointing/start") + + + +#Close aperture offset +aperture_offset_width.move(APERTURE_OFFSET_W_MIN) +aperture_offset_height.move(APERTURE_OFFSET_H_MIN) + + +#Move marker to the fit position +val=st.take() +fit_pos = val["x_fit_mean"], val["y_fit_mean"] +x_axis, y_axis = val["x_axis"], val["y_axis"] +fit_pos_px_x = int(fit_pos[0] / cam_server.config.spatialCalScaleX - cam_server.config.spatialCalOffsetX) +fit_pos_px_y = int(fit_pos[1] / cam_server.config.spatialCalScaleY - cam_server.config.spatialCalOffsetY) +fit_pos_px = [fit_pos_px_x, fit_pos_px_y] + +print fit_pos_px + +#marker_pos_px = cam_server.getInstanceConfigValue("Marker") +#marker_pos_x = (marker_pos_px[0] + cam_server.config.spatialCalOffsetX) * cam_server.config.spatialCalScaleX +#marker_pos_y = (marker_pos_px[1] + cam_server.config.spatialCalOffsetY) * cam_server.config.spatialCalScaleY +#marker_pos = [marker_pos_x, marker_pos_y] +#print marker_pos_px + +cam_server.setInstanceConfigValue("Marker", fit_pos_px) +marker_pos_px = fit_pos_px + + +#Open aperture offset +aperture_offset_width.move(APERTURE_OFFSET_W_DEFAULT) +aperture_offset_height.move(APERTURE_OFFSET_H_DEFAULT) + + +time.sleep(0.5) +st.waitCacheChange(5000) +val=st.take() +fit_pos = val["x_fit_mean"], val["y_fit_mean"] +marker_pos_x = (marker_pos_px[0] + cam_server.config.spatialCalOffsetX) * cam_server.config.spatialCalScaleX +marker_pos_y = (marker_pos_px[1] + cam_server.config.spatialCalOffsetY) * cam_server.config.spatialCalScaleY +marker_pos = [marker_pos_x, marker_pos_y] + + +offset = fit_pos[0] - marker_pos[0], fit_pos[1] - marker_pos[1] + +print offset + + + + +#1/0 +#camera_screen.move("Free") + + + + + +#aperture_slope_width.move(APERTURE_SLOPE_W_MIN) +#aperture_slope_height.move(APERTURE_SLOPE_H_MIN) + + +run("pointing/end") diff --git a/script/pointing/reference_offset.py b/script/pointing/reference_offset.py new file mode 100644 index 0000000..c43893f --- /dev/null +++ b/script/pointing/reference_offset.py @@ -0,0 +1,40 @@ + +try: + #Close aperture offset + aperture_offset_width.moveAsync(APERTURE_OFFSET_W_MIN) + aperture_offset_height.move(APERTURE_OFFSET_H_MIN) + aperture_offset_width.waitReady(-1) + + + #Move marker to the fit position + val=st.take() + fit_pos = val["x_fit_mean"], val["y_fit_mean"] + x_axis, y_axis = val["x_axis"], val["y_axis"] + fit_pos_px_x = int(fit_pos[0] / cam_server.config.spatialCalScaleX - cam_server.config.spatialCalOffsetX) + fit_pos_px_y = int(fit_pos[1] / cam_server.config.spatialCalScaleY - cam_server.config.spatialCalOffsetY) + fit_pos_px = [fit_pos_px_x, fit_pos_px_y] + + print fit_pos_px + + #marker_pos_px = cam_server.getInstanceConfigValue("Marker") + #marker_pos_x = (marker_pos_px[0] + cam_server.config.spatialCalOffsetX) * cam_server.config.spatialCalScaleX + #marker_pos_y = (marker_pos_px[1] + cam_server.config.spatialCalOffsetY) * cam_server.config.spatialCalScaleY + #marker_pos = [marker_pos_x, marker_pos_y] + #print marker_pos_px + + cam_server.setInstanceConfigValue("Marker", fit_pos_px) + marker_pos_px = fit_pos_px + + marker_pos_x = (marker_pos_px[0] + cam_server.config.spatialCalOffsetX) * cam_server.config.spatialCalScaleX + marker_pos_y = (marker_pos_px[1] + cam_server.config.spatialCalOffsetY) * cam_server.config.spatialCalScaleY + marker_pos = [marker_pos_x, marker_pos_y] + + + + +finally: + #Open aperture offset + aperture_offset_width.moveAsync(APERTURE_OFFSET_W_DEFAULT) + aperture_offset_height.move(APERTURE_OFFSET_H_DEFAULT) + aperture_offset_width.waitReady(-1) + time.sleep(0.5) diff --git a/script/pointing/start.py b/script/pointing/start.py new file mode 100644 index 0000000..43aad3c --- /dev/null +++ b/script/pointing/start.py @@ -0,0 +1,17 @@ +aperture_offset_width = aperture_slope_width #TODO: REMOVE +aperture_offset_height = aperture_slope_height + +camera_screen.move("Wafer 100um") +time.sleep(0.2) +camera_screen.getSettlingCondition().waitSettled() #ecj + +cam_server.start(CAMERA_NAME + '_sp', True) +cam_server.averaging=10 +st = cam_server.stream +print('Started camera') +#Fix this with a specific pipeline +time.sleep(0.5) +st.waitCacheChange(5000) +#show_panel(cam_server) +add_device(st, True) +attenuator.write(ATENUATOR_CAL) \ No newline at end of file diff --git a/script/psss/psss.py b/script/psss/psss.py old mode 100755 new mode 100644 index c82f729..e9e1809 --- a/script/psss/psss.py +++ b/script/psss/psss.py @@ -159,7 +159,7 @@ def enable_psss_image(enabled, renderer): cam_server.config.colormap=Colormap.Temperature - cam_server.start(PSSS_CAMERA_NAME + "_sp", PSSS_CAMERA_NAME + "_sp1") + cam_server.start(PSSS_CAMERA_NAME + "_sp", True) #ovmin, ovmax= Overlays.Crosshairs(renderer.getPenMarker(), Dimension(-1,1)), \ # Overlays.Crosshairs(renderer.getPenMarker(), Dimension(-1,1)) ovmin, ovmax= Overlays.Line(renderer.getPenMarker()), Overlays.Line(renderer.getPenMarker()) diff --git a/script/test/TestBsreadCamera.py b/script/test/TestBsreadCamera.py new file mode 100644 index 0000000..9c663db --- /dev/null +++ b/script/test/TestBsreadCamera.py @@ -0,0 +1,28 @@ +CAMERA = "SARES20-CAMS142-M3" +CAMERA = "SARFE10-PSSS059" +CAMERA = "SATBD02-DSCR050" +CAMERA = "SATES31-CAMS187-RIXS1" +CAMERA = "SAROP21-PPRM138" +CAMERA = "SARES20-PROF142-M1" +#CAMERA = "SARES20-CAMS142-M5" +CAMERA = "SLAAR02-LPMO01-C321" +CAMERA = "SLAAR02-LPMO02-C322" +CAMERA = "SLAAR21-LCAM-CS841" +CAMERA = "SLAAR21-LCAM-CS842" +CAMERA = "SARES20-CAMS142-C2" + +CAMERA_URL = caget(CAMERA + ":BSREADCONFIG").replace("tcp://daq", "tcp://") +#CAMERA_URL= "tcp://sf-sioc-cs-83:9020" +#CAMERA_URL= "tcp://sf-sioc-cs-64:9000" +CAMERA_URL = "tcp://sf-daqsync-02:31852" +print CAMERA_URL +st1 = Stream("st1", CAMERA_URL, SocketType.PULL) +st1.initialize() +st1.start() +st1.waitCacheChange(3000) +try: + #r=bscan (st1, records=5, timeout=10.0, save=False, enabled_plots=[st1,]) + #v= st1.getValues() + show_panel(st1) +finally: + st1.close() diff --git a/script/test/demo_histogram.py b/script/test/demo_histogram.py old mode 100755 new mode 100644 index a6c5520..9d65011 --- a/script/test/demo_histogram.py +++ b/script/test/demo_histogram.py @@ -3,7 +3,7 @@ import ch.psi.pshell.device.HistogramGenerator as HistogramGenerator CAMERA_NAME = "SARES20-PROF141-M1" CHANNEL = "intensity" -cam_server.start(CAMERA_NAME + "_sp", CAMERA_NAME + "_sp1") #Start or connect to ScreenPanel pipeline +cam_server.start(CAMERA_NAME + "_sp", True) #Start or connect to ScreenPanel pipeline cam_server.stream.waitCacheChange(2000) dev = cam_server.stream.getChild(CHANNEL) add_device(dev, True) #To see it in Device panel diff --git a/script/test/demo_histogram2.py b/script/test/demo_histogram2.py old mode 100755 new mode 100644 index f3f531c..e7a984c --- a/script/test/demo_histogram2.py +++ b/script/test/demo_histogram2.py @@ -8,7 +8,7 @@ range_min, range_max = float('nan'),float('nan') bins = 100 for camera_name in CAMERA_NAMES: - cam_server.start(camera_name + "_sp", camera_name + "_sp1") #Start or connect to ScreenPanel pipeline + cam_server.start(camera_name + "_sp", True) #Start or connect to ScreenPanel pipeline cam_server.stream.waitCacheChange(2000) for channel in CHANNELS: diff --git a/script/test/demo_histogram3.py b/script/test/demo_histogram3.py old mode 100755 new mode 100644 index 3c971c4..7d532eb --- a/script/test/demo_histogram3.py +++ b/script/test/demo_histogram3.py @@ -25,7 +25,7 @@ bins = 100 panels = OrderedDict() for camera_name in CAMERA_NAMES: - cam_server.start(camera_name + "_sp", camera_name + "_sp1") #Start or connect to ScreenPanel pipeline + cam_server.start(camera_name + "_sp", True) #Start or connect to ScreenPanel pipeline cam_server.stream.waitCacheChange(2000) for channel in CHANNELS: diff --git a/script/test/demo_histogram4.py b/script/test/demo_histogram4.py old mode 100755 new mode 100644 index 6509edd..bb8e79e --- a/script/test/demo_histogram4.py +++ b/script/test/demo_histogram4.py @@ -24,7 +24,7 @@ bins = 100 panels = OrderedDict() -cam_server.start(CAMERA_NAME + "_sp", CAMERA_NAME + "_sp1") #Start or connect to ScreenPanel pipeline +cam_server.start(CAMERA_NAME + "_sp", True) #Start or connect to ScreenPanel pipeline cam_server.stream.waitCacheChange(2000) for channel in CHANNELS: diff --git a/script/test/test_corr_psss.py b/script/test/test_corr_psss.py new file mode 100644 index 0000000..fc730fd --- /dev/null +++ b/script/test/test_corr_psss.py @@ -0,0 +1,5 @@ +s1 = Stream("s1", dispatcher) +s1.addScalar("SARFE10-PSSS059:SPECTRUM_Y_SUM", "SARFE10-PSSS059:SPECTRUM_Y_SUM", 1, 0) +s1.addScalar("SARFE10-PBPS053:INTENSITY" , "SARFE10-PBPS053:INTENSITY", 1, 0) +s1.initialize() +bscan(s1, 10, 3.0) \ No newline at end of file diff --git a/script/test/test_cpython.py b/script/test/test_cpython.py old mode 100644 new mode 100755 diff --git a/script/test/test_screenpanel_pipeline.py b/script/test/test_screenpanel_pipeline.py old mode 100755 new mode 100644 index 3cf989e..dceab81 --- a/script/test/test_screenpanel_pipeline.py +++ b/script/test/test_screenpanel_pipeline.py @@ -1,6 +1,6 @@ import ch.psi.pshell.device.HistogramGenerator as HistogramGenerator -cam_server.start("SARES20-PROF141-M1_sp", "SARES20-PROF141-M1_sp1") +cam_server.start("SARES20-PROF141-M1_sp", True) channels = ["intensity", "x_center_of_mass", diff --git a/script/users/roman/correlation_bs.py b/script/users/roman/correlation_bs.py new file mode 100644 index 0000000..0233ad6 --- /dev/null +++ b/script/users/roman/correlation_bs.py @@ -0,0 +1,136 @@ +""" +Run as: +pshell_be -l -test -c -f="users/roman/correlation_bs.py" -args="CHS:['SAROP21-PBPS103:INTENSITY', 'SAROP21-PBPS133:INTENSITY']" + +or with additional parameters: +pshell_be -l -test -c -f="users/roman/correlation_bs.py" -args="CHS:['SAROP21-PBPS103:INTENSITY', 'SAROP21-PBPS133:INTENSITY'],VERBOSE:False,TIME_INTERVAL:2.0" +""" + +if not "VERBOSE" in globals(): + VERBOSE = False +if not "TIME_INTERVAL" in globals(): + TIME_INTERVAL = 1.0 + +EMPTY_VALUE = 1112223330 + +channel_list = CHS +def start_stream(channel_list): + try: + st=None + print "Starting stream" + if len(channel_list)==0: + raise Exception ("No channel defined") + st = Stream("pulse_id", dispatcher) + for c in channel_list: + st.addScalar(c, c, 1, 0) + st.initialize() + st.start() + st.waitCacheChange(10000) #Wait stream be running before starting scan + if st.take() is None: + raise Exception("Error initializing data stream") + ack_channel_list(channel_list) + print "Stream started" + except: + stop_stream(st) + st=None + print sys.exc_info()[1] + return st + +def stop_stream(st): + try: + if st: + st.close() + st=None + print "Stream closed" + except: + print sys.exc_info()[1] + finally: + ack_channel_list([]) + +#def on_start_change(val): +# fork(start_stream if (val==1) else stop_stream) +#start = Channel(PREFIX + "START_STOP", type = 'i', monitored = True, callback=on_start_change) + +t0=None +pid=None +def handle_message(msg, channel_list, buf): + global t0, pid + if t0 is None: + t0 = time.time() + now=time.time() + num_channels = len(channel_list) + size_buffer= 300 #int((len(buf)-100)/(len(channel_list)+1)) + buf[0] = msg.pulseId + buf[1] = num_channels + buf[4] = EMPTY_VALUE + #if (pid is not None) and ((pid+1) != msg.pulseId): + # print "Missing pid: ", (pid+1) + pid = msg.pulseId + #Count + if buf[2] < size_buffer: + buf[2] = buf[2]+1 + #Index + buf[3] = buf[3]+1 + if buf[3] == size_buffer: + buf[3]=0 + index = int(buf[3])*(num_channels+1) + 10 + buf[index] = msg.pulseId + index = index+1 + for v in msg.values(): + buf[index] = EMPTY_VALUE if ((v is None) or (math.isnan(v)))else v + index = index+1 + if now >= (t0 + TIME_INTERVAL): + if VERBOSE: + print to_list(buf[0:5]) + t0 = time.time() + return True + return False + +def run(): + channel_list = [] + st=None + start = Channel(PREFIX + "START_STOP", type = 'i') + outp = Channel(PREFIX + "PACK_DATA", type = '[d') + buf = to_array([0]*outp.get_size(),'d') + buf[2] = 0 + buf[3]= -1 + + try: + while True: + started = (start.get()==1) + if started and not st: + print "Started" + channel_list=get_channel_list() + print "Channel list: ", channel_list + st = start_stream(channel_list) + if st is not None: + class StreamListener (DeviceListener): + def onValueChanged(self, device, value, former): + if handle_message(value, channel_list, buf): + outp.putq(buf) + listener = StreamListener() + st.addListener(listener) + + elif st and not started: + print "Stopped" + channel_list=[] + stop_stream(st) + st = None + """ + if st: + st.waitCacheChange(0) + if handle_message(st.take(), channel_list, buf): + outp.putq(buf) + time.sleep(0.001) + else: + time.sleep(0.1) + """ + time.sleep(0.1) + finally: + stop_stream(st) + if outp: outp.close() + if start: start.close() + + +if __name__ == "__main__": + run() \ No newline at end of file