Adding a QT-based data file viewer.
authorTom <trondeau@vt.edu>
Sat, 15 Aug 2009 03:29:17 +0000 (23:29 -0400)
committerTom <trondeau@vt.edu>
Sat, 15 Aug 2009 03:29:17 +0000 (23:29 -0400)
This is the start of an application to read in data files and display them in a useful manner.

gr-utils/src/python/gr_plot_qt.py [new file with mode: 0755]
gr-utils/src/python/pyqt_plot.py [new file with mode: 0644]
gr-utils/src/python/pyqt_plot.ui [new file with mode: 0644]

diff --git a/gr-utils/src/python/gr_plot_qt.py b/gr-utils/src/python/gr_plot_qt.py
new file mode 100755 (executable)
index 0000000..7c744f2
--- /dev/null
@@ -0,0 +1,504 @@
+#!/usr/bin/env python
+
+try:
+    import scipy
+    from scipy import fftpack
+except ImportError:
+    print "Please install SciPy to run this script (http://www.scipy.org/)"
+    raise SystemExit, 1
+
+import sys, os
+from PyQt4 import Qt, QtCore, QtGui
+import PyQt4.Qwt5 as Qwt
+from matplotlib import mlab
+from optparse import OptionParser
+from gnuradio import eng_notation
+
+from pyqt_plot import Ui_MainWindow
+
+class gr_plot_qt(QtGui.QMainWindow):
+    def __init__(self, qapp, filename, options, parent=None):
+        QtGui.QWidget.__init__(self, parent)
+        self.gui = Ui_MainWindow()
+        self.gui.setupUi(self)
+                       
+        self.block_length = options.block_length
+        self.start = options.start
+        self.sample_rate = options.sample_rate
+        self.psdfftsize = options.psd_size
+        self.specfftsize = options.spec_size
+        self.winfunc = scipy.blackman
+        self.sizeof_data = 8
+        self.datatype = scipy.complex64
+        self.iq = list()
+        self.time = list()
+        
+        # Set up basic plot attributes
+        self.gui.timePlot.setAxisTitle(self.gui.timePlot.xBottom, "Time (sec)")
+        self.gui.timePlot.setAxisTitle(self.gui.timePlot.yLeft, "Amplitude (V)")
+        self.gui.freqPlot.setAxisTitle(self.gui.freqPlot.xBottom, "Frequency (Hz)")
+        self.gui.freqPlot.setAxisTitle(self.gui.freqPlot.yLeft, "Magnitude (dB)")
+
+        # Set up FFT size combo box
+        self.gui.fftComboBox.addItems(["128", "256", "512", "1024", "2048",
+                                       "4096", "8192", "16384", "32768"])
+        pos = self.gui.fftComboBox.findText(Qt.QString("%1").arg(self.psdfftsize))
+        self.gui.fftComboBox.setCurrentIndex(pos)
+        self.connect(self.gui.fftComboBox,
+                     Qt.SIGNAL("activated (const QString&)"),
+                     self.fftComboBoxEdit)
+
+        # Set up color scheme box
+        self.color_modes = {"Black on White" : self.color_black_on_white,
+                            "White on Black" : self.color_white_on_black,
+                            "Blue on Black"  : self.color_blue_on_black,
+                            "Green on Black" : self.color_green_on_black}
+        self.gui.colorComboBox.addItems(self.color_modes.keys())
+        pos = self.gui.colorComboBox.findText("Blue on Black")
+        self.gui.colorComboBox.setCurrentIndex(pos)
+        self.connect(self.gui.colorComboBox,
+                     Qt.SIGNAL("activated (const QString&)"),
+                     self.colorComboBoxEdit)
+        
+        
+        # Create zoom functionality for the plots
+        self.timeZoomer = Qwt.QwtPlotZoomer(self.gui.timePlot.xBottom,
+                                            self.gui.timePlot.yLeft,
+                                            Qwt.QwtPicker.PointSelection,
+                                            Qwt.QwtPicker.AlwaysOn,
+                                            self.gui.timePlot.canvas())
+
+        self.freqZoomer = Qwt.QwtPlotZoomer(self.gui.freqPlot.xBottom,
+                                            self.gui.freqPlot.yLeft,
+                                            Qwt.QwtPicker.PointSelection,
+                                            Qwt.QwtPicker.AlwaysOn,
+                                            self.gui.freqPlot.canvas())
+
+        self.picker = Qwt.QwtPlotPicker(self.gui.timePlot.xBottom,
+                                        self.gui.timePlot.yLeft,
+                                        Qwt.QwtPicker.PointSelection,
+                                        Qwt.QwtPlotPicker.CrossRubberBand,
+                                        Qwt.QwtPicker.AlwaysOn,
+                                        self.gui.timePlot.canvas())
+        self.picker.connect(self.picker,
+                            Qt.SIGNAL('selected(const QwtDoublePoint&)'),
+                            self.clickMe)
+
+        # Set up action when tab is changed
+        self.connect(self.gui.tabGroup,
+                     Qt.SIGNAL("currentChanged (int)"),
+                     self.tabChanged)
+
+        # Add a legend to the Time plot
+        legend_real = Qwt.QwtLegend()
+        self.gui.timePlot.insertLegend(legend_real)
+
+        # Set up slider
+        self.gui.plotHBar.setSingleStep(1)
+        self.gui.plotHBar.setPageStep(self.block_length)
+        self.gui.plotHBar.setMinimum(0)
+        self.gui.plotHBar.setMaximum(self.block_length)
+        self.connect(self.gui.plotHBar,
+                     Qt.SIGNAL("valueChanged(int)"),
+                     self.sliderMoved)
+
+        # Connect Open action to Open Dialog box
+        self.connect(self.gui.action_open,
+                     Qt.SIGNAL("activated()"),
+                     self.open_file)
+        
+        # Set up file position boxes to update current figure
+        self.connect(self.gui.filePosStartLineEdit,
+                     Qt.SIGNAL("editingFinished()"),
+                     self.file_position_changed)
+        self.connect(self.gui.filePosStopLineEdit,
+                     Qt.SIGNAL("editingFinished()"),
+                     self.file_position_changed)
+        self.connect(self.gui.filePosLengthLineEdit,
+                     Qt.SIGNAL("editingFinished()"),
+                     self.file_length_changed)
+
+        self.connect(self.gui.fileTimeStartLineEdit,
+                     Qt.SIGNAL("editingFinished()"),
+                     self.file_time_changed)
+        self.connect(self.gui.fileTimeStopLineEdit,
+                     Qt.SIGNAL("editingFinished()"),
+                     self.file_time_changed)
+        self.connect(self.gui.fileTimeLengthLineEdit,
+                     Qt.SIGNAL("editingFinished()"),
+                     self.file_time_length_changed)
+
+        self.rcurve = Qwt.QwtPlotCurve("Real")
+        self.icurve = Qwt.QwtPlotCurve("Imaginary")
+
+        self.icurve.attach(self.gui.timePlot)
+        self.rcurve.attach(self.gui.timePlot)
+
+        self.psdcurve = Qwt.QwtPlotCurve("PSD")
+        self.psdcurve.attach(self.gui.freqPlot)
+
+        # Set up initial color scheme
+        self.color_modes["Blue on Black"]()
+
+        self.set_sample_rate(self.sample_rate)
+        self.connect(self.gui.sampleRateLineEdit,
+                     Qt.SIGNAL("editingFinished()"),
+                     self.sample_rate_changed)
+
+        if(filename is not None):
+            self.initialize(filename)
+
+        self.show()
+
+    def open_file(self):
+        filename = Qt.QFileDialog.getOpenFileName(self, "Open", ".")
+        print filename
+        self.initialize(filename)
+
+    def initialize(self, filename):
+        self.hfile = open(filename, "r")
+
+        self.setWindowTitle(("GNU Radio File Plot Utility: %s" % filename))
+        
+        self.cur_start = 0
+        self.cur_stop = self.block_length
+
+        self.init_data_input()
+        self.get_data(self.cur_start, self.cur_stop)
+        self.get_psd()
+        self.gui.plotHBar.setSliderPosition(0)
+        self.gui.plotHBar.setMaximum(self.signal_size)
+
+        self.update_time_curves()
+        self.update_psd_curves()
+
+    def init_data_input(self):
+        self.hfile.seek(0, os.SEEK_END)
+        self.signal_size = self.hfile.tell()/self.sizeof_data
+        print "Sizeof File: ", self.signal_size
+        self.hfile.seek(0, os.SEEK_SET)
+        
+    def get_data(self, start, end):
+        if(end > start):
+            self.hfile.seek(start*self.sizeof_data, os.SEEK_SET)
+            self.position = start
+            iq = scipy.fromfile(self.hfile, dtype=self.datatype,
+                                count=end-start)
+            if(len(iq) < (end-start)):
+                print "End of File"
+            else:
+                tstep = 1.0 / self.sample_rate
+                self.iq = iq
+                self.time = [tstep*(self.position + i) for i in xrange(len(self.iq))]
+
+            self.set_file_pos_box(start, end)
+        else:
+            # Do we want to do anything about this?
+            pass
+
+    def get_psd(self):
+        winpoints = self.winfunc(self.psdfftsize)
+        iq_psd, freq = mlab.psd(self.iq, Fs=self.sample_rate,
+                                NFFT=self.psdfftsize,
+                                noverlap=self.psdfftsize/4.0,
+                                window=winpoints,
+                                scale_by_freq=False)
+        self.iq_psd = 10.0*scipy.log10(abs(fftpack.fftshift(iq_psd)))
+        self.freq = freq - self.sample_rate/2.0
+
+
+    def clickMe(self, qPoint):
+        print qPoint.x()
+
+    def fftComboBoxEdit(self, fftSize):
+        self.psdfftsize = fftSize.toInt()[0]
+        self.get_psd()
+        self.update_psd_curves()
+        
+    def colorComboBoxEdit(self, colorSelection):
+        colorstr = str(colorSelection.toAscii())
+        color_func = self.color_modes[colorstr]
+        color_func()
+
+    def sliderMoved(self, value):
+        pos_start = value
+        pos_end = value + self.gui.plotHBar.pageStep()
+
+        self.get_data(pos_start, pos_end)
+        self.get_psd()
+        self.update_time_curves()
+        self.update_psd_curves()
+
+    def set_sample_rate(self, sr):
+        self.sample_rate = sr
+        srstr = eng_notation.num_to_str(self.sample_rate)
+        self.gui.sampleRateLineEdit.setText(Qt.QString("%1").arg(srstr))
+
+    def sample_rate_changed(self):
+        srstr = self.gui.sampleRateLineEdit.text().toAscii()
+        self.sample_rate = eng_notation.str_to_num(srstr)
+        self.set_file_pos_box(self.cur_start, self.cur_stop)
+        self.get_data(self.cur_start, self.cur_stop)
+        self.get_psd()
+        self.update_time_curves()
+        self.update_psd_curves()
+
+    def set_file_pos_box(self, start, end):
+        tstart = start / self.sample_rate
+        tend = end / self.sample_rate
+
+        self.gui.filePosStartLineEdit.setText(Qt.QString("%1").arg(start))
+        self.gui.filePosStopLineEdit.setText(Qt.QString("%1").arg(end))
+        self.gui.filePosLengthLineEdit.setText(Qt.QString("%1").arg(end-start))
+
+        self.gui.fileTimeStartLineEdit.setText(Qt.QString("%1").arg(tstart))
+        self.gui.fileTimeStopLineEdit.setText(Qt.QString("%1").arg(tend))
+        self.gui.fileTimeLengthLineEdit.setText(Qt.QString("%1").arg(tend-tstart))
+
+    def file_position_changed(self):
+        start  = self.gui.filePosStartLineEdit.text().toInt()
+        end    = self.gui.filePosStopLineEdit.text().toInt()
+        if((start[1] == True) and (end[1] == True)):
+            self.cur_start = start[0]
+            self.cur_stop = end[0]
+
+            tstart = self.cur_start / self.sample_rate
+            tend = self.cur_stop / self.sample_rate
+            self.gui.fileTimeStartLineEdit.setText(Qt.QString("%1").arg(tstart))
+            self.gui.fileTimeStopLineEdit.setText(Qt.QString("%1").arg(tend))
+            
+            self.get_data(self.cur_start, self.cur_stop)
+
+            self.update_time_curves()
+            self.update_psd_curves()
+
+        # If there's a non-digit character, reset box
+        else:
+            self.set_file_pos_box(self.cur_start, self.cur_stop)
+
+    def file_time_changed(self):
+        tstart = self.gui.fileTimeStartLineEdit.text().toDouble()
+        tstop  = self.gui.fileTimeStopLineEdit.text().toDouble()
+        if((tstart[1] == True) and (tstop[1] == True)):
+            self.cur_start = int(tstart[0] * self.sample_rate)
+            self.cur_stop = int(tstop[0] * self.sample_rate)
+            self.get_data(self.cur_start, self.cur_stop)
+
+            self.gui.filePosStartLineEdit.setText(Qt.QString("%1").arg(self.cur_start))
+            self.gui.filePosStopLineEdit.setText(Qt.QString("%1").arg(self.cur_stop))
+
+            self.update_time_curves()
+            self.update_psd_curves()
+        # If there's a non-digit character, reset box
+        else:
+            self.set_file_pos_box(self.cur_start, self.cur_stop)
+
+    def file_length_changed(self):
+        start = self.gui.filePosStartLineEdit.text().toInt()
+        length = self.gui.filePosLengthLineEdit.text().toInt()
+        if((start[1] == True) and (length[1] == True)):
+            self.cur_start = start[0]
+            self.block_length = length[0]
+            self.cur_stop = self.cur_start + self.block_length
+
+            tstart = self.cur_start / self.sample_rate
+            tend = self.cur_stop / self.sample_rate
+            tlen = self.block_length / self.sample_rate
+            self.gui.fileTimeStartLineEdit.setText(Qt.QString("%1").arg(tstart))
+            self.gui.fileTimeStopLineEdit.setText(Qt.QString("%1").arg(tend))
+            self.gui.fileTimeLengthLineEdit.setText(Qt.QString("%1").arg(tlen))
+
+            self.gui.plotHBar.setPageStep(self.block_length)
+
+            self.get_data(self.cur_start, self.cur_stop)
+            self.get_psd()
+
+            self.update_time_curves()
+            self.update_psd_curves()
+        # If there's a non-digit character, reset box
+        else:
+            self.set_file_pos_box(self.cur_start, self.cur_stop)
+
+    def file_time_length_changed(self):
+        tstart = self.gui.fileTimeStartLineEdit.text().toDouble()
+        tlength = self.gui.fileTimeLengthLineEdit.text().toDouble()
+        if((tstart[1] == True) and (tlength[1] == True)):
+            self.cur_start = int(tstart[0] * self.sample_rate)
+            self.block_length = int(tlength[0] * self.sample_rate)
+            self.cur_stop = self.cur_start + self.block_length
+
+            tstart = self.cur_start / self.sample_rate
+            tend = self.cur_stop / self.sample_rate
+            tlen = self.block_length / self.sample_rate
+            self.gui.fileTimeStartLineEdit.setText(Qt.QString("%1").arg(tstart))
+            self.gui.fileTimeStopLineEdit.setText(Qt.QString("%1").arg(tend))
+            self.gui.fileTimeLengthLineEdit.setText(Qt.QString("%1").arg(tlen))
+
+            self.get_data(self.cur_start, self.cur_stop)
+            self.get_psd()
+
+            self.update_time_curves()
+            self.update_psd_curves()
+        # If there's a non-digit character, reset box
+        else:
+            self.set_file_pos_box(self.cur_start, self.cur_stop)
+
+
+    def update_time_curves(self):
+        self.icurve.setData(self.time, self.iq.imag)
+        self.rcurve.setData(self.time, self.iq.real)
+
+        # Reset the x-axis to the new time scale
+        iqmax = 1.5 * max(max(self.iq.real), max(self.iq.imag))
+        iqmin = 1.5 * min(min(self.iq.real), min(self.iq.imag))
+        self.gui.timePlot.setAxisScale(self.gui.timePlot.xBottom,
+                                       min(self.time),
+                                       max(self.time))
+        self.gui.timePlot.setAxisScale(self.gui.timePlot.yLeft,
+                                       iqmin,
+                                       iqmax)
+
+        # Set the zoomer base to unzoom to the new axis
+        self.timeZoomer.setZoomBase()
+    
+        self.gui.timePlot.replot()
+        
+    def update_psd_curves(self):
+        self.psdcurve.setData(self.freq, self.iq_psd)
+
+        self.gui.freqPlot.setAxisScale(self.gui.freqPlot.xBottom,
+                                       min(self.freq),
+                                       max(self.freq))
+
+        # Set the zoomer base to unzoom to the new axis
+        self.freqZoomer.setZoomBase()
+
+        self.gui.freqPlot.replot()
+
+    def tabChanged(self, index):
+        self.gui.timePlot.replot()
+        self.gui.freqPlot.replot()
+
+    def color_black_on_white(self):
+        blue = QtGui.qRgb(0x00, 0x00, 0xFF)
+        red = QtGui.qRgb(0xFF, 0x00, 0x00)
+
+        blackBrush = Qt.QBrush(Qt.QColor("black"))
+        blueBrush = Qt.QBrush(Qt.QColor(blue))
+        redBrush = Qt.QBrush(Qt.QColor(red))
+
+        self.gui.timePlot.setCanvasBackground(Qt.QColor("white"))
+        self.gui.freqPlot.setCanvasBackground(Qt.QColor("white"))
+        self.picker.setTrackerPen(Qt.QPen(blackBrush, 2))
+        self.timeZoomer.setTrackerPen(Qt.QPen(blackBrush, 2))
+        self.timeZoomer.setRubberBandPen(Qt.QPen(blackBrush, 2))
+        self.freqZoomer.setTrackerPen(Qt.QPen(blackBrush, 2))
+        self.freqZoomer.setRubberBandPen(Qt.QPen(blackBrush, 2))
+        self.psdcurve.setPen(Qt.QPen(blueBrush, 1))
+        self.rcurve.setPen(Qt.QPen(blueBrush, 2))
+        self.icurve.setPen(Qt.QPen(redBrush, 2))
+
+        self.gui.timePlot.replot()
+        self.gui.freqPlot.replot()
+
+    def color_white_on_black(self):
+        white = QtGui.qRgb(0xFF, 0xFF, 0xFF)
+        red = QtGui.qRgb(0xFF, 0x00, 0x00)
+
+        whiteBrush = Qt.QBrush(Qt.QColor("white"))
+        whiteBrush = Qt.QBrush(Qt.QColor(white))
+        redBrush = Qt.QBrush(Qt.QColor(red))
+        
+        self.gui.timePlot.setCanvasBackground(QtGui.QColor("black"))
+        self.gui.freqPlot.setCanvasBackground(QtGui.QColor("black"))
+        self.picker.setTrackerPen(Qt.QPen(whiteBrush, 2))
+        self.timeZoomer.setTrackerPen(Qt.QPen(whiteBrush, 2))
+        self.timeZoomer.setRubberBandPen(Qt.QPen(whiteBrush, 2))
+        self.freqZoomer.setTrackerPen(Qt.QPen(whiteBrush, 2))
+        self.freqZoomer.setRubberBandPen(Qt.QPen(whiteBrush, 2))
+        self.psdcurve.setPen(Qt.QPen(whiteBrush, 1))
+        self.rcurve.setPen(Qt.QPen(whiteBrush, 2))
+        self.icurve.setPen(Qt.QPen(redBrush, 2))
+
+        self.gui.timePlot.replot()
+        self.gui.freqPlot.replot()
+
+
+    def color_green_on_black(self):
+        green = QtGui.qRgb(0x00, 0xFF, 0x00)
+        red = QtGui.qRgb(0xFF, 0x00, 0x50)
+
+        whiteBrush = Qt.QBrush(Qt.QColor("white"))
+        greenBrush = Qt.QBrush(Qt.QColor(green))
+        redBrush = Qt.QBrush(Qt.QColor(red))
+        
+        self.gui.timePlot.setCanvasBackground(QtGui.QColor("black"))
+        self.gui.freqPlot.setCanvasBackground(QtGui.QColor("black"))
+        self.picker.setTrackerPen(Qt.QPen(whiteBrush, 2))
+        self.timeZoomer.setTrackerPen(Qt.QPen(whiteBrush, 2))
+        self.timeZoomer.setRubberBandPen(Qt.QPen(whiteBrush, 2))
+        self.freqZoomer.setTrackerPen(Qt.QPen(whiteBrush, 2))
+        self.freqZoomer.setRubberBandPen(Qt.QPen(whiteBrush, 2))
+        self.psdcurve.setPen(Qt.QPen(greenBrush, 1))
+        self.rcurve.setPen(Qt.QPen(greenBrush, 2))
+        self.icurve.setPen(Qt.QPen(redBrush, 2))
+
+        self.gui.timePlot.replot()
+        self.gui.freqPlot.replot()
+
+    def color_blue_on_black(self):
+        blue = QtGui.qRgb(0x00, 0x00, 0xFF)
+        red = QtGui.qRgb(0xFF, 0x00, 0x00)
+
+        whiteBrush = Qt.QBrush(Qt.QColor("white"))
+        blueBrush = Qt.QBrush(Qt.QColor(blue))
+        redBrush = Qt.QBrush(Qt.QColor(red))
+        
+        self.gui.timePlot.setCanvasBackground(QtGui.QColor("black"))
+        self.gui.freqPlot.setCanvasBackground(QtGui.QColor("black"))
+        self.picker.setTrackerPen(Qt.QPen(whiteBrush, 2))
+        self.timeZoomer.setTrackerPen(Qt.QPen(whiteBrush, 2))
+        self.timeZoomer.setRubberBandPen(Qt.QPen(whiteBrush, 2))
+        self.freqZoomer.setTrackerPen(Qt.QPen(whiteBrush, 2))
+        self.freqZoomer.setRubberBandPen(Qt.QPen(whiteBrush, 2))
+        self.psdcurve.setPen(Qt.QPen(blueBrush, 1))
+        self.rcurve.setPen(Qt.QPen(blueBrush, 2))
+        self.icurve.setPen(Qt.QPen(redBrush, 2))
+
+        self.gui.timePlot.replot()
+        self.gui.freqPlot.replot()
+
+def setup_options():
+    usage="%prog: [options] (input_filename)"
+    description = ""
+
+    parser = OptionParser(conflict_handler="resolve", usage=usage, description=description)
+    parser.add_option("-B", "--block-length", type="int", default=8192,
+                      help="Specify the block size [default=%default]")
+    parser.add_option("-s", "--start", type="int", default=0,
+                      help="Specify where to start in the file [default=%default]")
+    parser.add_option("-R", "--sample-rate", type="float", default=1.0,
+                      help="Set the sampler rate of the data [default=%default]")
+    parser.add_option("", "--psd-size", type="int", default=2048,
+                      help="Set the size of the PSD FFT [default=%default]")
+    parser.add_option("", "--spec-size", type="int", default=256,
+                      help="Set the size of the spectrogram FFT [default=%default]")
+
+    return parser
+
+def main(args):
+    parser = setup_options()
+    (options, args) = parser.parse_args ()
+
+    if(len(args) == 1):
+        filename = args[0]
+    else:
+        filename = None
+
+    app = Qt.QApplication(args)
+    gplt = gr_plot_qt(app, filename, options)
+    app.exec_()
+
+if __name__ == '__main__':
+    main(sys.argv)
+
diff --git a/gr-utils/src/python/pyqt_plot.py b/gr-utils/src/python/pyqt_plot.py
new file mode 100644 (file)
index 0000000..796b6a2
--- /dev/null
@@ -0,0 +1,182 @@
+# -*- coding: utf-8 -*-
+
+# Form implementation generated from reading ui file 'pyqt_plot.ui'
+#
+# Created: Tue Aug 11 23:12:27 2009
+#      by: PyQt4 UI code generator 4.4.4
+#
+# WARNING! All changes made in this file will be lost!
+
+from PyQt4 import QtCore, QtGui
+
+class Ui_MainWindow(object):
+    def setupUi(self, MainWindow):
+        MainWindow.setObjectName("MainWindow")
+        MainWindow.resize(927, 696)
+        self.centralwidget = QtGui.QWidget(MainWindow)
+        self.centralwidget.setObjectName("centralwidget")
+        self.gridLayout = QtGui.QGridLayout(self.centralwidget)
+        self.gridLayout.setObjectName("gridLayout")
+        self.plotHBar = QtGui.QScrollBar(self.centralwidget)
+        self.plotHBar.setOrientation(QtCore.Qt.Horizontal)
+        self.plotHBar.setObjectName("plotHBar")
+        self.gridLayout.addWidget(self.plotHBar, 2, 0, 1, 2)
+        self.tabGroup = QtGui.QTabWidget(self.centralwidget)
+        self.tabGroup.setObjectName("tabGroup")
+        self.timeTab = QtGui.QWidget()
+        self.timeTab.setObjectName("timeTab")
+        self.horizontalLayout = QtGui.QHBoxLayout(self.timeTab)
+        self.horizontalLayout.setObjectName("horizontalLayout")
+        self.timePlot = Qwt5.QwtPlot(self.timeTab)
+        self.timePlot.setObjectName("timePlot")
+        self.horizontalLayout.addWidget(self.timePlot)
+        self.tabGroup.addTab(self.timeTab, "")
+        self.freqTab = QtGui.QWidget()
+        self.freqTab.setObjectName("freqTab")
+        self.horizontalLayout_2 = QtGui.QHBoxLayout(self.freqTab)
+        self.horizontalLayout_2.setObjectName("horizontalLayout_2")
+        self.fftPropBox = QtGui.QGroupBox(self.freqTab)
+        self.fftPropBox.setMinimumSize(QtCore.QSize(160, 0))
+        self.fftPropBox.setObjectName("fftPropBox")
+        self.formLayoutWidget = QtGui.QWidget(self.fftPropBox)
+        self.formLayoutWidget.setGeometry(QtCore.QRect(0, 20, 151, 191))
+        self.formLayoutWidget.setObjectName("formLayoutWidget")
+        self.formLayout = QtGui.QFormLayout(self.formLayoutWidget)
+        self.formLayout.setObjectName("formLayout")
+        self.fftSizeLabel = QtGui.QLabel(self.formLayoutWidget)
+        self.fftSizeLabel.setObjectName("fftSizeLabel")
+        self.formLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.fftSizeLabel)
+        self.fftComboBox = QtGui.QComboBox(self.formLayoutWidget)
+        self.fftComboBox.setObjectName("fftComboBox")
+        self.formLayout.setWidget(0, QtGui.QFormLayout.FieldRole, self.fftComboBox)
+        self.horizontalLayout_2.addWidget(self.fftPropBox)
+        self.freqPlot = Qwt5.QwtPlot(self.freqTab)
+        self.freqPlot.setObjectName("freqPlot")
+        self.horizontalLayout_2.addWidget(self.freqPlot)
+        self.tabGroup.addTab(self.freqTab, "")
+        self.gridLayout.addWidget(self.tabGroup, 1, 0, 1, 1)
+        self.filePosBox = QtGui.QGroupBox(self.centralwidget)
+        self.filePosBox.setMinimumSize(QtCore.QSize(0, 120))
+        self.filePosBox.setObjectName("filePosBox")
+        self.formLayoutWidget_2 = QtGui.QWidget(self.filePosBox)
+        self.formLayoutWidget_2.setGeometry(QtCore.QRect(0, 20, 160, 92))
+        self.formLayoutWidget_2.setObjectName("formLayoutWidget_2")
+        self.filePosLayout = QtGui.QFormLayout(self.formLayoutWidget_2)
+        self.filePosLayout.setObjectName("filePosLayout")
+        self.filePosStartLabel = QtGui.QLabel(self.formLayoutWidget_2)
+        self.filePosStartLabel.setObjectName("filePosStartLabel")
+        self.filePosLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.filePosStartLabel)
+        self.filePosStartLineEdit = QtGui.QLineEdit(self.formLayoutWidget_2)
+        self.filePosStartLineEdit.setObjectName("filePosStartLineEdit")
+        self.filePosLayout.setWidget(0, QtGui.QFormLayout.FieldRole, self.filePosStartLineEdit)
+        self.filePosStopLabel = QtGui.QLabel(self.formLayoutWidget_2)
+        self.filePosStopLabel.setObjectName("filePosStopLabel")
+        self.filePosLayout.setWidget(1, QtGui.QFormLayout.LabelRole, self.filePosStopLabel)
+        self.filePosStopLineEdit = QtGui.QLineEdit(self.formLayoutWidget_2)
+        self.filePosStopLineEdit.setObjectName("filePosStopLineEdit")
+        self.filePosLayout.setWidget(1, QtGui.QFormLayout.FieldRole, self.filePosStopLineEdit)
+        self.filePosLengthLabel = QtGui.QLabel(self.formLayoutWidget_2)
+        self.filePosLengthLabel.setObjectName("filePosLengthLabel")
+        self.filePosLayout.setWidget(2, QtGui.QFormLayout.LabelRole, self.filePosLengthLabel)
+        self.filePosLengthLineEdit = QtGui.QLineEdit(self.formLayoutWidget_2)
+        self.filePosLengthLineEdit.setObjectName("filePosLengthLineEdit")
+        self.filePosLayout.setWidget(2, QtGui.QFormLayout.FieldRole, self.filePosLengthLineEdit)
+        self.formLayoutWidget_4 = QtGui.QWidget(self.filePosBox)
+        self.formLayoutWidget_4.setGeometry(QtCore.QRect(180, 20, 231, 92))
+        self.formLayoutWidget_4.setObjectName("formLayoutWidget_4")
+        self.fileTimeLayout = QtGui.QFormLayout(self.formLayoutWidget_4)
+        self.fileTimeLayout.setObjectName("fileTimeLayout")
+        self.fileTimeStartLabel = QtGui.QLabel(self.formLayoutWidget_4)
+        self.fileTimeStartLabel.setObjectName("fileTimeStartLabel")
+        self.fileTimeLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.fileTimeStartLabel)
+        self.fileTimeStartLineEdit = QtGui.QLineEdit(self.formLayoutWidget_4)
+        self.fileTimeStartLineEdit.setObjectName("fileTimeStartLineEdit")
+        self.fileTimeLayout.setWidget(0, QtGui.QFormLayout.FieldRole, self.fileTimeStartLineEdit)
+        self.fileTimeStopLabel = QtGui.QLabel(self.formLayoutWidget_4)
+        self.fileTimeStopLabel.setObjectName("fileTimeStopLabel")
+        self.fileTimeLayout.setWidget(1, QtGui.QFormLayout.LabelRole, self.fileTimeStopLabel)
+        self.fileTimeStopLineEdit = QtGui.QLineEdit(self.formLayoutWidget_4)
+        self.fileTimeStopLineEdit.setObjectName("fileTimeStopLineEdit")
+        self.fileTimeLayout.setWidget(1, QtGui.QFormLayout.FieldRole, self.fileTimeStopLineEdit)
+        self.fileTimeLengthLabel = QtGui.QLabel(self.formLayoutWidget_4)
+        self.fileTimeLengthLabel.setObjectName("fileTimeLengthLabel")
+        self.fileTimeLayout.setWidget(2, QtGui.QFormLayout.LabelRole, self.fileTimeLengthLabel)
+        self.fileTimeLengthLineEdit = QtGui.QLineEdit(self.formLayoutWidget_4)
+        self.fileTimeLengthLineEdit.setObjectName("fileTimeLengthLineEdit")
+        self.fileTimeLayout.setWidget(2, QtGui.QFormLayout.FieldRole, self.fileTimeLengthLineEdit)
+        self.sysGroupBox = QtGui.QGroupBox(self.filePosBox)
+        self.sysGroupBox.setGeometry(QtCore.QRect(530, 0, 200, 120))
+        self.sysGroupBox.setMinimumSize(QtCore.QSize(200, 0))
+        self.sysGroupBox.setObjectName("sysGroupBox")
+        self.formLayoutWidget_3 = QtGui.QWidget(self.sysGroupBox)
+        self.formLayoutWidget_3.setGeometry(QtCore.QRect(0, 20, 191, 91))
+        self.formLayoutWidget_3.setObjectName("formLayoutWidget_3")
+        self.formLayout_2 = QtGui.QFormLayout(self.formLayoutWidget_3)
+        self.formLayout_2.setObjectName("formLayout_2")
+        self.sampleRateLabel = QtGui.QLabel(self.formLayoutWidget_3)
+        self.sampleRateLabel.setObjectName("sampleRateLabel")
+        self.formLayout_2.setWidget(0, QtGui.QFormLayout.LabelRole, self.sampleRateLabel)
+        self.sampleRateLineEdit = QtGui.QLineEdit(self.formLayoutWidget_3)
+        self.sampleRateLineEdit.setMinimumSize(QtCore.QSize(0, 0))
+        self.sampleRateLineEdit.setObjectName("sampleRateLineEdit")
+        self.formLayout_2.setWidget(0, QtGui.QFormLayout.FieldRole, self.sampleRateLineEdit)
+        self.displayGroupBox = QtGui.QGroupBox(self.filePosBox)
+        self.displayGroupBox.setGeometry(QtCore.QRect(730, 0, 170, 120))
+        self.displayGroupBox.setMinimumSize(QtCore.QSize(170, 0))
+        self.displayGroupBox.setObjectName("displayGroupBox")
+        self.verticalLayoutWidget = QtGui.QWidget(self.displayGroupBox)
+        self.verticalLayoutWidget.setGeometry(QtCore.QRect(0, 20, 160, 91))
+        self.verticalLayoutWidget.setObjectName("verticalLayoutWidget")
+        self.verticalLayout = QtGui.QVBoxLayout(self.verticalLayoutWidget)
+        self.verticalLayout.setObjectName("verticalLayout")
+        self.colorComboBox = QtGui.QComboBox(self.verticalLayoutWidget)
+        self.colorComboBox.setObjectName("colorComboBox")
+        self.verticalLayout.addWidget(self.colorComboBox)
+        spacerItem = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
+        self.verticalLayout.addItem(spacerItem)
+        self.gridLayout.addWidget(self.filePosBox, 3, 0, 1, 1)
+        MainWindow.setCentralWidget(self.centralwidget)
+        self.menubar = QtGui.QMenuBar(MainWindow)
+        self.menubar.setGeometry(QtCore.QRect(0, 0, 927, 25))
+        self.menubar.setObjectName("menubar")
+        self.menu_File = QtGui.QMenu(self.menubar)
+        self.menu_File.setObjectName("menu_File")
+        MainWindow.setMenuBar(self.menubar)
+        self.statusbar = QtGui.QStatusBar(MainWindow)
+        self.statusbar.setObjectName("statusbar")
+        MainWindow.setStatusBar(self.statusbar)
+        self.action_open = QtGui.QAction(MainWindow)
+        self.action_open.setObjectName("action_open")
+        self.action_exit = QtGui.QAction(MainWindow)
+        self.action_exit.setObjectName("action_exit")
+        self.menu_File.addAction(self.action_open)
+        self.menu_File.addAction(self.action_exit)
+        self.menubar.addAction(self.menu_File.menuAction())
+
+        self.retranslateUi(MainWindow)
+        self.tabGroup.setCurrentIndex(0)
+        QtCore.QObject.connect(self.action_exit, QtCore.SIGNAL("activated()"), MainWindow.close)
+        QtCore.QMetaObject.connectSlotsByName(MainWindow)
+
+    def retranslateUi(self, MainWindow):
+        MainWindow.setWindowTitle(QtGui.QApplication.translate("MainWindow", "MainWindow", None, QtGui.QApplication.UnicodeUTF8))
+        self.tabGroup.setTabText(self.tabGroup.indexOf(self.timeTab), QtGui.QApplication.translate("MainWindow", "Time Domain", None, QtGui.QApplication.UnicodeUTF8))
+        self.fftPropBox.setTitle(QtGui.QApplication.translate("MainWindow", "FFT Properties", None, QtGui.QApplication.UnicodeUTF8))
+        self.fftSizeLabel.setText(QtGui.QApplication.translate("MainWindow", "FFT Size", None, QtGui.QApplication.UnicodeUTF8))
+        self.tabGroup.setTabText(self.tabGroup.indexOf(self.freqTab), QtGui.QApplication.translate("MainWindow", "Frequency Domain", None, QtGui.QApplication.UnicodeUTF8))
+        self.filePosBox.setTitle(QtGui.QApplication.translate("MainWindow", "File Position", None, QtGui.QApplication.UnicodeUTF8))
+        self.filePosStartLabel.setText(QtGui.QApplication.translate("MainWindow", "Start", None, QtGui.QApplication.UnicodeUTF8))
+        self.filePosStopLabel.setText(QtGui.QApplication.translate("MainWindow", "Stop", None, QtGui.QApplication.UnicodeUTF8))
+        self.filePosLengthLabel.setText(QtGui.QApplication.translate("MainWindow", "Length", None, QtGui.QApplication.UnicodeUTF8))
+        self.fileTimeStartLabel.setText(QtGui.QApplication.translate("MainWindow", "time start (sec)", None, QtGui.QApplication.UnicodeUTF8))
+        self.fileTimeStopLabel.setText(QtGui.QApplication.translate("MainWindow", "time stop (sec)", None, QtGui.QApplication.UnicodeUTF8))
+        self.fileTimeLengthLabel.setText(QtGui.QApplication.translate("MainWindow", "time length (sec)", None, QtGui.QApplication.UnicodeUTF8))
+        self.sysGroupBox.setTitle(QtGui.QApplication.translate("MainWindow", "System Properties", None, QtGui.QApplication.UnicodeUTF8))
+        self.sampleRateLabel.setText(QtGui.QApplication.translate("MainWindow", "Sample Rate", None, QtGui.QApplication.UnicodeUTF8))
+        self.displayGroupBox.setTitle(QtGui.QApplication.translate("MainWindow", "Display Properties", None, QtGui.QApplication.UnicodeUTF8))
+        self.menu_File.setTitle(QtGui.QApplication.translate("MainWindow", "&File", None, QtGui.QApplication.UnicodeUTF8))
+        self.action_open.setText(QtGui.QApplication.translate("MainWindow", "&Open", None, QtGui.QApplication.UnicodeUTF8))
+        self.action_open.setShortcut(QtGui.QApplication.translate("MainWindow", "Ctrl+O", None, QtGui.QApplication.UnicodeUTF8))
+        self.action_exit.setText(QtGui.QApplication.translate("MainWindow", "E&xit", None, QtGui.QApplication.UnicodeUTF8))
+
+from PyQt4 import Qwt5
diff --git a/gr-utils/src/python/pyqt_plot.ui b/gr-utils/src/python/pyqt_plot.ui
new file mode 100644 (file)
index 0000000..f298735
--- /dev/null
@@ -0,0 +1,340 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>MainWindow</class>
+ <widget class="QMainWindow" name="MainWindow">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>927</width>
+    <height>696</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>MainWindow</string>
+  </property>
+  <widget class="QWidget" name="centralwidget">
+   <layout class="QGridLayout" name="gridLayout">
+    <item row="2" column="0" colspan="2">
+     <widget class="QScrollBar" name="plotHBar">
+      <property name="orientation">
+       <enum>Qt::Horizontal</enum>
+      </property>
+     </widget>
+    </item>
+    <item row="1" column="0">
+     <widget class="QTabWidget" name="tabGroup">
+      <property name="currentIndex">
+       <number>0</number>
+      </property>
+      <widget class="QWidget" name="timeTab">
+       <attribute name="title">
+        <string>Time Domain</string>
+       </attribute>
+       <layout class="QHBoxLayout" name="horizontalLayout">
+        <item>
+         <widget class="QwtPlot" name="timePlot"/>
+        </item>
+       </layout>
+      </widget>
+      <widget class="QWidget" name="freqTab">
+       <attribute name="title">
+        <string>Frequency Domain</string>
+       </attribute>
+       <layout class="QHBoxLayout" name="horizontalLayout_2">
+        <item>
+         <widget class="QGroupBox" name="fftPropBox">
+          <property name="minimumSize">
+           <size>
+            <width>160</width>
+            <height>0</height>
+           </size>
+          </property>
+          <property name="title">
+           <string>FFT Properties</string>
+          </property>
+          <widget class="QWidget" name="formLayoutWidget">
+           <property name="geometry">
+            <rect>
+             <x>0</x>
+             <y>20</y>
+             <width>151</width>
+             <height>191</height>
+            </rect>
+           </property>
+           <layout class="QFormLayout" name="formLayout">
+            <item row="0" column="0">
+             <widget class="QLabel" name="fftSizeLabel">
+              <property name="text">
+               <string>FFT Size</string>
+              </property>
+             </widget>
+            </item>
+            <item row="0" column="1">
+             <widget class="QComboBox" name="fftComboBox"/>
+            </item>
+           </layout>
+          </widget>
+         </widget>
+        </item>
+        <item>
+         <widget class="QwtPlot" name="freqPlot"/>
+        </item>
+       </layout>
+      </widget>
+     </widget>
+    </item>
+    <item row="3" column="0">
+     <widget class="QGroupBox" name="filePosBox">
+      <property name="minimumSize">
+       <size>
+        <width>0</width>
+        <height>120</height>
+       </size>
+      </property>
+      <property name="title">
+       <string>File Position</string>
+      </property>
+      <widget class="QWidget" name="formLayoutWidget_2">
+       <property name="geometry">
+        <rect>
+         <x>0</x>
+         <y>20</y>
+         <width>160</width>
+         <height>92</height>
+        </rect>
+       </property>
+       <layout class="QFormLayout" name="filePosLayout">
+        <item row="0" column="0">
+         <widget class="QLabel" name="filePosStartLabel">
+          <property name="text">
+           <string>Start</string>
+          </property>
+         </widget>
+        </item>
+        <item row="0" column="1">
+         <widget class="QLineEdit" name="filePosStartLineEdit"/>
+        </item>
+        <item row="1" column="0">
+         <widget class="QLabel" name="filePosStopLabel">
+          <property name="text">
+           <string>Stop</string>
+          </property>
+         </widget>
+        </item>
+        <item row="1" column="1">
+         <widget class="QLineEdit" name="filePosStopLineEdit"/>
+        </item>
+        <item row="2" column="0">
+         <widget class="QLabel" name="filePosLengthLabel">
+          <property name="text">
+           <string>Length</string>
+          </property>
+         </widget>
+        </item>
+        <item row="2" column="1">
+         <widget class="QLineEdit" name="filePosLengthLineEdit"/>
+        </item>
+       </layout>
+      </widget>
+      <widget class="QWidget" name="formLayoutWidget_4">
+       <property name="geometry">
+        <rect>
+         <x>180</x>
+         <y>20</y>
+         <width>231</width>
+         <height>92</height>
+        </rect>
+       </property>
+       <layout class="QFormLayout" name="fileTimeLayout">
+        <item row="0" column="0">
+         <widget class="QLabel" name="fileTimeStartLabel">
+          <property name="text">
+           <string>time start (sec)</string>
+          </property>
+         </widget>
+        </item>
+        <item row="0" column="1">
+         <widget class="QLineEdit" name="fileTimeStartLineEdit"/>
+        </item>
+        <item row="1" column="0">
+         <widget class="QLabel" name="fileTimeStopLabel">
+          <property name="text">
+           <string>time stop (sec)</string>
+          </property>
+         </widget>
+        </item>
+        <item row="1" column="1">
+         <widget class="QLineEdit" name="fileTimeStopLineEdit"/>
+        </item>
+        <item row="2" column="0">
+         <widget class="QLabel" name="fileTimeLengthLabel">
+          <property name="text">
+           <string>time length (sec)</string>
+          </property>
+         </widget>
+        </item>
+        <item row="2" column="1">
+         <widget class="QLineEdit" name="fileTimeLengthLineEdit"/>
+        </item>
+       </layout>
+      </widget>
+      <widget class="QGroupBox" name="sysGroupBox">
+       <property name="geometry">
+        <rect>
+         <x>530</x>
+         <y>0</y>
+         <width>200</width>
+         <height>120</height>
+        </rect>
+       </property>
+       <property name="minimumSize">
+        <size>
+         <width>200</width>
+         <height>0</height>
+        </size>
+       </property>
+       <property name="title">
+        <string>System Properties</string>
+       </property>
+       <widget class="QWidget" name="formLayoutWidget_3">
+        <property name="geometry">
+         <rect>
+          <x>0</x>
+          <y>20</y>
+          <width>191</width>
+          <height>91</height>
+         </rect>
+        </property>
+        <layout class="QFormLayout" name="formLayout_2">
+         <item row="0" column="0">
+          <widget class="QLabel" name="sampleRateLabel">
+           <property name="text">
+            <string>Sample Rate</string>
+           </property>
+          </widget>
+         </item>
+         <item row="0" column="1">
+          <widget class="QLineEdit" name="sampleRateLineEdit">
+           <property name="minimumSize">
+            <size>
+             <width>0</width>
+             <height>0</height>
+            </size>
+           </property>
+          </widget>
+         </item>
+        </layout>
+       </widget>
+      </widget>
+      <widget class="QGroupBox" name="displayGroupBox">
+       <property name="geometry">
+        <rect>
+         <x>730</x>
+         <y>0</y>
+         <width>170</width>
+         <height>120</height>
+        </rect>
+       </property>
+       <property name="minimumSize">
+        <size>
+         <width>170</width>
+         <height>0</height>
+        </size>
+       </property>
+       <property name="title">
+        <string>Display Properties</string>
+       </property>
+       <widget class="QWidget" name="verticalLayoutWidget">
+        <property name="geometry">
+         <rect>
+          <x>0</x>
+          <y>20</y>
+          <width>160</width>
+          <height>91</height>
+         </rect>
+        </property>
+        <layout class="QVBoxLayout" name="verticalLayout">
+         <item>
+          <widget class="QComboBox" name="colorComboBox"/>
+         </item>
+         <item>
+          <spacer name="verticalSpacer">
+           <property name="orientation">
+            <enum>Qt::Vertical</enum>
+           </property>
+           <property name="sizeHint" stdset="0">
+            <size>
+             <width>20</width>
+             <height>40</height>
+            </size>
+           </property>
+          </spacer>
+         </item>
+        </layout>
+       </widget>
+      </widget>
+     </widget>
+    </item>
+   </layout>
+  </widget>
+  <widget class="QMenuBar" name="menubar">
+   <property name="geometry">
+    <rect>
+     <x>0</x>
+     <y>0</y>
+     <width>927</width>
+     <height>25</height>
+    </rect>
+   </property>
+   <widget class="QMenu" name="menu_File">
+    <property name="title">
+     <string>&amp;File</string>
+    </property>
+    <addaction name="action_open"/>
+    <addaction name="action_exit"/>
+   </widget>
+   <addaction name="menu_File"/>
+  </widget>
+  <widget class="QStatusBar" name="statusbar"/>
+  <action name="action_open">
+   <property name="text">
+    <string>&amp;Open</string>
+   </property>
+   <property name="shortcut">
+    <string>Ctrl+O</string>
+   </property>
+  </action>
+  <action name="action_exit">
+   <property name="text">
+    <string>E&amp;xit</string>
+   </property>
+  </action>
+ </widget>
+ <customwidgets>
+  <customwidget>
+   <class>QwtPlot</class>
+   <extends>QFrame</extends>
+   <header>qwt_plot.h</header>
+  </customwidget>
+ </customwidgets>
+ <resources/>
+ <connections>
+  <connection>
+   <sender>action_exit</sender>
+   <signal>activated()</signal>
+   <receiver>MainWindow</receiver>
+   <slot>close()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>-1</x>
+     <y>-1</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>399</x>
+     <y>347</y>
+    </hint>
+   </hints>
+  </connection>
+ </connections>
+</ui>