Added dv/Dt and V vs V' phasemap Plots to context tool in PlotDataItem

(cherry picked from commit 9d88041a0b3b165439d4e0e45923c83afaefb1ad)
This commit is contained in:
Paul manis 2017-03-27 16:00:38 -04:00 committed by Megan Kratz
parent dd5a8bf9d1
commit b93facb10a
3 changed files with 71 additions and 12 deletions

View File

@ -148,6 +148,8 @@ class PlotDataItem(GraphicsObject):
'fftMode': False, 'fftMode': False,
'logMode': [False, False], 'logMode': [False, False],
'derivativeMode': False,
'phasemapMode': False,
'alphaHint': 1.0, 'alphaHint': 1.0,
'alphaMode': False, 'alphaMode': False,
@ -214,6 +216,24 @@ class PlotDataItem(GraphicsObject):
self.updateItems() self.updateItems()
self.informViewBoundsChanged() 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): def setPointMode(self, mode):
if self.opts['pointMode'] == mode: if self.opts['pointMode'] == mode:
return return
@ -514,6 +534,12 @@ class PlotDataItem(GraphicsObject):
x = np.log10(x) x = np.log10(x)
if self.opts['logMode'][1]: if self.opts['logMode'][1]:
y = np.log10(y) 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'] ds = self.opts['downsample']
if not isinstance(ds, int): if not isinstance(ds, int):

View File

@ -253,6 +253,8 @@ class PlotItem(GraphicsWidget):
c.fftCheck.toggled.connect(self.updateSpectrumMode) c.fftCheck.toggled.connect(self.updateSpectrumMode)
c.logXCheck.toggled.connect(self.updateLogMode) c.logXCheck.toggled.connect(self.updateLogMode)
c.logYCheck.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.downsampleSpin.valueChanged.connect(self.updateDownsampling)
c.downsampleCheck.toggled.connect(self.updateDownsampling) c.downsampleCheck.toggled.connect(self.updateDownsampling)
@ -905,6 +907,23 @@ class PlotItem(GraphicsWidget):
self.enableAutoRange() self.enableAutoRange()
self.recomputeAverages() 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): def setDownsampling(self, ds=None, auto=None, mode=None):
"""Change the default downsampling mode for all PlotDataItems managed by this plot. """Change the default downsampling mode for all PlotDataItems managed by this plot.

View File

@ -192,17 +192,17 @@
<widget class="QFrame" name="transformGroup"> <widget class="QFrame" name="transformGroup">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>10</x>
<y>0</y> <y>10</y>
<width>154</width> <width>171</width>
<height>79</height> <height>101</height>
</rect> </rect>
</property> </property>
<layout class="QGridLayout" name="gridLayout"> <layout class="QGridLayout" name="gridLayout">
<item row="0" column="0"> <item row="2" column="0">
<widget class="QCheckBox" name="fftCheck"> <widget class="QCheckBox" name="logYCheck">
<property name="text"> <property name="text">
<string>Power Spectrum (FFT)</string> <string>Log Y</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -213,10 +213,24 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="0"> <item row="0" column="0">
<widget class="QCheckBox" name="logYCheck"> <widget class="QCheckBox" name="fftCheck">
<property name="text"> <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> </property>
</widget> </widget>
</item> </item>