5 from scipy import fftpack
7 print "Please install SciPy to run this script (http://www.scipy.org/)"
11 from matplotlib import mlab
13 print "Please install Matplotlib to run this script (http://matplotlib.sourceforge.net)"
17 from PyQt4 import Qt, QtCore, QtGui
19 print "Please install PyQt4 to run this script (http://www.riverbankcomputing.co.uk/software/pyqt/download)"
23 import PyQt4.Qwt5 as Qwt
25 print "Please install PyQwt5 to run this script (http://pyqwt.sourceforge.net/)"
29 # FIXME: reenable this before committing
30 #from gnuradio.pyqt_plot import Ui_MainWindow
31 from pyqt_plot import Ui_MainWindow
33 print "Could not import from pyqt_plot. Please build with \"pyuic4 pyqt_plot.ui -o pyqt_plot.py\""
37 from optparse import OptionParser
38 from gnuradio import eng_notation
41 class SpectrogramData(Qwt.QwtRasterData):
43 def __init__(self, f, t):
44 Qwt.QwtArrayData.__init__(self, Qt.QRectF(0, 0, 0, 0))
45 self.sp = scipy.array([[0], [0]])
47 def set_data(self, xfreq, ytime, data):
51 boundingBox = Qt.QRectF(self.freq.min(), self.time.min(),
52 self.freq.max() - self.freq.min(),
53 self.time.max() - self.time.min())
54 self.setBoundingRect(boundingBox)
56 def rasterHint(self, rect):
57 return Qt.QSize(self.sp.shape[0], self.sp.shape[1])
64 return Qwt.QwtDoubleInterval(self.sp.min(), self.sp.max())
66 def value(self, x, y):
67 f = int(self.freq.searchsorted(x))
68 t = int(self.time.searchsorted(y))
69 return self.sp[f][t-1]
72 class gr_plot_qt(QtGui.QMainWindow):
73 def __init__(self, qapp, filename, options, parent=None):
74 QtGui.QWidget.__init__(self, parent)
75 self.gui = Ui_MainWindow()
76 self.gui.setupUi(self)
79 self.block_length = options.block_length
80 self.start = options.start
81 self.sample_rate = options.sample_rate
82 self.psdfftsize = options.psd_size
83 self.specfftsize = options.spec_size
84 self.winfunc = scipy.blackman
86 self.datatype = scipy.complex64
90 # Set up basic plot attributes
91 self.gui.timePlot.setAxisTitle(self.gui.timePlot.xBottom, "Time (sec)")
92 self.gui.timePlot.setAxisTitle(self.gui.timePlot.yLeft, "Amplitude (V)")
93 self.gui.freqPlot.setAxisTitle(self.gui.freqPlot.xBottom, "Frequency (Hz)")
94 self.gui.freqPlot.setAxisTitle(self.gui.freqPlot.yLeft, "Magnitude (dB)")
95 self.gui.specPlot.setAxisTitle(self.gui.specPlot.xBottom, "Frequency (Hz)")
96 self.gui.specPlot.setAxisTitle(self.gui.specPlot.yLeft, "Time (sec)")
98 # Set up FFT size combo box
99 self.fftsizes = ["128", "256", "512", "1024", "2048",
100 "4096", "8192", "16384", "32768"]
101 self.gui.psdFFTComboBox.addItems(self.fftsizes)
102 self.gui.specFFTComboBox.addItems(self.fftsizes)
103 pos = self.gui.psdFFTComboBox.findText(Qt.QString("%1").arg(self.psdfftsize))
104 self.gui.psdFFTComboBox.setCurrentIndex(pos)
105 pos = self.gui.specFFTComboBox.findText(Qt.QString("%1").arg(self.specfftsize))
106 self.gui.specFFTComboBox.setCurrentIndex(pos)
108 self.connect(self.gui.psdFFTComboBox,
109 Qt.SIGNAL("activated (const QString&)"),
110 self.psdFFTComboBoxEdit)
111 self.connect(self.gui.specFFTComboBox,
112 Qt.SIGNAL("activated (const QString&)"),
113 self.specFFTComboBoxEdit)
115 # Set up color scheme box
116 self.color_modes = {"Black on White" : self.color_black_on_white,
117 "White on Black" : self.color_white_on_black,
118 "Blue on Black" : self.color_blue_on_black,
119 "Green on Black" : self.color_green_on_black}
120 self.gui.colorComboBox.addItems(self.color_modes.keys())
121 pos = self.gui.colorComboBox.findText("Blue on Black")
122 self.gui.colorComboBox.setCurrentIndex(pos)
123 self.connect(self.gui.colorComboBox,
124 Qt.SIGNAL("activated (const QString&)"),
125 self.colorComboBoxEdit)
128 # Create zoom functionality for the plots
129 self.timeZoomer = Qwt.QwtPlotZoomer(self.gui.timePlot.xBottom,
130 self.gui.timePlot.yLeft,
131 Qwt.QwtPicker.PointSelection,
132 Qwt.QwtPicker.AlwaysOn,
133 self.gui.timePlot.canvas())
135 self.freqZoomer = Qwt.QwtPlotZoomer(self.gui.freqPlot.xBottom,
136 self.gui.freqPlot.yLeft,
137 Qwt.QwtPicker.PointSelection,
138 Qwt.QwtPicker.AlwaysOn,
139 self.gui.freqPlot.canvas())
141 self.specZoomer = Qwt.QwtPlotZoomer(self.gui.specPlot.xBottom,
142 self.gui.specPlot.yLeft,
143 Qwt.QwtPicker.PointSelection,
144 Qwt.QwtPicker.AlwaysOn,
145 self.gui.specPlot.canvas())
147 #self.picker = Qwt.QwtPlotPicker(self.gui.timePlot.xBottom,
148 # self.gui.timePlot.yLeft,
149 # Qwt.QwtPicker.PointSelection,
150 # Qwt.QwtPlotPicker.CrossRubberBand,
151 # Qwt.QwtPicker.AlwaysOn,
152 # self.gui.timePlot.canvas())
153 #self.picker.connect(self.picker,
154 # Qt.SIGNAL('selected(const QwtDoublePoint&)'),
157 # Set up action when tab is changed
158 self.connect(self.gui.tabGroup,
159 Qt.SIGNAL("currentChanged (int)"),
162 # Add a legend to the Time plot
163 legend_real = Qwt.QwtLegend()
164 self.gui.timePlot.insertLegend(legend_real)
167 self.gui.plotHBar.setSingleStep(1)
168 self.gui.plotHBar.setPageStep(self.block_length)
169 self.gui.plotHBar.setMinimum(0)
170 self.gui.plotHBar.setMaximum(self.block_length)
171 self.connect(self.gui.plotHBar,
172 Qt.SIGNAL("valueChanged(int)"),
175 # Connect Open action to Open Dialog box
176 self.connect(self.gui.action_open,
177 Qt.SIGNAL("activated()"),
180 # Connect Reload action to reload the file
181 self.connect(self.gui.action_reload,
182 Qt.SIGNAL("activated()"),
184 self.gui.action_reload.setShortcut(QtGui.QApplication.translate("MainWindow", "Ctrl+R",
185 None, QtGui.QApplication.UnicodeUTF8))
187 # Set up file position boxes to update current figure
188 self.connect(self.gui.filePosStartLineEdit,
189 Qt.SIGNAL("editingFinished()"),
190 self.file_position_changed)
191 self.connect(self.gui.filePosStopLineEdit,
192 Qt.SIGNAL("editingFinished()"),
193 self.file_position_changed)
194 self.connect(self.gui.filePosLengthLineEdit,
195 Qt.SIGNAL("editingFinished()"),
196 self.file_length_changed)
198 self.connect(self.gui.fileTimeStartLineEdit,
199 Qt.SIGNAL("editingFinished()"),
200 self.file_time_changed)
201 self.connect(self.gui.fileTimeStopLineEdit,
202 Qt.SIGNAL("editingFinished()"),
203 self.file_time_changed)
204 self.connect(self.gui.fileTimeLengthLineEdit,
205 Qt.SIGNAL("editingFinished()"),
206 self.file_time_length_changed)
208 self.rcurve = Qwt.QwtPlotCurve("Real")
209 self.icurve = Qwt.QwtPlotCurve("Imaginary")
211 self.icurve.attach(self.gui.timePlot)
212 self.rcurve.attach(self.gui.timePlot)
214 self.psdcurve = Qwt.QwtPlotCurve("PSD")
215 self.psdcurve.attach(self.gui.freqPlot)
217 # Set up specTab plot as a spectrogram
218 self.specdata = SpectrogramData(range(0, 10), range(0, 10))
220 colorMap = Qwt.QwtLinearColorMap(Qt.Qt.darkCyan, Qt.Qt.red)
221 colorMap.addColorStop(0.1, Qt.Qt.cyan)
222 colorMap.addColorStop(0.6, Qt.Qt.green)
223 colorMap.addColorStop(0.95, Qt.Qt.yellow)
225 self.spec = Qwt.QwtPlotSpectrogram()
226 self.spec.setColorMap(colorMap)
227 self.spec.attach(self.gui.specPlot)
228 self.spec.setDisplayMode(Qwt.QwtPlotSpectrogram.ImageMode, True)
229 self.spec.setData(self.specdata)
231 self.rightAxis = self.gui.specPlot.axisWidget(Qwt.QwtPlot.yRight)
232 self.rightAxis.setTitle("Magnitude (dBm)")
233 self.rightAxis.setColorBarEnabled(True)
234 self.rightAxis.setColorMap(self.spec.data().range(),
235 self.spec.colorMap())
236 self.gui.specPlot.enableAxis(Qwt.QwtPlot.yRight)
238 # Set up initial color scheme
239 self.color_modes["Blue on Black"]()
241 # Connect a signal for when the sample rate changes
242 self.set_sample_rate(self.sample_rate)
243 self.connect(self.gui.sampleRateLineEdit,
244 Qt.SIGNAL("editingFinished()"),
245 self.sample_rate_changed)
247 if(filename is not None):
248 self.initialize(filename)
253 filename = Qt.QFileDialog.getOpenFileName(self, "Open", ".")
256 self.initialize(filename)
258 def reload_file(self):
260 self.initialize(self.filename)
262 def initialize(self, filename):
263 self.filename = filename
264 self.hfile = open(filename, "r")
266 self.setWindowTitle(("GNU Radio File Plot Utility: %s" % filename))
268 self.gui.filePosStartLineEdit.setText("0")
269 self.gui.filePosStopLineEdit.setText("0")
270 self.gui.fileTimeStartLineEdit.setText("0")
271 self.gui.fileTimeStopLineEdit.setText("0")
274 self.cur_stop = self.block_length
276 self.init_data_input()
277 self.get_data(self.cur_start, self.cur_stop)
280 self.gui.plotHBar.setSliderPosition(0)
281 self.gui.plotHBar.setMaximum(self.signal_size)
284 self.update_time_curves()
285 self.update_psd_curves()
286 self.update_specgram_curves()
288 def init_data_input(self):
289 self.hfile.seek(0, os.SEEK_END)
290 self.signal_size = self.hfile.tell()/self.sizeof_data
291 #print "Sizeof File: ", self.signal_size
292 self.hfile.seek(0, os.SEEK_SET)
294 def get_data(self, start, end):
296 self.hfile.seek(start*self.sizeof_data, os.SEEK_SET)
297 self.position = start
299 iq = scipy.fromfile(self.hfile, dtype=self.datatype,
302 if(len(iq) < (end-start)):
304 self.gui.filePosLengthLineEdit.setText(Qt.QString("%1").arg(end))
305 self.gui.plotHBar.setMaximum(end)
306 self.gui.plotHBar.setSingleStep(end)
307 self.file_length_changed()
309 tstep = 1.0 / self.sample_rate
311 self.time = [tstep*(self.position + i) for i in xrange(len(self.iq))]
313 self.set_file_pos_box(start, end)
317 # Do we want to do anything about this?
321 winpoints = self.winfunc(self.psdfftsize)
322 iq_psd, freq = mlab.psd(self.iq, Fs=self.sample_rate,
323 NFFT=self.psdfftsize,
324 noverlap=self.psdfftsize/4.0,
328 self.iq_psd = 10.0*scipy.log10(abs(fftpack.fftshift(iq_psd)))
329 self.freq = freq - self.sample_rate/2.0
331 def get_specgram(self):
332 winpoints = self.winfunc(self.specfftsize)
333 iq_spec, f, t = mlab.specgram(self.iq, Fs=self.sample_rate,
334 NFFT=self.specfftsize,
335 noverlap=self.specfftsize/4.0,
339 self.iq_spec = 10.0*scipy.log10(abs(iq_spec))
343 def clickMe(self, qPoint):
346 def psdFFTComboBoxEdit(self, fftSize):
347 self.psdfftsize = fftSize.toInt()[0]
349 self.update_psd_curves()
351 def specFFTComboBoxEdit(self, fftSize):
352 self.specfftsize = fftSize.toInt()[0]
354 self.update_specgram_curves()
356 def colorComboBoxEdit(self, colorSelection):
357 colorstr = str(colorSelection.toAscii())
358 color_func = self.color_modes[colorstr]
361 def sliderMoved(self, value):
363 pos_end = value + self.gui.plotHBar.pageStep()
365 self.get_data(pos_start, pos_end)
368 self.update_time_curves()
369 self.update_psd_curves()
370 self.update_specgram_curves()
372 def set_sample_rate(self, sr):
373 self.sample_rate = sr
374 srstr = eng_notation.num_to_str(self.sample_rate)
375 self.gui.sampleRateLineEdit.setText(Qt.QString("%1").arg(srstr))
377 def sample_rate_changed(self):
378 srstr = self.gui.sampleRateLineEdit.text().toAscii()
379 self.sample_rate = eng_notation.str_to_num(srstr)
380 self.set_file_pos_box(self.cur_start, self.cur_stop)
381 self.get_data(self.cur_start, self.cur_stop)
384 self.update_time_curves()
385 self.update_psd_curves()
386 self.update_specgram_curves()
388 def set_file_pos_box(self, start, end):
389 tstart = start / self.sample_rate
390 tend = end / self.sample_rate
392 self.gui.filePosStartLineEdit.setText(Qt.QString("%1").arg(start))
393 self.gui.filePosStopLineEdit.setText(Qt.QString("%1").arg(end))
394 self.gui.filePosLengthLineEdit.setText(Qt.QString("%1").arg(end-start))
396 self.gui.fileTimeStartLineEdit.setText(Qt.QString("%1").arg(tstart))
397 self.gui.fileTimeStopLineEdit.setText(Qt.QString("%1").arg(tend))
398 self.gui.fileTimeLengthLineEdit.setText(Qt.QString("%1").arg(tend-tstart))
400 def file_position_changed(self):
401 start = self.gui.filePosStartLineEdit.text().toInt()
402 end = self.gui.filePosStopLineEdit.text().toInt()
403 if((start[1] == True) and (end[1] == True)):
404 self.cur_start = start[0]
405 self.cur_stop = end[0]
407 tstart = self.cur_start / self.sample_rate
408 tend = self.cur_stop / self.sample_rate
409 self.gui.fileTimeStartLineEdit.setText(Qt.QString("%1").arg(tstart))
410 self.gui.fileTimeStopLineEdit.setText(Qt.QString("%1").arg(tend))
412 self.get_data(self.cur_start, self.cur_stop)
414 self.update_time_curves()
415 self.update_psd_curves()
416 self.update_specgram_curves()
418 # If there's a non-digit character, reset box
420 self.set_file_pos_box(self.cur_start, self.cur_stop)
422 def file_time_changed(self):
423 tstart = self.gui.fileTimeStartLineEdit.text().toDouble()
424 tstop = self.gui.fileTimeStopLineEdit.text().toDouble()
425 if((tstart[1] == True) and (tstop[1] == True)):
426 self.cur_start = int(tstart[0] * self.sample_rate)
427 self.cur_stop = int(tstop[0] * self.sample_rate)
428 self.get_data(self.cur_start, self.cur_stop)
430 self.gui.filePosStartLineEdit.setText(Qt.QString("%1").arg(self.cur_start))
431 self.gui.filePosStopLineEdit.setText(Qt.QString("%1").arg(self.cur_stop))
433 self.update_time_curves()
434 self.update_psd_curves()
435 self.update_specgram_curves()
436 # If there's a non-digit character, reset box
438 self.set_file_pos_box(self.cur_start, self.cur_stop)
440 def file_length_changed(self):
441 start = self.gui.filePosStartLineEdit.text().toInt()
442 length = self.gui.filePosLengthLineEdit.text().toInt()
444 if((start[1] == True) and (length[1] == True)):
445 self.cur_start = start[0]
446 self.block_length = length[0]
447 self.cur_stop = self.cur_start + self.block_length
449 tstart = self.cur_start / self.sample_rate
450 tend = self.cur_stop / self.sample_rate
451 tlen = self.block_length / self.sample_rate
452 self.gui.fileTimeStartLineEdit.setText(Qt.QString("%1").arg(tstart))
453 self.gui.fileTimeStopLineEdit.setText(Qt.QString("%1").arg(tend))
454 self.gui.fileTimeLengthLineEdit.setText(Qt.QString("%1").arg(tlen))
456 self.gui.plotHBar.setPageStep(self.block_length)
458 self.get_data(self.cur_start, self.cur_stop)
462 self.update_time_curves()
463 self.update_psd_curves()
464 self.update_specgram_curves()
465 # If there's a non-digit character, reset box
467 self.set_file_pos_box(self.cur_start, self.cur_stop)
469 def file_time_length_changed(self):
470 tstart = self.gui.fileTimeStartLineEdit.text().toDouble()
471 tlength = self.gui.fileTimeLengthLineEdit.text().toDouble()
472 if((tstart[1] == True) and (tlength[1] == True)):
473 self.cur_start = int(tstart[0] * self.sample_rate)
474 self.block_length = int(tlength[0] * self.sample_rate)
475 self.cur_stop = self.cur_start + self.block_length
477 tstart = self.cur_start / self.sample_rate
478 tend = self.cur_stop / self.sample_rate
479 tlen = self.block_length / self.sample_rate
480 self.gui.fileTimeStartLineEdit.setText(Qt.QString("%1").arg(tstart))
481 self.gui.fileTimeStopLineEdit.setText(Qt.QString("%1").arg(tend))
482 self.gui.fileTimeLengthLineEdit.setText(Qt.QString("%1").arg(tlen))
484 self.get_data(self.cur_start, self.cur_stop)
488 self.update_time_curves()
489 self.update_psd_curves()
490 self.update_specgram_curves()
491 # If there's a non-digit character, reset box
493 self.set_file_pos_box(self.cur_start, self.cur_stop)
496 def update_time_curves(self):
497 self.icurve.setData(self.time, self.iq.imag)
498 self.rcurve.setData(self.time, self.iq.real)
500 # Reset the x-axis to the new time scale
501 iqmax = 1.5 * max(max(self.iq.real), max(self.iq.imag))
502 iqmin = 1.5 * min(min(self.iq.real), min(self.iq.imag))
503 self.gui.timePlot.setAxisScale(self.gui.timePlot.xBottom,
506 self.gui.timePlot.setAxisScale(self.gui.timePlot.yLeft,
510 # Set the zoomer base to unzoom to the new axis
511 self.timeZoomer.setZoomBase()
513 self.gui.timePlot.replot()
515 def update_psd_curves(self):
516 self.psdcurve.setData(self.freq, self.iq_psd)
518 self.gui.freqPlot.setAxisScale(self.gui.freqPlot.xBottom,
522 # Set the zoomer base to unzoom to the new axis
523 self.freqZoomer.setZoomBase()
525 self.gui.freqPlot.replot()
527 def update_specgram_curves(self):
528 # We don't have to reset the data for the speccurve here
529 # since this is taken care of in the SpectrogramData class
530 self.specdata.set_data(self.spec_f, self.spec_t, self.iq_spec)
532 # Set the color map based on the new data
533 self.rightAxis.setColorMap(self.spec.data().range(),
534 self.spec.colorMap())
536 # Set the new axis base; include right axis for the intenisty color bar
537 self.gui.specPlot.setAxisScale(self.gui.specPlot.xBottom,
540 self.gui.specPlot.setAxisScale(self.gui.specPlot.yLeft,
543 self.gui.specPlot.setAxisScale(self.gui.specPlot.yRight,
547 # Set the zoomer base to unzoom to the new axis
548 self.specZoomer.setZoomBase()
550 self.gui.specPlot.replot()
552 def tabChanged(self, index):
553 self.gui.timePlot.replot()
554 self.gui.freqPlot.replot()
556 def color_black_on_white(self):
557 blue = QtGui.qRgb(0x00, 0x00, 0xFF)
558 red = QtGui.qRgb(0xFF, 0x00, 0x00)
560 blackBrush = Qt.QBrush(Qt.QColor("black"))
561 blueBrush = Qt.QBrush(Qt.QColor(blue))
562 redBrush = Qt.QBrush(Qt.QColor(red))
564 self.gui.timePlot.setCanvasBackground(Qt.QColor("white"))
565 self.gui.freqPlot.setCanvasBackground(Qt.QColor("white"))
566 #self.picker.setTrackerPen(Qt.QPen(blackBrush, 2))
567 self.timeZoomer.setTrackerPen(Qt.QPen(blackBrush, 2))
568 self.timeZoomer.setRubberBandPen(Qt.QPen(blackBrush, 2))
569 self.freqZoomer.setTrackerPen(Qt.QPen(blackBrush, 2))
570 self.freqZoomer.setRubberBandPen(Qt.QPen(blackBrush, 2))
571 self.psdcurve.setPen(Qt.QPen(blueBrush, 1))
572 self.rcurve.setPen(Qt.QPen(blueBrush, 2))
573 self.icurve.setPen(Qt.QPen(redBrush, 2))
575 self.gui.timePlot.replot()
576 self.gui.freqPlot.replot()
578 def color_white_on_black(self):
579 white = QtGui.qRgb(0xFF, 0xFF, 0xFF)
580 red = QtGui.qRgb(0xFF, 0x00, 0x00)
582 whiteBrush = Qt.QBrush(Qt.QColor("white"))
583 whiteBrush = Qt.QBrush(Qt.QColor(white))
584 redBrush = Qt.QBrush(Qt.QColor(red))
586 self.gui.timePlot.setCanvasBackground(QtGui.QColor("black"))
587 self.gui.freqPlot.setCanvasBackground(QtGui.QColor("black"))
588 #self.picker.setTrackerPen(Qt.QPen(whiteBrush, 2))
589 self.timeZoomer.setTrackerPen(Qt.QPen(whiteBrush, 2))
590 self.timeZoomer.setRubberBandPen(Qt.QPen(whiteBrush, 2))
591 self.freqZoomer.setTrackerPen(Qt.QPen(whiteBrush, 2))
592 self.freqZoomer.setRubberBandPen(Qt.QPen(whiteBrush, 2))
593 self.psdcurve.setPen(Qt.QPen(whiteBrush, 1))
594 self.rcurve.setPen(Qt.QPen(whiteBrush, 2))
595 self.icurve.setPen(Qt.QPen(redBrush, 2))
597 self.gui.timePlot.replot()
598 self.gui.freqPlot.replot()
601 def color_green_on_black(self):
602 green = QtGui.qRgb(0x00, 0xFF, 0x00)
603 red = QtGui.qRgb(0xFF, 0x00, 0x50)
605 whiteBrush = Qt.QBrush(Qt.QColor("white"))
606 greenBrush = Qt.QBrush(Qt.QColor(green))
607 redBrush = Qt.QBrush(Qt.QColor(red))
609 self.gui.timePlot.setCanvasBackground(QtGui.QColor("black"))
610 self.gui.freqPlot.setCanvasBackground(QtGui.QColor("black"))
611 #self.picker.setTrackerPen(Qt.QPen(whiteBrush, 2))
612 self.timeZoomer.setTrackerPen(Qt.QPen(whiteBrush, 2))
613 self.timeZoomer.setRubberBandPen(Qt.QPen(whiteBrush, 2))
614 self.freqZoomer.setTrackerPen(Qt.QPen(whiteBrush, 2))
615 self.freqZoomer.setRubberBandPen(Qt.QPen(whiteBrush, 2))
616 self.psdcurve.setPen(Qt.QPen(greenBrush, 1))
617 self.rcurve.setPen(Qt.QPen(greenBrush, 2))
618 self.icurve.setPen(Qt.QPen(redBrush, 2))
620 self.gui.timePlot.replot()
621 self.gui.freqPlot.replot()
623 def color_blue_on_black(self):
624 blue = QtGui.qRgb(0x00, 0x00, 0xFF)
625 red = QtGui.qRgb(0xFF, 0x00, 0x00)
627 whiteBrush = Qt.QBrush(Qt.QColor("white"))
628 blueBrush = Qt.QBrush(Qt.QColor(blue))
629 redBrush = Qt.QBrush(Qt.QColor(red))
631 self.gui.timePlot.setCanvasBackground(QtGui.QColor("black"))
632 self.gui.freqPlot.setCanvasBackground(QtGui.QColor("black"))
633 #self.picker.setTrackerPen(Qt.QPen(whiteBrush, 2))
634 self.timeZoomer.setTrackerPen(Qt.QPen(whiteBrush, 2))
635 self.timeZoomer.setRubberBandPen(Qt.QPen(whiteBrush, 2))
636 self.freqZoomer.setTrackerPen(Qt.QPen(whiteBrush, 2))
637 self.freqZoomer.setRubberBandPen(Qt.QPen(whiteBrush, 2))
638 self.psdcurve.setPen(Qt.QPen(blueBrush, 1))
639 self.rcurve.setPen(Qt.QPen(blueBrush, 2))
640 self.icurve.setPen(Qt.QPen(redBrush, 2))
642 self.gui.timePlot.replot()
643 self.gui.freqPlot.replot()
646 usage="%prog: [options] (input_filename)"
649 parser = OptionParser(conflict_handler="resolve", usage=usage, description=description)
650 parser.add_option("-B", "--block-length", type="int", default=8192,
651 help="Specify the block size [default=%default]")
652 parser.add_option("-s", "--start", type="int", default=0,
653 help="Specify where to start in the file [default=%default]")
654 parser.add_option("-R", "--sample-rate", type="float", default=1.0,
655 help="Set the sampler rate of the data [default=%default]")
656 parser.add_option("", "--psd-size", type="int", default=2048,
657 help="Set the size of the PSD FFT [default=%default]")
658 parser.add_option("", "--spec-size", type="int", default=2048,
659 help="Set the size of the spectrogram FFT [default=%default]")
664 parser = setup_options()
665 (options, args) = parser.parse_args ()
672 app = Qt.QApplication(args)
673 gplt = gr_plot_qt(app, filename, options)
676 if __name__ == '__main__':