Added dv/Dt and V vs V' phasemap Plots to context tool in PlotDataItem
(cherry picked from commit 9d88041a0b3b165439d4e0e45923c83afaefb1ad)
This commit is contained in:
parent
dd5a8bf9d1
commit
b93facb10a
@ -148,6 +148,8 @@ class PlotDataItem(GraphicsObject):
|
||||
|
||||
'fftMode': False,
|
||||
'logMode': [False, False],
|
||||
'derivativeMode': False,
|
||||
'phasemapMode': False,
|
||||
'alphaHint': 1.0,
|
||||
'alphaMode': False,
|
||||
|
||||
@ -213,7 +215,25 @@ class PlotDataItem(GraphicsObject):
|
||||
self.xClean = self.yClean = None
|
||||
self.updateItems()
|
||||
self.informViewBoundsChanged()
|
||||
|
||||
|
||||
def setDerivativeMode(self, mode):
|
||||
if self.opts['derivativeMode'] == mode:
|
||||
return
|
||||
self.opts['derivativeMode'] = mode
|
||||
self.xDisp = self.yDisp = None
|
||||
self.xClean = self.yClean = None
|
||||
self.updateItems()
|
||||
self.informViewBoundsChanged()
|
||||
|
||||
def setPhasemapMode(self, mode):
|
||||
if self.opts['phasemapMode'] == mode:
|
||||
return
|
||||
self.opts['phasemapMode'] = mode
|
||||
self.xDisp = self.yDisp = None
|
||||
self.xClean = self.yClean = None
|
||||
self.updateItems()
|
||||
self.informViewBoundsChanged()
|
||||
|
||||
def setPointMode(self, mode):
|
||||
if self.opts['pointMode'] == mode:
|
||||
return
|
||||
@ -514,7 +534,13 @@ class PlotDataItem(GraphicsObject):
|
||||
x = np.log10(x)
|
||||
if self.opts['logMode'][1]:
|
||||
y = np.log10(y)
|
||||
|
||||
if self.opts['derivativeMode']: # plot dV/dt
|
||||
y = np.diff(self.yData)/np.diff(self.xData)
|
||||
x = x[:-1]
|
||||
if self.opts['phasemapMode']: # plot dV/dt vs V
|
||||
x = self.yData[:-1]
|
||||
y = np.diff(self.yData)/np.diff(self.xData)
|
||||
|
||||
ds = self.opts['downsample']
|
||||
if not isinstance(ds, int):
|
||||
ds = 1
|
||||
|
@ -253,6 +253,8 @@ class PlotItem(GraphicsWidget):
|
||||
c.fftCheck.toggled.connect(self.updateSpectrumMode)
|
||||
c.logXCheck.toggled.connect(self.updateLogMode)
|
||||
c.logYCheck.toggled.connect(self.updateLogMode)
|
||||
c.derivativeCheck.toggled.connect(self.updateDerivativeMode)
|
||||
c.phasemapCheck.toggled.connect(self.updatePhasemapMode)
|
||||
|
||||
c.downsampleSpin.valueChanged.connect(self.updateDownsampling)
|
||||
c.downsampleCheck.toggled.connect(self.updateDownsampling)
|
||||
@ -904,6 +906,23 @@ class PlotItem(GraphicsWidget):
|
||||
self.getAxis('right').setLogMode(y)
|
||||
self.enableAutoRange()
|
||||
self.recomputeAverages()
|
||||
|
||||
def updateDerivativeMode(self):
|
||||
d = self.ctrl.derivativeCheck.isChecked()
|
||||
for i in self.items:
|
||||
if hasattr(i, 'setDerivativeMode'):
|
||||
i.setDerivativeMode(d)
|
||||
self.enableAutoRange()
|
||||
self.recomputeAverages()
|
||||
|
||||
def updatePhasemapMode(self):
|
||||
d = self.ctrl.phasemapCheck.isChecked()
|
||||
for i in self.items:
|
||||
if hasattr(i, 'setPhasemapMode'):
|
||||
i.setPhasemapMode(d)
|
||||
self.enableAutoRange()
|
||||
self.recomputeAverages()
|
||||
|
||||
|
||||
def setDownsampling(self, ds=None, auto=None, mode=None):
|
||||
"""Change the default downsampling mode for all PlotDataItems managed by this plot.
|
||||
|
@ -192,17 +192,17 @@
|
||||
<widget class="QFrame" name="transformGroup">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>154</width>
|
||||
<height>79</height>
|
||||
<x>10</x>
|
||||
<y>10</y>
|
||||
<width>171</width>
|
||||
<height>101</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QCheckBox" name="fftCheck">
|
||||
<item row="2" column="0">
|
||||
<widget class="QCheckBox" name="logYCheck">
|
||||
<property name="text">
|
||||
<string>Power Spectrum (FFT)</string>
|
||||
<string>Log Y</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@ -213,10 +213,24 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QCheckBox" name="logYCheck">
|
||||
<item row="0" column="0">
|
||||
<widget class="QCheckBox" name="fftCheck">
|
||||
<property name="text">
|
||||
<string>Log Y</string>
|
||||
<string>Power Spectrum (FFT)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QCheckBox" name="derivativeCheck">
|
||||
<property name="text">
|
||||
<string>dV/dT</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QCheckBox" name="phasemapCheck">
|
||||
<property name="text">
|
||||
<string>V vs. V'</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
Loading…
x
Reference in New Issue
Block a user