From 785cacd477d50aba8a412bae16c57681c52a7fd2 Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Tue, 25 Aug 2009 18:22:06 -0400 Subject: [PATCH] Added colorbar to spectrogram for magnitude measurement. --- gr-utils/src/python/gr_plot_qt.py | 18 ++++++++++++++++-- gr-utils/src/python/pyqt_plot.py | 4 ++-- gr-utils/src/python/pyqt_plot.ui | 8 +------- 3 files changed, 19 insertions(+), 11 deletions(-) diff --git a/gr-utils/src/python/gr_plot_qt.py b/gr-utils/src/python/gr_plot_qt.py index 5579bbce..a5e3463c 100755 --- a/gr-utils/src/python/gr_plot_qt.py +++ b/gr-utils/src/python/gr_plot_qt.py @@ -195,10 +195,16 @@ class gr_plot_qt(QtGui.QMainWindow): self.spec = Qwt.QwtPlotSpectrogram() self.spec.setColorMap(colorMap) self.spec.attach(self.gui.specPlot) - self.spec.setContourLevels([0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, 8.5, 9.5]) self.spec.setDisplayMode(Qwt.QwtPlotSpectrogram.ImageMode, True) self.spec.setData(self.specdata) + self.rightAxis = self.gui.specPlot.axisWidget(Qwt.QwtPlot.yRight) + self.rightAxis.setTitle("Magnitude (dBm)") + self.rightAxis.setColorBarEnabled(True) + self.rightAxis.setColorMap(self.spec.data().range(), + self.spec.colorMap()) + self.gui.specPlot.enableAxis(Qwt.QwtPlot.yRight) + # Set up initial color scheme self.color_modes["Blue on Black"]() @@ -488,13 +494,21 @@ class gr_plot_qt(QtGui.QMainWindow): # since this is taken care of in the SpectrogramData class self.specdata.set_data(self.spec_f, self.spec_t, self.iq_spec) + # Set the color map based on the new data + self.rightAxis.setColorMap(self.spec.data().range(), + self.spec.colorMap()) + + # Set the new axis base; include right axis for the intenisty color bar self.gui.specPlot.setAxisScale(self.gui.specPlot.xBottom, min(self.spec_f), max(self.spec_f)) self.gui.specPlot.setAxisScale(self.gui.specPlot.yLeft, min(self.spec_t), max(self.spec_t)) - + self.gui.specPlot.setAxisScale(self.gui.specPlot.yRight, + self.iq_spec.min(), + self.iq_spec.max()) + # Set the zoomer base to unzoom to the new axis self.specZoomer.setZoomBase() diff --git a/gr-utils/src/python/pyqt_plot.py b/gr-utils/src/python/pyqt_plot.py index 2724d854..74c43c3e 100644 --- a/gr-utils/src/python/pyqt_plot.py +++ b/gr-utils/src/python/pyqt_plot.py @@ -2,7 +2,7 @@ # Form implementation generated from reading ui file 'pyqt_plot.ui' # -# Created: Tue Aug 25 15:28:55 2009 +# Created: Tue Aug 25 18:18:14 2009 # by: PyQt4 UI code generator 4.4.3 # # WARNING! All changes made in this file will be lost! @@ -175,7 +175,7 @@ class Ui_MainWindow(object): self.menubar.addAction(self.menu_File.menuAction()) self.retranslateUi(MainWindow) - self.tabGroup.setCurrentIndex(2) + self.tabGroup.setCurrentIndex(0) QtCore.QObject.connect(self.action_exit, QtCore.SIGNAL("activated()"), MainWindow.close) QtCore.QMetaObject.connectSlotsByName(MainWindow) diff --git a/gr-utils/src/python/pyqt_plot.ui b/gr-utils/src/python/pyqt_plot.ui index 62125962..19a62adf 100644 --- a/gr-utils/src/python/pyqt_plot.ui +++ b/gr-utils/src/python/pyqt_plot.ui @@ -24,7 +24,7 @@ - 2 + 0 @@ -80,9 +80,6 @@ - formLayoutWidget - psdFFTComboBox - psdFFTSizeLabel @@ -125,9 +122,6 @@ - specFFTLabel - specFFTComboBox - specFFTComboBox -- 2.47.2