From 23fc3b602d0f87ce78173afcc743eee94b409c2a Mon Sep 17 00:00:00 2001 From: Anders Sandstrom Date: Fri, 4 Aug 2023 22:47:51 +0200 Subject: [PATCH] WIP --- iocsh/pvs.log | 26 +++++++++--------- tools/ecmcMotionMainGui.py | 55 ++++++++++++++++++++++++-------------- 2 files changed, 48 insertions(+), 33 deletions(-) diff --git a/iocsh/pvs.log b/iocsh/pvs.log index a6985e0..dbc4694 100644 --- a/iocsh/pvs.log +++ b/iocsh/pvs.log @@ -172,10 +172,10 @@ IOC_TEST:m0-Dom-WC-Zero IOC_TEST:m0-Dom-WC-Incomplete IOC_TEST:m0-Dom-WC-Complete IOC_TEST:m0-Stat-OK -REQMOD:raspberrypi-7906:exit -REQMOD:raspberrypi-7906:MODULES -REQMOD:raspberrypi-7906:VERSIONS -REQMOD:raspberrypi-7906:MOD_VER +REQMOD:raspberrypi-8270:exit +REQMOD:raspberrypi-8270:MODULES +REQMOD:raspberrypi-8270:VERSIONS +REQMOD:raspberrypi-8270:MOD_VER IOC_TEST:Axis1-Arr-Stat IOC_TEST:Axis1-PLC-Expr-RB IOC_TEST:Plg-Mtn0-PosAct-Arr @@ -245,18 +245,18 @@ IOC_TEST:m0-SlvRsp IOC_TEST:m0-Dom-WC IOC_TEST:m0s001-Enc01-LtchRst IOC_TEST:Axis1-Cmd_ -REQMOD:raspberrypi-7906:BaseVersion -REQMOD:raspberrypi-7906:require_VER -REQMOD:raspberrypi-7906:ecmccfg_VER -REQMOD:raspberrypi-7906:asyn_VER -REQMOD:raspberrypi-7906:exprtk_VER -REQMOD:raspberrypi-7906:motor_VER -REQMOD:raspberrypi-7906:ruckig_VER -REQMOD:raspberrypi-7906:ecmc_VER +REQMOD:raspberrypi-8270:BaseVersion +REQMOD:raspberrypi-8270:require_VER +REQMOD:raspberrypi-8270:ecmccfg_VER +REQMOD:raspberrypi-8270:asyn_VER +REQMOD:raspberrypi-8270:exprtk_VER +REQMOD:raspberrypi-8270:motor_VER +REQMOD:raspberrypi-8270:ruckig_VER +REQMOD:raspberrypi-8270:ecmc_VER IOC_TEST:m0s001-HWType IOC_TEST:m0s002-HWType IOC_TEST:Axis1-MsgTxt -REQMOD:raspberrypi-7906:ecmc_plugin_motion_VER +REQMOD:raspberrypi-8270:ecmc_plugin_motion_VER IOC_TEST:m0s001-Drv01-Stat IOC_TEST:m0s001-Enc01-Stat IOC_TEST:m0s001-Stat_ diff --git a/tools/ecmcMotionMainGui.py b/tools/ecmcMotionMainGui.py index 3f90c16..50d5045 100644 --- a/tools/ecmcMotionMainGui.py +++ b/tools/ecmcMotionMainGui.py @@ -88,8 +88,8 @@ class ecmcMtnMainGui(QtWidgets.QDialog): for pv in pvBinary: self.plottedLineBinary[pv] = None - for data in self.data: - data = None + for pv in pvlist: + self.data[pv] = None #Set some default plot colours self.plotColor={} @@ -115,10 +115,10 @@ class ecmcMtnMainGui(QtWidgets.QDialog): self.mtnPluginOrigId = mtnPluginId self.allowSave = False self.path = '.' - self.unitRawY = "[]" - self.unitSpectY = "[]" - self.labelSpectY = "Amplitude" - self.labelRawY = "Raw" + self.unitAnalogY = "[]" + self.unitBinaryY = "[]" + self.labelBinaryY = "Binary" + self.labelAnalogY = "Analog" self.title = "" #self.NMtn = 1024 self.sampleRate = 1000 @@ -546,7 +546,8 @@ class ecmcMtnMainGui(QtWidgets.QDialog): if self.data['PosAct-Arr'] is None: return - self.plotData(True) + self.plotAnalog(True) + self.plotBinary(True) return def newModeIndexChanged(self,index): @@ -588,11 +589,11 @@ class ecmcMtnMainGui(QtWidgets.QDialog): #self.pvPrefixStr = str(npzfile['pvPrefixStr']) #self.mtnPluginId = npzfile['mtnPluginId'] #if 'unitRawY' in npzfile: - # self.unitRawY = str(npzfile['unitRawY']) + # self.unitAnalogY = str(npzfile['unitRawY']) #if 'unitSpectY' in npzfile: # self.unitSpectY = str(npzfile['unitSpectY']) #if 'labelRawY' in npzfile: - # self.labelRawY = str(npzfile['labelRawY']) + # self.labelAnalogY = str(npzfile['labelRawY']) #if 'labelSpectY' in npzfile: # self.labelSpectY = str(npzfile['labelSpectY']) #if 'title' in npzfile: @@ -639,9 +640,9 @@ class ecmcMtnMainGui(QtWidgets.QDialog): # mode = self.data['Mde-RB'], # pvPrefixStr = self.pvPrefixStr, # mtnPluginId = self.mtnPluginId, - # unitRawY = self.unitRawY, + # unitRawY = self.unitAnalogY, # unitSpectY = self.unitSpectY, - # labelRawY = self.labelRawY, + # labelRawY = self.labelAnalogY, # labelSpectY = self.labelSpectY, # title = self.title # ) @@ -674,16 +675,19 @@ class ecmcMtnMainGui(QtWidgets.QDialog): for pv in pvAnalog: if self.plottedLineAnalog[pv] is not None: self.plottedLineAnalog[pv].remove() - y = self.data[pv] - y_len=len(y) - if x_len==y_len: - self.plottedLineAnalog[pv], = self.axAnalog.plot(x,y,self.plotColor[pv]) + if self.data[pv] is not None: + y = self.data[pv] + y_len=len(y) + if x_len == y_len: + self.plottedLineAnalog[pv], = self.axAnalog.plot(x,y,self.plotColor[pv]) + else: + print("Pv length mismatch (Time=" + str(x_len) + "," + pv + "=" + str(y_len) + ")") else: - print("Pv length mismatch (Time=" + str(x_len) + "," + pv + "=" + str(y_len) + ")") + print("Data null for pv: " + pv) self.axAnalog.grid(True) self.axAnalog.set_xlabel('Time [s]') - self.axAnalog.set_ylabel(self.labelRawY + ' ' + self.unitRawY) + self.axAnalog.set_ylabel(self.labelAnalogY + ' ' + self.unitAnalogY) self.axAnalog.set_title(self.title) if autozoom: @@ -724,15 +728,26 @@ class ecmcMtnMainGui(QtWidgets.QDialog): if self.axBinary is None: self.axBinary = self.figure.add_subplot(212) - # plot data + # plot data + x = self.data['Time-Arr'] + x_len = len(x) for pv in pvBinary: if self.plottedLineBinary[pv] is not None: self.plottedLineBinary[pv].remove() - self.plottedLineBinary[pv], = self.axBinary.plot(self.data['Time-Arr'],self.data[pv],self.plotColor[pv]) + if self.data[pv] is not None: + y = self.data[pv] + y_len=len(y) + if x_len == y_len: + self.plottedLineBinary[pv], = self.axBinary.plot(x,y,self.plotColor[pv]) + else: + print("Pv length mismatch (Time=" + str(x_len) + "," + pv + "=" + str(y_len) + ")") + else: + print("Data null for pv: " + pv) + self.axBinary.grid(True) self.axBinary.set_xlabel('Time [s]') - self.axBinary.set_ylabel(self.labelRawY + ' ' + self.unitRawY) + self.axBinary.set_ylabel(self.labelBinaryY + ' ' + self.unitBinaryY) self.axBinary.set_title(self.title) if autozoom: