diff options
Diffstat (limited to 'gr-utils/plot_tools')
-rwxr-xr-x | gr-utils/plot_tools/gr_plot | 2 | ||||
-rwxr-xr-x | gr-utils/plot_tools/gr_plot_const | 25 | ||||
-rwxr-xr-x | gr-utils/plot_tools/gr_plot_fft | 2 | ||||
-rwxr-xr-x | gr-utils/plot_tools/gr_plot_iq | 18 | ||||
-rwxr-xr-x | gr-utils/plot_tools/gr_plot_psd | 2 | ||||
-rwxr-xr-x | gr-utils/plot_tools/gr_plot_qt | 114 | ||||
-rw-r--r-- | gr-utils/plot_tools/plot_data.py | 80 | ||||
-rw-r--r-- | gr-utils/plot_tools/plot_fft_base.py | 115 | ||||
-rw-r--r-- | gr-utils/plot_tools/plot_psd_base.py | 137 | ||||
-rw-r--r-- | gr-utils/plot_tools/pyqt_filter.py | 416 | ||||
-rw-r--r-- | gr-utils/plot_tools/pyqt_plot.py | 140 |
11 files changed, 663 insertions, 388 deletions
diff --git a/gr-utils/plot_tools/gr_plot b/gr-utils/plot_tools/gr_plot index 84601fda02..14fb3a4c86 100755 --- a/gr-utils/plot_tools/gr_plot +++ b/gr-utils/plot_tools/gr_plot @@ -16,9 +16,9 @@ def main(): args = parser.parse_args() plot_data(None, args.files, args) + if __name__ == "__main__": try: main() except KeyboardInterrupt: pass - diff --git a/gr-utils/plot_tools/gr_plot_const b/gr-utils/plot_tools/gr_plot_const index 18f781e516..aa4350eb5c 100755 --- a/gr-utils/plot_tools/gr_plot_const +++ b/gr-utils/plot_tools/gr_plot_const @@ -76,7 +76,8 @@ class draw_constellation: [0.45, 0.01, 0.05, 0.05], frameon=True ) self.button_left = Button(self.button_left_axes, "<") - self.button_left_callback = self.button_left.on_clicked(self.button_left_click) + self.button_left_callback = self.button_left.on_clicked( + self.button_left_click) self.button_right_axes = self.fig.add_axes( [0.50, 0.01, 0.05, 0.05], frameon=True @@ -112,7 +113,8 @@ class draw_constellation: self.imags = numpy.array([i.imag for i in iq]) self.time = numpy.array( - [i * (1 / self.sample_rate) for i in range(len(self.reals))] + [i * (1 / self.sample_rate) + for i in range(len(self.reals))] ) return True else: @@ -126,8 +128,10 @@ class draw_constellation: r = self.get_data() # Subplot for real and imaginary parts of signal - self.sp_iq = self.fig.add_subplot(2, 1, 1, position=[0.075, 0.2, 0.4, 0.6]) - self.sp_iq.set_title(("I&Q"), fontsize=self.title_font_size, fontweight="bold") + self.sp_iq = self.fig.add_subplot( + 2, 1, 1, position=[0.075, 0.2, 0.4, 0.6]) + self.sp_iq.set_title( + ("I&Q"), fontsize=self.title_font_size, fontweight="bold") self.sp_iq.set_xlabel( "Time (s)", fontsize=self.label_font_size, fontweight="bold" ) @@ -139,7 +143,8 @@ class draw_constellation: ) # Subplot for constellation plot - self.sp_const = self.fig.add_subplot(2, 2, 1, position=[0.575, 0.2, 0.4, 0.6]) + self.sp_const = self.fig.add_subplot( + 2, 2, 1, position=[0.575, 0.2, 0.4, 0.6]) self.sp_const.set_title( ("Constellation"), fontsize=self.title_font_size, fontweight="bold" ) @@ -219,8 +224,8 @@ class draw_constellation: curxlim = numpy.array(self.xlim) if newxlim[0] != curxlim[0] or newxlim[1] != curxlim[1]: self.xlim = newxlim - r = self.reals[int(ceil(self.xlim[0])) : int(ceil(self.xlim[1]))] - i = self.imags[int(ceil(self.xlim[0])) : int(ceil(self.xlim[1]))] + r = self.reals[int(ceil(self.xlim[0])): int(ceil(self.xlim[1]))] + i = self.imags[int(ceil(self.xlim[0])): int(ceil(self.xlim[1]))] self.plot_const[0].set_data(r, i) self.sp_const.axis([-2, 2, -2, 2]) @@ -297,7 +302,8 @@ def find(item_in, list_search): def main(): description = "Takes a GNU Radio complex binary file and displays the I&Q data versus time and the constellation plot (I vs. Q). You can set the block size to specify how many points to read in at a time and the start position in the file. By default, the system assumes a sample rate of 1, so in time, each sample is plotted versus the sample number. To set a true time axis, set the sample rate (-R or --sample-rate) to the sample rate used when capturing the samples." - parser = ArgumentParser(conflict_handler="resolve", description=description) + parser = ArgumentParser(conflict_handler="resolve", + description=description) parser.add_argument( "-B", "--block", @@ -319,7 +325,8 @@ def main(): default=1.0, help="Set the sampler rate of the data [default=%(default)r]", ) - parser.add_argument("file", metavar="FILE", help="Input file with complex samples") + parser.add_argument("file", metavar="FILE", + help="Input file with complex samples") args = parser.parse_args() dc = draw_constellation(args.file, args) diff --git a/gr-utils/plot_tools/gr_plot_fft b/gr-utils/plot_tools/gr_plot_fft index 9851c08007..e57eb234d1 100755 --- a/gr-utils/plot_tools/gr_plot_fft +++ b/gr-utils/plot_tools/gr_plot_fft @@ -13,12 +13,14 @@ from gnuradio.plot_fft_base import plot_fft_base # This is a wrapper program for plot_fft_base. It handles any data # type and defaults to complex64. + def main(): parser = plot_fft_base.setup_options() args = parser.parse_args() plot_fft_base(None, args.file, args) + if __name__ == "__main__": try: main() diff --git a/gr-utils/plot_tools/gr_plot_iq b/gr-utils/plot_tools/gr_plot_iq index ba3838c081..77833ee256 100755 --- a/gr-utils/plot_tools/gr_plot_iq +++ b/gr-utils/plot_tools/gr_plot_iq @@ -79,7 +79,8 @@ class draw_iq: [0.45, 0.01, 0.05, 0.05], frameon=True ) self.button_left = Button(self.button_left_axes, "<") - self.button_left_callback = self.button_left.on_clicked(self.button_left_click) + self.button_left_callback = self.button_left.on_clicked( + self.button_left_click) self.button_right_axes = self.fig.add_axes( [0.50, 0.01, 0.05, 0.05], frameon=True @@ -119,15 +120,18 @@ class draw_iq: self.get_data() # Subplot for real and imaginary parts of signal - self.sp_iq = self.fig.add_subplot(2, 1, 1, position=[0.075, 0.14, 0.85, 0.67]) - self.sp_iq.set_title(("I&Q"), fontsize=self.title_font_size, fontweight="bold") + self.sp_iq = self.fig.add_subplot( + 2, 1, 1, position=[0.075, 0.14, 0.85, 0.67]) + self.sp_iq.set_title( + ("I&Q"), fontsize=self.title_font_size, fontweight="bold") self.sp_iq.set_xlabel( "Time (s)", fontsize=self.label_font_size, fontweight="bold" ) self.sp_iq.set_ylabel( "Amplitude (V)", fontsize=self.label_font_size, fontweight="bold" ) - self.plot_iq = plot(self.time, self.reals, "bo-", self.time, self.imags, "ro-") + self.plot_iq = plot(self.time, self.reals, "bo-", + self.time, self.imags, "ro-") self.sp_iq.set_ylim( [ 1.5 * min([self.reals.min(), self.imags.min()]), @@ -189,7 +193,8 @@ def find(item_in, list_search): def main(): description = "Takes a GNU Radio complex binary file and displays the I&Q data versus time. You can set the block size to specify how many points to read in at a time and the start position in the file. By default, the system assumes a sample rate of 1, so in time, each sample is plotted versus the sample number. To set a true time axis, set the sample rate (-R or --sample-rate) to the sample rate used when capturing the samples." - parser = ArgumentParser(conflict_handler="resolve", description=description) + parser = ArgumentParser(conflict_handler="resolve", + description=description) parser.add_argument( "-B", "--block", @@ -211,7 +216,8 @@ def main(): default=1.0, help="Set the sampler rate of the data [default=%(default)r]", ) - parser.add_argument("file", metavar="FILE", help="Input file with complex samples") + parser.add_argument("file", metavar="FILE", + help="Input file with complex samples") args = parser.parse_args() diff --git a/gr-utils/plot_tools/gr_plot_psd b/gr-utils/plot_tools/gr_plot_psd index 9576eeac9b..f8c75bfe52 100755 --- a/gr-utils/plot_tools/gr_plot_psd +++ b/gr-utils/plot_tools/gr_plot_psd @@ -13,12 +13,14 @@ from gnuradio.plot_psd_base import plot_psd_base # This is a wrapper program for plot_psd_base. It handles any data # type and defaults to complex64. + def main(): parser = plot_psd_base.setup_options() args = parser.parse_args() plot_psd_base(None, args.file, args) + if __name__ == "__main__": try: main() diff --git a/gr-utils/plot_tools/gr_plot_qt b/gr-utils/plot_tools/gr_plot_qt index aada9e0bba..cd24270ab4 100755 --- a/gr-utils/plot_tools/gr_plot_qt +++ b/gr-utils/plot_tools/gr_plot_qt @@ -28,7 +28,8 @@ except ImportError: print("Could not import from pyqt_plot. Please build with \"pyuic4 pyqt_plot.ui -o pyqt_plot.py\"") raise SystemExit(1) -import sys, os +import sys +import os from optparse import OptionParser from gnuradio import eng_notation @@ -62,8 +63,8 @@ class SpectrogramData(Qwt.QwtRasterData): try: f = int(self.freq.searchsorted(x)) t = int(self.time.searchsorted(y)) - return self.sp[f][t-1] - except AttributeError: # if no file loaded yet + return self.sp[f][t - 1] + except AttributeError: # if no file loaded yet return 0 @@ -88,10 +89,14 @@ class gr_plot_qt(QtGui.QMainWindow): # 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)") - self.gui.specPlot.setAxisTitle(self.gui.specPlot.xBottom, "Frequency (Hz)") + 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)") + self.gui.specPlot.setAxisTitle( + self.gui.specPlot.xBottom, "Frequency (Hz)") self.gui.specPlot.setAxisTitle(self.gui.specPlot.yLeft, "Time (sec)") # Set up FFT size combo box @@ -99,9 +104,11 @@ class gr_plot_qt(QtGui.QMainWindow): "4096", "8192", "16384", "32768"] self.gui.psdFFTComboBox.addItems(self.fftsizes) self.gui.specFFTComboBox.addItems(self.fftsizes) - pos = self.gui.psdFFTComboBox.findText(Qt.QString("%1").arg(self.psdfftsize)) + pos = self.gui.psdFFTComboBox.findText( + Qt.QString("%1").arg(self.psdfftsize)) self.gui.psdFFTComboBox.setCurrentIndex(pos) - pos = self.gui.specFFTComboBox.findText(Qt.QString("%1").arg(self.specfftsize)) + pos = self.gui.specFFTComboBox.findText( + Qt.QString("%1").arg(self.specfftsize)) self.gui.specFFTComboBox.setCurrentIndex(pos) self.connect(self.gui.psdFFTComboBox, @@ -112,10 +119,10 @@ class gr_plot_qt(QtGui.QMainWindow): self.specFFTComboBoxEdit) # 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.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) @@ -123,12 +130,11 @@ class gr_plot_qt(QtGui.QMainWindow): Qt.SIGNAL("activated (const QString&)"), self.colorComboBoxEdit) - # Set up line style combo box - self.line_styles = {"None" : Qwt.QwtSymbol.NoSymbol, - "Circle" : Qwt.QwtSymbol.Ellipse, - "Diamond" : Qwt.QwtSymbol.Rect, - "Triangle" : Qwt.QwtSymbol.Triangle} + self.line_styles = {"None": Qwt.QwtSymbol.NoSymbol, + "Circle": Qwt.QwtSymbol.Ellipse, + "Diamond": Qwt.QwtSymbol.Rect, + "Triangle": Qwt.QwtSymbol.Triangle} self.gui.lineStyleComboBox.addItems(self.line_styles.keys()) pos = self.gui.lineStyleComboBox.findText("None") self.gui.lineStyleComboBox.setCurrentIndex(pos) @@ -220,7 +226,6 @@ class gr_plot_qt(QtGui.QMainWindow): self.rcurve.setSymbol(self.rsym) self.icurve.setSymbol(self.isym) - self.icurve.attach(self.gui.timePlot) self.rcurve.attach(self.gui.timePlot) @@ -264,7 +269,6 @@ class gr_plot_qt(QtGui.QMainWindow): self.gui.styleSizeSpinBox.setRange(1, 20) self.gui.styleSizeSpinBox.setValue(5) - # Connect a signal for when the sample rate changes self.set_sample_rate(self.sample_rate) self.connect(self.gui.sampleRateLineEdit, @@ -279,7 +283,7 @@ class gr_plot_qt(QtGui.QMainWindow): def open_file(self): filename = Qt.QFileDialog.getOpenFileName(self, "Open", ".") if(filename != ""): - #print(filename) + # print(filename) self.initialize(filename) def reload_file(self): @@ -305,8 +309,7 @@ class gr_plot_qt(QtGui.QMainWindow): self.get_psd() self.get_specgram() self.gui.plotHBar.setSliderPosition(0) - self.gui.plotHBar.setMaximum(self.signal_size-self.block_length) - + self.gui.plotHBar.setMaximum(self.signal_size - self.block_length) self.update_time_curves() self.update_psd_curves() @@ -314,26 +317,28 @@ class gr_plot_qt(QtGui.QMainWindow): def init_data_input(self): self.hfile.seek(0, os.SEEK_END) - self.signal_size = self.hfile.tell()/self.sizeof_data + 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.hfile.seek(start * self.sizeof_data, os.SEEK_SET) self.position = start try: iq = numpy.fromfile(self.hfile, dtype=self.datatype, - count=end-start) + count=end - start) - if(len(iq) < (end-start)): + if(len(iq) < (end - start)): end = start + len(iq) - self.gui.filePosLengthLineEdit.setText(Qt.QString("%1").arg(len(iq))) + self.gui.filePosLengthLineEdit.setText( + Qt.QString("%1").arg(len(iq))) self.file_length_changed() tstep = 1.0 / self.sample_rate self.iq = iq - self.time = [tstep*(self.position + i) for i in range(len(self.iq))] + self.time = [tstep * (self.position + i) + for i in range(len(self.iq))] self.set_file_pos_box(start, end) except MemoryError: @@ -346,22 +351,22 @@ class gr_plot_qt(QtGui.QMainWindow): winpoints = self.winfunc(self.psdfftsize) iq_psd, freq = mlab.psd(self.iq, Fs=self.sample_rate, NFFT=self.psdfftsize, - noverlap=self.psdfftsize/4.0, + noverlap=self.psdfftsize / 4.0, window=winpoints, scale_by_freq=False) - self.iq_psd = 10.0*numpy.log10(abs(numpy.fft.fftshift(iq_psd))) - self.freq = freq - self.sample_rate/2.0 + self.iq_psd = 10.0 * numpy.log10(abs(numpy.fft.fftshift(iq_psd))) + self.freq = freq - self.sample_rate / 2.0 def get_specgram(self): winpoints = self.winfunc(self.specfftsize) iq_spec, f, t = mlab.specgram(self.iq, Fs=self.sample_rate, NFFT=self.specfftsize, - noverlap=self.specfftsize/4.0, + noverlap=self.specfftsize / 4.0, window=winpoints, scale_by_freq=False) - self.iq_spec = 10.0*numpy.log10(abs(iq_spec)) + self.iq_spec = 10.0 * numpy.log10(abs(iq_spec)) self.spec_f = f self.spec_t = t @@ -421,22 +426,25 @@ class gr_plot_qt(QtGui.QMainWindow): 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.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)) + 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() + 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.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) @@ -452,17 +460,18 @@ class gr_plot_qt(QtGui.QMainWindow): except AttributeError: pass - def file_time_changed(self): tstart = self.gui.fileTimeStartLineEdit.text().toDouble() - tstop = self.gui.fileTimeStopLineEdit.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.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() @@ -483,7 +492,8 @@ class gr_plot_qt(QtGui.QMainWindow): 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.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)) @@ -511,7 +521,8 @@ class gr_plot_qt(QtGui.QMainWindow): 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.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)) @@ -526,7 +537,6 @@ class gr_plot_qt(QtGui.QMainWindow): 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) @@ -645,7 +655,6 @@ class gr_plot_qt(QtGui.QMainWindow): 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) @@ -688,11 +697,13 @@ class gr_plot_qt(QtGui.QMainWindow): self.gui.timePlot.replot() self.gui.freqPlot.replot() + def setup_options(): - usage="%prog: [options] (input_filename)" + usage = "%prog: [options] (input_filename)" description = "" - parser = OptionParser(conflict_handler="resolve", usage=usage, description=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, @@ -706,9 +717,10 @@ def setup_options(): return parser + def main(args): parser = setup_options() - (options, args) = parser.parse_args () + (options, args) = parser.parse_args() if(len(args) == 1): filename = args[0] @@ -719,6 +731,6 @@ def main(args): gplt = gr_plot_qt(app, filename, options) app.exec_() + if __name__ == '__main__': main(sys.argv) - diff --git a/gr-utils/plot_tools/plot_data.py b/gr-utils/plot_tools/plot_data.py index 4a42659514..18e7ae87e4 100644 --- a/gr-utils/plot_tools/plot_data.py +++ b/gr-utils/plot_tools/plot_data.py @@ -33,6 +33,7 @@ datatype_lookup = { "int8": numpy.int8, } + class plot_data(object): def __init__(self, datatype, filenames, options): self.hfile = list() @@ -48,7 +49,8 @@ class plot_data(object): self.datatype = datatype if self.datatype is None: self.datatype = datatype_lookup[options.data_type] - self.sizeof_data = self.datatype().nbytes # number of bytes per sample in file + # number of bytes per sample in file + self.sizeof_data = self.datatype().nbytes self.axis_font_size = 16 self.label_font_size = 18 @@ -60,20 +62,25 @@ class plot_data(object): rcParams['xtick.labelsize'] = self.axis_font_size rcParams['ytick.labelsize'] = self.axis_font_size - self.text_file_pos = figtext(0.10, 0.88, "File Position: ", weight="heavy", size=self.text_size) - self.text_block = figtext(0.40, 0.88, ("Block Size: %d" % self.block_length), - weight="heavy", size=self.text_size) - self.text_sr = figtext(0.60, 0.88, ("Sample Rate: %.2f" % self.sample_rate), - weight="heavy", size=self.text_size) + self.text_file_pos = figtext( + 0.10, 0.88, "File Position: ", weight="heavy", size=self.text_size) + self.text_block = figtext(0.40, 0.88, ("Block Size: %d" % self.block_length), + weight="heavy", size=self.text_size) + self.text_sr = figtext(0.60, 0.88, ("Sample Rate: %.2f" % self.sample_rate), + weight="heavy", size=self.text_size) self.make_plots() - self.button_left_axes = self.fig.add_axes([0.45, 0.01, 0.05, 0.05], frameon=True) + self.button_left_axes = self.fig.add_axes( + [0.45, 0.01, 0.05, 0.05], frameon=True) self.button_left = Button(self.button_left_axes, "<") - self.button_left_callback = self.button_left.on_clicked(self.button_left_click) + self.button_left_callback = self.button_left.on_clicked( + self.button_left_click) - self.button_right_axes = self.fig.add_axes([0.50, 0.01, 0.05, 0.05], frameon=True) + self.button_right_axes = self.fig.add_axes( + [0.50, 0.01, 0.05, 0.05], frameon=True) self.button_right = Button(self.button_right_axes, ">") - self.button_right_callback = self.button_right.on_clicked(self.button_right_click) + self.button_right_callback = self.button_right.on_clicked( + self.button_right_click) self.xlim = self.sp_f.get_xlim() @@ -82,20 +89,27 @@ class plot_data(object): show() def get_data(self, hfile): - self.text_file_pos.set_text("File Position: %d" % (hfile.tell()//self.sizeof_data)) + self.text_file_pos.set_text( + "File Position: %d" % (hfile.tell() // self.sizeof_data)) try: - f = numpy.fromfile(hfile, dtype=self.datatype, count=self.block_length) + f = numpy.fromfile(hfile, dtype=self.datatype, + count=self.block_length) except MemoryError: print("End of File") else: self.f = numpy.array(f) - self.time = numpy.array([i*(1 / self.sample_rate) for i in range(len(self.f))]) + self.time = numpy.array([i * (1 / self.sample_rate) + for i in range(len(self.f))]) def make_plots(self): - self.sp_f = self.fig.add_subplot(2,1,1, position=[0.075, 0.2, 0.875, 0.6]) - self.sp_f.set_title(("Amplitude"), fontsize=self.title_font_size, fontweight="bold") - self.sp_f.set_xlabel("Time (s)", fontsize=self.label_font_size, fontweight="bold") - self.sp_f.set_ylabel("Amplitude (V)", fontsize=self.label_font_size, fontweight="bold") + self.sp_f = self.fig.add_subplot( + 2, 1, 1, position=[0.075, 0.2, 0.875, 0.6]) + self.sp_f.set_title( + ("Amplitude"), fontsize=self.title_font_size, fontweight="bold") + self.sp_f.set_xlabel( + "Time (s)", fontsize=self.label_font_size, fontweight="bold") + self.sp_f.set_ylabel( + "Amplitude (V)", fontsize=self.label_font_size, fontweight="bold") self.plot_f = list() maxval = -1e12 @@ -103,7 +117,7 @@ class plot_data(object): for hf in self.hfile: # if specified on the command-line, set file pointer - hf.seek(self.sizeof_data*self.start, 1) + hf.seek(self.sizeof_data * self.start, 1) self.get_data(hf) @@ -112,7 +126,7 @@ class plot_data(object): maxval = max(maxval, self.f.max()) minval = min(minval, self.f.min()) - self.sp_f.set_ylim([1.5*minval, 1.5*maxval]) + self.sp_f.set_ylim([1.5 * minval, 1.5 * maxval]) self.leg = self.sp_f.legend(self.plot_f, self.legend_text) @@ -121,13 +135,13 @@ class plot_data(object): def update_plots(self): maxval = -1e12 minval = 1e12 - for hf,p in zip(self.hfile,self.plot_f): + for hf, p in zip(self.hfile, self.plot_f): self.get_data(hf) p.set_data([self.time, self.f]) maxval = max(maxval, self.f.max()) minval = min(minval, self.f.min()) - self.sp_f.set_ylim([1.5*minval, 1.5*maxval]) + self.sp_f.set_ylim([1.5 * minval, 1.5 * maxval]) draw() @@ -153,31 +167,33 @@ class plot_data(object): def step_backward(self): for hf in self.hfile: # Step back in file position - if(hf.tell() >= 2*self.sizeof_data*self.block_length ): - hf.seek(-2*self.sizeof_data*self.block_length, 1) + if(hf.tell() >= 2 * self.sizeof_data * self.block_length): + hf.seek(-2 * self.sizeof_data * self.block_length, 1) else: - hf.seek(-hf.tell(),1) + hf.seek(-hf.tell(), 1) self.update_plots() @staticmethod def setup_options(): description = "Takes a GNU Radio binary file and displays the samples versus time. You can set the block size to specify how many points to read in at a time and the start position in the file. By default, the system assumes a sample rate of 1, so in time, each sample is plotted versus the sample number. To set a true time axis, set the sample rate (-R or --sample-rate) to the sample rate used when capturing the samples." - parser = ArgumentParser(conflict_handler="resolve", description=description) + parser = ArgumentParser( + conflict_handler="resolve", description=description) parser.add_argument("-d", "--data-type", default="complex64", - choices=("complex64", "float32", "uint32", "int32", "uint16", - "int16", "uint8", "int8"), - help="Specify the data type [default=%(default)r]") + choices=("complex64", "float32", "uint32", "int32", "uint16", + "int16", "uint8", "int8"), + help="Specify the data type [default=%(default)r]") parser.add_argument("-B", "--block", type=int, default=1000, - help="Specify the block size [default=%(default)r]") + help="Specify the block size [default=%(default)r]") parser.add_argument("-s", "--start", type=int, default=0, - help="Specify where to start in the file [default=%(default)r]") + help="Specify where to start in the file [default=%(default)r]") parser.add_argument("-R", "--sample-rate", type=float, default=1.0, - help="Set the sampler rate of the data [default=%(default)r]") + help="Set the sampler rate of the data [default=%(default)r]") parser.add_argument("files", metavar="FILE", nargs='+', - help="Input file with samples") + help="Input file with samples") return parser + def find(item_in, list_search): try: return list_search.index(item_in) != None diff --git a/gr-utils/plot_tools/plot_fft_base.py b/gr-utils/plot_tools/plot_fft_base.py index 9fa3611e14..8de668d4c4 100644 --- a/gr-utils/plot_tools/plot_fft_base.py +++ b/gr-utils/plot_tools/plot_fft_base.py @@ -31,7 +31,8 @@ class plot_fft_base(object): self.datatype = datatype if self.datatype is None: self.datatype = datatype_lookup[options.data_type] - self.sizeof_data = self.datatype().nbytes # number of bytes per sample in file + # number of bytes per sample in file + self.sizeof_data = self.datatype().nbytes self.axis_font_size = 16 self.label_font_size = 18 @@ -43,21 +44,27 @@ class plot_fft_base(object): rcParams['xtick.labelsize'] = self.axis_font_size rcParams['ytick.labelsize'] = self.axis_font_size - self.text_file = figtext(0.10, 0.94, ("File: %s" % filename), weight="heavy", size=self.text_size) - self.text_file_pos = figtext(0.10, 0.88, "File Position: ", weight="heavy", size=self.text_size) - self.text_block = figtext(0.35, 0.88, ("Block Size: %d" % self.block_length), - weight="heavy", size=self.text_size) - self.text_sr = figtext(0.60, 0.88, ("Sample Rate: %.2f" % self.sample_rate), - weight="heavy", size=self.text_size) + self.text_file = figtext( + 0.10, 0.94, ("File: %s" % filename), weight="heavy", size=self.text_size) + self.text_file_pos = figtext( + 0.10, 0.88, "File Position: ", weight="heavy", size=self.text_size) + self.text_block = figtext(0.35, 0.88, ("Block Size: %d" % self.block_length), + weight="heavy", size=self.text_size) + self.text_sr = figtext(0.60, 0.88, ("Sample Rate: %.2f" % self.sample_rate), + weight="heavy", size=self.text_size) self.make_plots() - self.button_left_axes = self.fig.add_axes([0.45, 0.01, 0.05, 0.05], frameon=True) + self.button_left_axes = self.fig.add_axes( + [0.45, 0.01, 0.05, 0.05], frameon=True) self.button_left = Button(self.button_left_axes, "<") - self.button_left_callback = self.button_left.on_clicked(self.button_left_click) + self.button_left_callback = self.button_left.on_clicked( + self.button_left_click) - self.button_right_axes = self.fig.add_axes([0.50, 0.01, 0.05, 0.05], frameon=True) + self.button_right_axes = self.fig.add_axes( + [0.50, 0.01, 0.05, 0.05], frameon=True) self.button_right = Button(self.button_right_axes, ">") - self.button_right_callback = self.button_right.on_clicked(self.button_right_click) + self.button_right_callback = self.button_right.on_clicked( + self.button_right_click) self.xlim = self.sp_iq.get_xlim() @@ -70,7 +77,8 @@ class plot_fft_base(object): self.position = self.hfile.tell() / self.sizeof_data self.text_file_pos.set_text("File Position: %d" % (self.position)) try: - self.iq = numpy.fromfile(self.hfile, dtype=self.datatype, count=self.block_length) + self.iq = numpy.fromfile( + self.hfile, dtype=self.datatype, count=self.block_length) except MemoryError: print("End of File") else: @@ -78,14 +86,16 @@ class plot_fft_base(object): tstep = 1.0 / self.sample_rate #self.time = numpy.array([tstep*(self.position + i) for i in range(len(self.iq))]) - self.time = numpy.array([tstep*(i) for i in range(len(self.iq))]) + self.time = numpy.array([tstep * (i) for i in range(len(self.iq))]) self.freq = self.calc_freq(self.time, self.sample_rate) def dofft(self, iq): N = len(iq) - iq_fft = numpy.fft.fftshift(numpy.fft.fft(iq)) # fft and shift axis - iq_fft = 20*numpy.log10(abs((iq_fft+1e-15) / N)) # convert to decibels, adjust power + iq_fft = numpy.fft.fftshift( + numpy.fft.fft(iq)) # fft and shift axis + # convert to decibels, adjust power + iq_fft = 20 * numpy.log10(abs((iq_fft + 1e-15) / N)) # adding 1e-15 (-300 dB) to protect against value errors if an item in iq_fft is 0 return iq_fft @@ -93,29 +103,37 @@ class plot_fft_base(object): N = len(time) Fs = 1.0 / (max(time) - min(time)) Fn = 0.5 * sample_rate - freq = numpy.array([-Fn + i*Fs for i in range(N)]) + freq = numpy.array([-Fn + i * Fs for i in range(N)]) return freq def make_plots(self): # if specified on the command-line, set file pointer - self.hfile.seek(self.sizeof_data*self.start, 1) + self.hfile.seek(self.sizeof_data * self.start, 1) # Subplot for real and imaginary parts of signal - self.sp_iq = self.fig.add_subplot(2,2,1, position=[0.075, 0.2, 0.4, 0.6]) - self.sp_iq.set_title(("I&Q"), fontsize=self.title_font_size, fontweight="bold") - self.sp_iq.set_xlabel("Time (s)", fontsize=self.label_font_size, fontweight="bold") - self.sp_iq.set_ylabel("Amplitude (V)", fontsize=self.label_font_size, fontweight="bold") + self.sp_iq = self.fig.add_subplot( + 2, 2, 1, position=[0.075, 0.2, 0.4, 0.6]) + self.sp_iq.set_title( + ("I&Q"), fontsize=self.title_font_size, fontweight="bold") + self.sp_iq.set_xlabel( + "Time (s)", fontsize=self.label_font_size, fontweight="bold") + self.sp_iq.set_ylabel( + "Amplitude (V)", fontsize=self.label_font_size, fontweight="bold") # Subplot for FFT plot - self.sp_fft = self.fig.add_subplot(2,2,2, position=[0.575, 0.2, 0.4, 0.6]) - self.sp_fft.set_title(("FFT"), fontsize=self.title_font_size, fontweight="bold") - self.sp_fft.set_xlabel("Frequency (Hz)", fontsize=self.label_font_size, fontweight="bold") - self.sp_fft.set_ylabel("Power Spectrum (dBm)", fontsize=self.label_font_size, fontweight="bold") + self.sp_fft = self.fig.add_subplot( + 2, 2, 2, position=[0.575, 0.2, 0.4, 0.6]) + self.sp_fft.set_title( + ("FFT"), fontsize=self.title_font_size, fontweight="bold") + self.sp_fft.set_xlabel( + "Frequency (Hz)", fontsize=self.label_font_size, fontweight="bold") + self.sp_fft.set_ylabel("Power Spectrum (dBm)", + fontsize=self.label_font_size, fontweight="bold") self.get_data() - self.plot_iq = self.sp_iq.plot([], 'bo-') # make plot for reals - self.plot_iq += self.sp_iq.plot([], 'ro-') # make plot for imags + self.plot_iq = self.sp_iq.plot([], 'bo-') # make plot for reals + self.plot_iq += self.sp_iq.plot([], 'ro-') # make plot for imags self.draw_time() # draw the plot self.plot_fft = self.sp_fft.plot([], 'bo-') # make plot for FFT @@ -129,13 +147,13 @@ class plot_fft_base(object): self.plot_iq[0].set_data([self.time, reals]) self.plot_iq[1].set_data([self.time, imags]) self.sp_iq.set_xlim(self.time.min(), self.time.max()) - self.sp_iq.set_ylim([1.5*min([reals.min(), imags.min()]), - 1.5*max([reals.max(), imags.max()])]) + self.sp_iq.set_ylim([1.5 * min([reals.min(), imags.min()]), + 1.5 * max([reals.max(), imags.max()])]) def draw_fft(self): self.plot_fft[0].set_data([self.freq, self.iq_fft]) self.sp_fft.set_xlim(self.freq.min(), self.freq.max()) - self.sp_fft.set_ylim([self.iq_fft.min()-10, self.iq_fft.max()+10]) + self.sp_fft.set_ylim([self.iq_fft.min() - 10, self.iq_fft.max() + 10]) def update_plots(self): self.draw_time() @@ -151,18 +169,19 @@ class plot_fft_base(object): self.xlim = newxlim #xmin = max(0, int(ceil(self.sample_rate*(self.xlim[0] - self.position)))) #xmax = min(int(ceil(self.sample_rate*(self.xlim[1] - self.position))), len(self.iq)) - xmin = max(0, int(ceil(self.sample_rate*(self.xlim[0])))) - xmax = min(int(ceil(self.sample_rate*(self.xlim[1]))), len(self.iq)) + xmin = max(0, int(ceil(self.sample_rate * (self.xlim[0])))) + xmax = min( + int(ceil(self.sample_rate * (self.xlim[1]))), len(self.iq)) - iq = self.iq[xmin : xmax] - time = self.time[xmin : xmax] + iq = self.iq[xmin: xmax] + time = self.time[xmin: xmax] iq_fft = self.dofft(iq) freq = self.calc_freq(time, self.sample_rate) self.plot_fft[0].set_data(freq, iq_fft) self.sp_fft.axis([freq.min(), freq.max(), - iq_fft.min()-10, iq_fft.max()+10]) + iq_fft.min() - 10, iq_fft.max() + 10]) draw() @@ -188,10 +207,10 @@ class plot_fft_base(object): def step_backward(self): # Step back in file position - if(self.hfile.tell() >= 2*self.sizeof_data*self.block_length ): - self.hfile.seek(-2*self.sizeof_data*self.block_length, 1) + if(self.hfile.tell() >= 2 * self.sizeof_data * self.block_length): + self.hfile.seek(-2 * self.sizeof_data * self.block_length, 1) else: - self.hfile.seek(-self.hfile.tell(),1) + self.hfile.seek(-self.hfile.tell(), 1) self.get_data() self.update_plots() @@ -199,33 +218,37 @@ class plot_fft_base(object): def setup_options(): description = "Takes a GNU Radio complex binary file and displays the I&Q data versus time as well as the frequency domain (FFT) plot. The y-axis values are plotted assuming volts as the amplitude of the I&Q streams and converted into dBm in the frequency domain (the 1/N power adjustment out of the FFT is performed internally). The script plots a certain block of data at a time, specified on the command line as -B or --block. This value defaults to 1000. The start position in the file can be set by specifying -s or --start and defaults to 0 (the start of the file). By default, the system assumes a sample rate of 1, so in time, each sample is plotted versus the sample number. To set a true time and frequency axis, set the sample rate (-R or --sample-rate) to the sample rate used when capturing the samples." - parser = ArgumentParser(conflict_handler="resolve", description=description) + parser = ArgumentParser( + conflict_handler="resolve", description=description) parser.add_argument("-d", "--data-type", default="complex64", - choices=("complex64", "float32", "uint32", "int32", "uint16", - "int16", "uint8", "int8"), - help="Specify the data type [default=%(default)r]") + choices=("complex64", "float32", "uint32", "int32", "uint16", + "int16", "uint8", "int8"), + help="Specify the data type [default=%(default)r]") parser.add_argument("-B", "--block", type=int, default=1000, - help="Specify the block size [default=%(default)r]") + help="Specify the block size [default=%(default)r]") parser.add_argument("-s", "--start", type=int, default=0, - help="Specify where to start in the file [default=%(default)r]") + help="Specify where to start in the file [default=%(default)r]") parser.add_argument("-R", "--sample-rate", type=float, default=1.0, - help="Set the sampler rate of the data [default=%(default)r]") + help="Set the sampler rate of the data [default=%(default)r]") parser.add_argument("file", metavar="FILE", - help="Input file with samples") + help="Input file with samples") return parser + def find(item_in, list_search): try: return list_search.index(item_in) != None except ValueError: return False + def main(): parser = plot_fft_base.setup_options() args = parser.parse_args() plot_fft_base(None, args.file, args) + if __name__ == "__main__": try: main() diff --git a/gr-utils/plot_tools/plot_psd_base.py b/gr-utils/plot_tools/plot_psd_base.py index 3d78af0dd1..88f86f5725 100644 --- a/gr-utils/plot_tools/plot_psd_base.py +++ b/gr-utils/plot_tools/plot_psd_base.py @@ -35,7 +35,8 @@ class plot_psd_base(object): self.datatype = datatype if self.datatype is None: self.datatype = datatype_lookup[options.data_type] - self.sizeof_data = self.datatype().nbytes # number of bytes per sample in file + # number of bytes per sample in file + self.sizeof_data = self.datatype().nbytes self.axis_font_size = 16 self.label_font_size = 18 @@ -47,23 +48,27 @@ class plot_psd_base(object): rcParams['xtick.labelsize'] = self.axis_font_size rcParams['ytick.labelsize'] = self.axis_font_size - self.text_file = figtext(0.10, 0.95, ("File: %s" % filename), - weight="heavy", size=self.text_size) + self.text_file = figtext(0.10, 0.95, ("File: %s" % filename), + weight="heavy", size=self.text_size) self.text_file_pos = figtext(0.10, 0.92, "File Position: ", weight="heavy", size=self.text_size) - self.text_block = figtext(0.35, 0.92, ("Block Size: %d" % self.block_length), - weight="heavy", size=self.text_size) - self.text_sr = figtext(0.60, 0.915, ("Sample Rate: %.2f" % self.sample_rate), - weight="heavy", size=self.text_size) + self.text_block = figtext(0.35, 0.92, ("Block Size: %d" % self.block_length), + weight="heavy", size=self.text_size) + self.text_sr = figtext(0.60, 0.915, ("Sample Rate: %.2f" % self.sample_rate), + weight="heavy", size=self.text_size) self.make_plots() - self.button_left_axes = self.fig.add_axes([0.45, 0.01, 0.05, 0.05], frameon=True) + self.button_left_axes = self.fig.add_axes( + [0.45, 0.01, 0.05, 0.05], frameon=True) self.button_left = Button(self.button_left_axes, "<") - self.button_left_callback = self.button_left.on_clicked(self.button_left_click) + self.button_left_callback = self.button_left.on_clicked( + self.button_left_click) - self.button_right_axes = self.fig.add_axes([0.50, 0.01, 0.05, 0.05], frameon=True) + self.button_right_axes = self.fig.add_axes( + [0.50, 0.01, 0.05, 0.05], frameon=True) self.button_right = Button(self.button_right_axes, ">") - self.button_right_callback = self.button_right.on_clicked(self.button_right_click) + self.button_right_callback = self.button_right.on_clicked( + self.button_right_click) self.xlim = numpy.array(self.sp_iq.get_xlim()) @@ -76,7 +81,8 @@ class plot_psd_base(object): self.position = self.hfile.tell() / self.sizeof_data self.text_file_pos.set_text("File Position: %d" % self.position) try: - self.iq = numpy.fromfile(self.hfile, dtype=self.datatype, count=self.block_length) + self.iq = numpy.fromfile( + self.hfile, dtype=self.datatype, count=self.block_length) except MemoryError: print("End of File") return False @@ -86,7 +92,8 @@ class plot_psd_base(object): if(len(self.iq) > 0): tstep = 1.0 / self.sample_rate #self.time = numpy.array([tstep*(self.position + i) for i in range(len(self.iq))]) - self.time = numpy.array([tstep*(i) for i in range(len(self.iq))]) + self.time = numpy.array([tstep * (i) + for i in range(len(self.iq))]) self.iq_psd, self.freq = self.dopsd(self.iq) return True @@ -98,48 +105,58 @@ class plot_psd_base(object): ''' Need to do this here and plot later so we can do the fftshift ''' overlap = self.psdfftsize / 4 winfunc = numpy.blackman - psd,freq = mlab.psd(iq, self.psdfftsize, self.sample_rate, - window = lambda d: d*winfunc(self.psdfftsize), - noverlap = overlap) - psd = 10.0*numpy.log10(abs(psd)) + psd, freq = mlab.psd(iq, self.psdfftsize, self.sample_rate, + window=lambda d: d * winfunc(self.psdfftsize), + noverlap=overlap) + psd = 10.0 * numpy.log10(abs(psd)) return (psd, freq) def make_plots(self): # if specified on the command-line, set file pointer - self.hfile.seek(self.sizeof_data*self.start, 1) + self.hfile.seek(self.sizeof_data * self.start, 1) iqdims = [[0.075, 0.2, 0.4, 0.6], [0.075, 0.55, 0.4, 0.3]] psddims = [[0.575, 0.2, 0.4, 0.6], [0.575, 0.55, 0.4, 0.3]] specdims = [0.2, 0.125, 0.6, 0.3] # Subplot for real and imaginary parts of signal - self.sp_iq = self.fig.add_subplot(2,2,1, position=iqdims[self.dospec]) - self.sp_iq.set_title(("I&Q"), fontsize=self.title_font_size, fontweight="bold") - self.sp_iq.set_xlabel("Time (s)", fontsize=self.label_font_size, fontweight="bold") - self.sp_iq.set_ylabel("Amplitude (V)", fontsize=self.label_font_size, fontweight="bold") + self.sp_iq = self.fig.add_subplot( + 2, 2, 1, position=iqdims[self.dospec]) + self.sp_iq.set_title( + ("I&Q"), fontsize=self.title_font_size, fontweight="bold") + self.sp_iq.set_xlabel( + "Time (s)", fontsize=self.label_font_size, fontweight="bold") + self.sp_iq.set_ylabel( + "Amplitude (V)", fontsize=self.label_font_size, fontweight="bold") # Subplot for PSD plot - self.sp_psd = self.fig.add_subplot(2,2,2, position=psddims[self.dospec]) - self.sp_psd.set_title(("PSD"), fontsize=self.title_font_size, fontweight="bold") - self.sp_psd.set_xlabel("Frequency (Hz)", fontsize=self.label_font_size, fontweight="bold") - self.sp_psd.set_ylabel("Power Spectrum (dBm)", fontsize=self.label_font_size, fontweight="bold") + self.sp_psd = self.fig.add_subplot( + 2, 2, 2, position=psddims[self.dospec]) + self.sp_psd.set_title( + ("PSD"), fontsize=self.title_font_size, fontweight="bold") + self.sp_psd.set_xlabel( + "Frequency (Hz)", fontsize=self.label_font_size, fontweight="bold") + self.sp_psd.set_ylabel("Power Spectrum (dBm)", + fontsize=self.label_font_size, fontweight="bold") r = self.get_data() - self.plot_iq = self.sp_iq.plot([], 'bo-') # make plot for reals - self.plot_iq += self.sp_iq.plot([], 'ro-') # make plot for imags + self.plot_iq = self.sp_iq.plot([], 'bo-') # make plot for reals + self.plot_iq += self.sp_iq.plot([], 'ro-') # make plot for imags self.draw_time(self.time, self.iq) # draw the plot self.plot_psd = self.sp_psd.plot([], 'b') # make plot for PSD self.draw_psd(self.freq, self.iq_psd) # draw the plot - if self.dospec: # Subplot for spectrogram plot - self.sp_spec = self.fig.add_subplot(2,2,3, position=specdims) - self.sp_spec.set_title(("Spectrogram"), fontsize=self.title_font_size, fontweight="bold") - self.sp_spec.set_xlabel("Time (s)", fontsize=self.label_font_size, fontweight="bold") - self.sp_spec.set_ylabel("Frequency (Hz)", fontsize=self.label_font_size, fontweight="bold") + self.sp_spec = self.fig.add_subplot(2, 2, 3, position=specdims) + self.sp_spec.set_title( + ("Spectrogram"), fontsize=self.title_font_size, fontweight="bold") + self.sp_spec.set_xlabel( + "Time (s)", fontsize=self.label_font_size, fontweight="bold") + self.sp_spec.set_ylabel( + "Frequency (Hz)", fontsize=self.label_font_size, fontweight="bold") self.draw_spec(self.time, self.iq) @@ -151,12 +168,12 @@ class plot_psd_base(object): self.plot_iq[0].set_data([t, reals]) self.plot_iq[1].set_data([t, imags]) self.sp_iq.set_xlim(t.min(), t.max()) - self.sp_iq.set_ylim([1.5*min([reals.min(), imags.min()]), - 1.5*max([reals.max(), imags.max()])]) + self.sp_iq.set_ylim([1.5 * min([reals.min(), imags.min()]), + 1.5 * max([reals.max(), imags.max()])]) def draw_psd(self, f, p): self.plot_psd[0].set_data([f, p]) - self.sp_psd.set_ylim([p.min()-10, p.max()+10]) + self.sp_psd.set_ylim([p.min() - 10, p.max() + 10]) self.sp_psd.set_xlim([f.min(), f.max()]) def draw_spec(self, t, s): @@ -164,8 +181,8 @@ class plot_psd_base(object): winfunc = numpy.blackman self.sp_spec.clear() self.sp_spec.specgram(s, self.specfftsize, self.sample_rate, - window = lambda d: d*winfunc(self.specfftsize), - noverlap = overlap, xextent=[t.min(), t.max()]) + window=lambda d: d * winfunc(self.specfftsize), + noverlap=overlap, xextent=[t.min(), t.max()]) def update_plots(self): self.draw_time(self.time, self.iq) @@ -174,7 +191,8 @@ class plot_psd_base(object): if self.dospec: self.draw_spec(self.time, self.iq) - self.xlim = numpy.array(self.sp_iq.get_xlim()) # so zoom doesn't get called + # so zoom doesn't get called + self.xlim = numpy.array(self.sp_iq.get_xlim()) draw() @@ -184,11 +202,12 @@ class plot_psd_base(object): if(newxlim[0] != curxlim[0] or newxlim[1] != curxlim[1]): #xmin = max(0, int(ceil(self.sample_rate*(newxlim[0] - self.position)))) #xmax = min(int(ceil(self.sample_rate*(newxlim[1] - self.position))), len(self.iq)) - xmin = max(0, int(ceil(self.sample_rate*(newxlim[0])))) - xmax = min(int(ceil(self.sample_rate*(newxlim[1]))), len(self.iq)) + xmin = max(0, int(ceil(self.sample_rate * (newxlim[0])))) + xmax = min( + int(ceil(self.sample_rate * (newxlim[1]))), len(self.iq)) - iq = numpy.array(self.iq[xmin : xmax]) - time = numpy.array(self.time[xmin : xmax]) + iq = numpy.array(self.iq[xmin: xmax]) + time = numpy.array(self.time[xmin: xmax]) iq_psd, freq = self.dopsd(iq) @@ -220,10 +239,10 @@ class plot_psd_base(object): def step_backward(self): # Step back in file position - if(self.hfile.tell() >= 2*self.sizeof_data*self.block_length ): - self.hfile.seek(-2*self.sizeof_data*self.block_length, 1) + if(self.hfile.tell() >= 2 * self.sizeof_data * self.block_length): + self.hfile.seek(-2 * self.sizeof_data * self.block_length, 1) else: - self.hfile.seek(-self.hfile.tell(),1) + self.hfile.seek(-self.hfile.tell(), 1) r = self.get_data() if(r): self.update_plots() @@ -232,40 +251,44 @@ class plot_psd_base(object): def setup_options(): description = "Takes a GNU Radio binary file (with specified data type using --data-type) and displays the I&Q data versus time as well as the power spectral density (PSD) plot. The y-axis values are plotted assuming volts as the amplitude of the I&Q streams and converted into dBm in the frequency domain (the 1/N power adjustment out of the FFT is performed internally). The script plots a certain block of data at a time, specified on the command line as -B or --block. The start position in the file can be set by specifying -s or --start and defaults to 0 (the start of the file). By default, the system assumes a sample rate of 1, so in time, each sample is plotted versus the sample number. To set a true time and frequency axis, set the sample rate (-R or --sample-rate) to the sample rate used when capturing the samples. Finally, the size of the FFT to use for the PSD and spectrogram plots can be set independently with --psd-size and --spec-size, respectively. The spectrogram plot does not display by default and is turned on with -S or --enable-spec." - parser = ArgumentParser(conflict_handler="resolve", description=description) + parser = ArgumentParser( + conflict_handler="resolve", description=description) parser.add_argument("-d", "--data-type", default="complex64", - choices=("complex64", "float32", "int32", "uint32", "int16", - "uint16", "int8", "uint8" ), - help="Specify the data type [default=%(default)r]") + choices=("complex64", "float32", "int32", "uint32", "int16", + "uint16", "int8", "uint8"), + help="Specify the data type [default=%(default)r]") parser.add_argument("-B", "--block", type=int, default=8192, - help="Specify the block size [default=%(default)r]") + help="Specify the block size [default=%(default)r]") parser.add_argument("-s", "--start", type=int, default=0, - help="Specify where to start in the file [default=%(default)r]") + help="Specify where to start in the file [default=%(default)r]") parser.add_argument("-R", "--sample-rate", type=eng_float, default=1.0, - help="Set the sampler rate of the data [default=%(default)r]") + help="Set the sampler rate of the data [default=%(default)r]") parser.add_argument("--psd-size", type=int, default=1024, - help="Set the size of the PSD FFT [default=%(default)r]") + help="Set the size of the PSD FFT [default=%(default)r]") parser.add_argument("--spec-size", type=int, default=256, - help="Set the size of the spectrogram FFT [default=%(default)r]") + help="Set the size of the spectrogram FFT [default=%(default)r]") parser.add_argument("-S", "--enable-spec", action="store_true", - help="Turn on plotting the spectrogram [default=%(default)r]") + help="Turn on plotting the spectrogram [default=%(default)r]") parser.add_argument("file", metavar="FILE", - help="Input file with samples") + help="Input file with samples") return parser + def find(item_in, list_search): try: return list_search.index(item_in) != None except ValueError: return False + def main(): parser = plot_psd_base.setup_options() args = parser.parse_args() plot_psd_base(None, args.file, args) + if __name__ == "__main__": try: main() diff --git a/gr-utils/plot_tools/pyqt_filter.py b/gr-utils/plot_tools/pyqt_filter.py index d56e45a056..3f4ee1e546 100644 --- a/gr-utils/plot_tools/pyqt_filter.py +++ b/gr-utils/plot_tools/pyqt_filter.py @@ -7,8 +7,10 @@ # # WARNING! All changes made in this file will be lost! +from PyQt5.Qwt import QwtPlot from PyQt5 import QtCore, QtGui + class Ui_MainWindow(object): def setupUi(self, MainWindow): MainWindow.setObjectName("MainWindow") @@ -46,22 +48,27 @@ class Ui_MainWindow(object): self.filterDesignTypeComboBox.addItem("") self.verticalLayout.addWidget(self.filterDesignTypeComboBox) self.globalParamsLayout = QtGui.QFormLayout() - self.globalParamsLayout.setFieldGrowthPolicy(QtGui.QFormLayout.AllNonFixedFieldsGrow) + self.globalParamsLayout.setFieldGrowthPolicy( + QtGui.QFormLayout.AllNonFixedFieldsGrow) self.globalParamsLayout.setObjectName("globalParamsLayout") self.sampleRateLabel = QtGui.QLabel(self.filterFrame) self.sampleRateLabel.setMaximumSize(QtCore.QSize(16777215, 30)) self.sampleRateLabel.setObjectName("sampleRateLabel") - self.globalParamsLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.sampleRateLabel) + self.globalParamsLayout.setWidget( + 0, QtGui.QFormLayout.LabelRole, self.sampleRateLabel) self.sampleRateEdit = QtGui.QLineEdit(self.filterFrame) self.sampleRateEdit.setMaximumSize(QtCore.QSize(16777215, 30)) self.sampleRateEdit.setObjectName("sampleRateEdit") - self.globalParamsLayout.setWidget(0, QtGui.QFormLayout.FieldRole, self.sampleRateEdit) + self.globalParamsLayout.setWidget( + 0, QtGui.QFormLayout.FieldRole, self.sampleRateEdit) self.filterGainLabel = QtGui.QLabel(self.filterFrame) self.filterGainLabel.setObjectName("filterGainLabel") - self.globalParamsLayout.setWidget(1, QtGui.QFormLayout.LabelRole, self.filterGainLabel) + self.globalParamsLayout.setWidget( + 1, QtGui.QFormLayout.LabelRole, self.filterGainLabel) self.filterGainEdit = QtGui.QLineEdit(self.filterFrame) self.filterGainEdit.setObjectName("filterGainEdit") - self.globalParamsLayout.setWidget(1, QtGui.QFormLayout.FieldRole, self.filterGainEdit) + self.globalParamsLayout.setWidget( + 1, QtGui.QFormLayout.FieldRole, self.filterGainEdit) self.verticalLayout.addLayout(self.globalParamsLayout) self.filterTypeWidget = QtGui.QStackedWidget(self.filterFrame) self.filterTypeWidget.setObjectName("filterTypeWidget") @@ -71,28 +78,36 @@ class Ui_MainWindow(object): self.formLayout.setObjectName("formLayout") self.endofLpfPassBandLabel = QtGui.QLabel(self.firlpfPage) self.endofLpfPassBandLabel.setObjectName("endofLpfPassBandLabel") - self.formLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.endofLpfPassBandLabel) + self.formLayout.setWidget( + 0, QtGui.QFormLayout.LabelRole, self.endofLpfPassBandLabel) self.endofLpfPassBandEdit = QtGui.QLineEdit(self.firlpfPage) self.endofLpfPassBandEdit.setObjectName("endofLpfPassBandEdit") - self.formLayout.setWidget(0, QtGui.QFormLayout.FieldRole, self.endofLpfPassBandEdit) + self.formLayout.setWidget( + 0, QtGui.QFormLayout.FieldRole, self.endofLpfPassBandEdit) self.startofLpfStopBandLabel = QtGui.QLabel(self.firlpfPage) self.startofLpfStopBandLabel.setObjectName("startofLpfStopBandLabel") - self.formLayout.setWidget(1, QtGui.QFormLayout.LabelRole, self.startofLpfStopBandLabel) + self.formLayout.setWidget( + 1, QtGui.QFormLayout.LabelRole, self.startofLpfStopBandLabel) self.startofLpfStopBandEdit = QtGui.QLineEdit(self.firlpfPage) self.startofLpfStopBandEdit.setObjectName("startofLpfStopBandEdit") - self.formLayout.setWidget(1, QtGui.QFormLayout.FieldRole, self.startofLpfStopBandEdit) + self.formLayout.setWidget( + 1, QtGui.QFormLayout.FieldRole, self.startofLpfStopBandEdit) self.lpfStopBandAttenLabel = QtGui.QLabel(self.firlpfPage) self.lpfStopBandAttenLabel.setObjectName("lpfStopBandAttenLabel") - self.formLayout.setWidget(2, QtGui.QFormLayout.LabelRole, self.lpfStopBandAttenLabel) + self.formLayout.setWidget( + 2, QtGui.QFormLayout.LabelRole, self.lpfStopBandAttenLabel) self.lpfStopBandAttenEdit = QtGui.QLineEdit(self.firlpfPage) self.lpfStopBandAttenEdit.setObjectName("lpfStopBandAttenEdit") - self.formLayout.setWidget(2, QtGui.QFormLayout.FieldRole, self.lpfStopBandAttenEdit) + self.formLayout.setWidget( + 2, QtGui.QFormLayout.FieldRole, self.lpfStopBandAttenEdit) self.lpfPassBandRippleEdit = QtGui.QLineEdit(self.firlpfPage) self.lpfPassBandRippleEdit.setObjectName("lpfPassBandRippleEdit") - self.formLayout.setWidget(3, QtGui.QFormLayout.FieldRole, self.lpfPassBandRippleEdit) + self.formLayout.setWidget( + 3, QtGui.QFormLayout.FieldRole, self.lpfPassBandRippleEdit) self.lpfPassBandRippleLabel = QtGui.QLabel(self.firlpfPage) self.lpfPassBandRippleLabel.setObjectName("lpfPassBandRippleLabel") - self.formLayout.setWidget(3, QtGui.QFormLayout.LabelRole, self.lpfPassBandRippleLabel) + self.formLayout.setWidget( + 3, QtGui.QFormLayout.LabelRole, self.lpfPassBandRippleLabel) self.filterTypeWidget.addWidget(self.firlpfPage) self.firbpfPage = QtGui.QWidget() self.firbpfPage.setObjectName("firbpfPage") @@ -100,100 +115,130 @@ class Ui_MainWindow(object): self.formLayout_2.setObjectName("formLayout_2") self.startofBpfPassBandLabel = QtGui.QLabel(self.firbpfPage) self.startofBpfPassBandLabel.setObjectName("startofBpfPassBandLabel") - self.formLayout_2.setWidget(0, QtGui.QFormLayout.LabelRole, self.startofBpfPassBandLabel) + self.formLayout_2.setWidget( + 0, QtGui.QFormLayout.LabelRole, self.startofBpfPassBandLabel) self.startofBpfPassBandEdit = QtGui.QLineEdit(self.firbpfPage) self.startofBpfPassBandEdit.setObjectName("startofBpfPassBandEdit") - self.formLayout_2.setWidget(0, QtGui.QFormLayout.FieldRole, self.startofBpfPassBandEdit) + self.formLayout_2.setWidget( + 0, QtGui.QFormLayout.FieldRole, self.startofBpfPassBandEdit) self.endofBpfPassBandLabel = QtGui.QLabel(self.firbpfPage) self.endofBpfPassBandLabel.setObjectName("endofBpfPassBandLabel") - self.formLayout_2.setWidget(1, QtGui.QFormLayout.LabelRole, self.endofBpfPassBandLabel) + self.formLayout_2.setWidget( + 1, QtGui.QFormLayout.LabelRole, self.endofBpfPassBandLabel) self.endofBpfPassBandEdit = QtGui.QLineEdit(self.firbpfPage) self.endofBpfPassBandEdit.setObjectName("endofBpfPassBandEdit") - self.formLayout_2.setWidget(1, QtGui.QFormLayout.FieldRole, self.endofBpfPassBandEdit) + self.formLayout_2.setWidget( + 1, QtGui.QFormLayout.FieldRole, self.endofBpfPassBandEdit) self.bpfStopBandAttenEdit = QtGui.QLineEdit(self.firbpfPage) self.bpfStopBandAttenEdit.setObjectName("bpfStopBandAttenEdit") - self.formLayout_2.setWidget(3, QtGui.QFormLayout.FieldRole, self.bpfStopBandAttenEdit) + self.formLayout_2.setWidget( + 3, QtGui.QFormLayout.FieldRole, self.bpfStopBandAttenEdit) self.bpfStopBandAttenLabel = QtGui.QLabel(self.firbpfPage) self.bpfStopBandAttenLabel.setObjectName("bpfStopBandAttenLabel") - self.formLayout_2.setWidget(3, QtGui.QFormLayout.LabelRole, self.bpfStopBandAttenLabel) + self.formLayout_2.setWidget( + 3, QtGui.QFormLayout.LabelRole, self.bpfStopBandAttenLabel) self.bpfTransitionLabel = QtGui.QLabel(self.firbpfPage) self.bpfTransitionLabel.setObjectName("bpfTransitionLabel") - self.formLayout_2.setWidget(2, QtGui.QFormLayout.LabelRole, self.bpfTransitionLabel) + self.formLayout_2.setWidget( + 2, QtGui.QFormLayout.LabelRole, self.bpfTransitionLabel) self.bpfTransitionEdit = QtGui.QLineEdit(self.firbpfPage) self.bpfTransitionEdit.setObjectName("bpfTransitionEdit") - self.formLayout_2.setWidget(2, QtGui.QFormLayout.FieldRole, self.bpfTransitionEdit) + self.formLayout_2.setWidget( + 2, QtGui.QFormLayout.FieldRole, self.bpfTransitionEdit) self.bpfPassBandRippleEdit = QtGui.QLineEdit(self.firbpfPage) self.bpfPassBandRippleEdit.setObjectName("bpfPassBandRippleEdit") - self.formLayout_2.setWidget(4, QtGui.QFormLayout.FieldRole, self.bpfPassBandRippleEdit) + self.formLayout_2.setWidget( + 4, QtGui.QFormLayout.FieldRole, self.bpfPassBandRippleEdit) self.bpfPassBandRippleLabel = QtGui.QLabel(self.firbpfPage) self.bpfPassBandRippleLabel.setObjectName("bpfPassBandRippleLabel") - self.formLayout_2.setWidget(4, QtGui.QFormLayout.LabelRole, self.bpfPassBandRippleLabel) + self.formLayout_2.setWidget( + 4, QtGui.QFormLayout.LabelRole, self.bpfPassBandRippleLabel) self.filterTypeWidget.addWidget(self.firbpfPage) self.firbnfPage = QtGui.QWidget() self.firbnfPage.setObjectName("firbnfPage") self.formLayout_5 = QtGui.QFormLayout(self.firbnfPage) - self.formLayout_5.setFieldGrowthPolicy(QtGui.QFormLayout.AllNonFixedFieldsGrow) + self.formLayout_5.setFieldGrowthPolicy( + QtGui.QFormLayout.AllNonFixedFieldsGrow) self.formLayout_5.setObjectName("formLayout_5") self.startofBnfStopBandLabel = QtGui.QLabel(self.firbnfPage) self.startofBnfStopBandLabel.setObjectName("startofBnfStopBandLabel") - self.formLayout_5.setWidget(0, QtGui.QFormLayout.LabelRole, self.startofBnfStopBandLabel) + self.formLayout_5.setWidget( + 0, QtGui.QFormLayout.LabelRole, self.startofBnfStopBandLabel) self.startofBnfStopBandEdit = QtGui.QLineEdit(self.firbnfPage) self.startofBnfStopBandEdit.setObjectName("startofBnfStopBandEdit") - self.formLayout_5.setWidget(0, QtGui.QFormLayout.FieldRole, self.startofBnfStopBandEdit) + self.formLayout_5.setWidget( + 0, QtGui.QFormLayout.FieldRole, self.startofBnfStopBandEdit) self.endofBnfStopBandLabel = QtGui.QLabel(self.firbnfPage) self.endofBnfStopBandLabel.setObjectName("endofBnfStopBandLabel") - self.formLayout_5.setWidget(1, QtGui.QFormLayout.LabelRole, self.endofBnfStopBandLabel) + self.formLayout_5.setWidget( + 1, QtGui.QFormLayout.LabelRole, self.endofBnfStopBandLabel) self.endofBnfStopBandEdit = QtGui.QLineEdit(self.firbnfPage) self.endofBnfStopBandEdit.setObjectName("endofBnfStopBandEdit") - self.formLayout_5.setWidget(1, QtGui.QFormLayout.FieldRole, self.endofBnfStopBandEdit) + self.formLayout_5.setWidget( + 1, QtGui.QFormLayout.FieldRole, self.endofBnfStopBandEdit) self.bnfTransitionLabel = QtGui.QLabel(self.firbnfPage) self.bnfTransitionLabel.setObjectName("bnfTransitionLabel") - self.formLayout_5.setWidget(2, QtGui.QFormLayout.LabelRole, self.bnfTransitionLabel) + self.formLayout_5.setWidget( + 2, QtGui.QFormLayout.LabelRole, self.bnfTransitionLabel) self.bnfTransitionEdit = QtGui.QLineEdit(self.firbnfPage) self.bnfTransitionEdit.setObjectName("bnfTransitionEdit") - self.formLayout_5.setWidget(2, QtGui.QFormLayout.FieldRole, self.bnfTransitionEdit) + self.formLayout_5.setWidget( + 2, QtGui.QFormLayout.FieldRole, self.bnfTransitionEdit) self.bnfStopBandAttenLabel = QtGui.QLabel(self.firbnfPage) self.bnfStopBandAttenLabel.setObjectName("bnfStopBandAttenLabel") - self.formLayout_5.setWidget(3, QtGui.QFormLayout.LabelRole, self.bnfStopBandAttenLabel) + self.formLayout_5.setWidget( + 3, QtGui.QFormLayout.LabelRole, self.bnfStopBandAttenLabel) self.bnfStopBandAttenEdit = QtGui.QLineEdit(self.firbnfPage) self.bnfStopBandAttenEdit.setObjectName("bnfStopBandAttenEdit") - self.formLayout_5.setWidget(3, QtGui.QFormLayout.FieldRole, self.bnfStopBandAttenEdit) + self.formLayout_5.setWidget( + 3, QtGui.QFormLayout.FieldRole, self.bnfStopBandAttenEdit) self.bnfPassBandRippleLabel = QtGui.QLabel(self.firbnfPage) self.bnfPassBandRippleLabel.setObjectName("bnfPassBandRippleLabel") - self.formLayout_5.setWidget(4, QtGui.QFormLayout.LabelRole, self.bnfPassBandRippleLabel) + self.formLayout_5.setWidget( + 4, QtGui.QFormLayout.LabelRole, self.bnfPassBandRippleLabel) self.bnfPassBandRippleEdit = QtGui.QLineEdit(self.firbnfPage) self.bnfPassBandRippleEdit.setObjectName("bnfPassBandRippleEdit") - self.formLayout_5.setWidget(4, QtGui.QFormLayout.FieldRole, self.bnfPassBandRippleEdit) + self.formLayout_5.setWidget( + 4, QtGui.QFormLayout.FieldRole, self.bnfPassBandRippleEdit) self.filterTypeWidget.addWidget(self.firbnfPage) self.firhpfPage = QtGui.QWidget() self.firhpfPage.setObjectName("firhpfPage") self.formLayout_3 = QtGui.QFormLayout(self.firhpfPage) - self.formLayout_3.setFieldGrowthPolicy(QtGui.QFormLayout.AllNonFixedFieldsGrow) + self.formLayout_3.setFieldGrowthPolicy( + QtGui.QFormLayout.AllNonFixedFieldsGrow) self.formLayout_3.setObjectName("formLayout_3") self.endofHpfStopBandLabel = QtGui.QLabel(self.firhpfPage) self.endofHpfStopBandLabel.setObjectName("endofHpfStopBandLabel") - self.formLayout_3.setWidget(0, QtGui.QFormLayout.LabelRole, self.endofHpfStopBandLabel) + self.formLayout_3.setWidget( + 0, QtGui.QFormLayout.LabelRole, self.endofHpfStopBandLabel) self.endofHpfStopBandEdit = QtGui.QLineEdit(self.firhpfPage) self.endofHpfStopBandEdit.setObjectName("endofHpfStopBandEdit") - self.formLayout_3.setWidget(0, QtGui.QFormLayout.FieldRole, self.endofHpfStopBandEdit) + self.formLayout_3.setWidget( + 0, QtGui.QFormLayout.FieldRole, self.endofHpfStopBandEdit) self.startofHpfPassBandLabel = QtGui.QLabel(self.firhpfPage) self.startofHpfPassBandLabel.setObjectName("startofHpfPassBandLabel") - self.formLayout_3.setWidget(1, QtGui.QFormLayout.LabelRole, self.startofHpfPassBandLabel) + self.formLayout_3.setWidget( + 1, QtGui.QFormLayout.LabelRole, self.startofHpfPassBandLabel) self.startofHpfPassBandEdit = QtGui.QLineEdit(self.firhpfPage) self.startofHpfPassBandEdit.setObjectName("startofHpfPassBandEdit") - self.formLayout_3.setWidget(1, QtGui.QFormLayout.FieldRole, self.startofHpfPassBandEdit) + self.formLayout_3.setWidget( + 1, QtGui.QFormLayout.FieldRole, self.startofHpfPassBandEdit) self.hpfStopBandAttenLabel = QtGui.QLabel(self.firhpfPage) self.hpfStopBandAttenLabel.setObjectName("hpfStopBandAttenLabel") - self.formLayout_3.setWidget(2, QtGui.QFormLayout.LabelRole, self.hpfStopBandAttenLabel) + self.formLayout_3.setWidget( + 2, QtGui.QFormLayout.LabelRole, self.hpfStopBandAttenLabel) self.hpfStopBandAttenEdit = QtGui.QLineEdit(self.firhpfPage) self.hpfStopBandAttenEdit.setObjectName("hpfStopBandAttenEdit") - self.formLayout_3.setWidget(2, QtGui.QFormLayout.FieldRole, self.hpfStopBandAttenEdit) + self.formLayout_3.setWidget( + 2, QtGui.QFormLayout.FieldRole, self.hpfStopBandAttenEdit) self.hpfPassBandRippleLabel = QtGui.QLabel(self.firhpfPage) self.hpfPassBandRippleLabel.setObjectName("hpfPassBandRippleLabel") - self.formLayout_3.setWidget(3, QtGui.QFormLayout.LabelRole, self.hpfPassBandRippleLabel) + self.formLayout_3.setWidget( + 3, QtGui.QFormLayout.LabelRole, self.hpfPassBandRippleLabel) self.hpfPassBandRippleEdit = QtGui.QLineEdit(self.firhpfPage) self.hpfPassBandRippleEdit.setObjectName("hpfPassBandRippleEdit") - self.formLayout_3.setWidget(3, QtGui.QFormLayout.FieldRole, self.hpfPassBandRippleEdit) + self.formLayout_3.setWidget( + 3, QtGui.QFormLayout.FieldRole, self.hpfPassBandRippleEdit) self.filterTypeWidget.addWidget(self.firhpfPage) self.rrcPage = QtGui.QWidget() self.rrcPage.setObjectName("rrcPage") @@ -201,22 +246,28 @@ class Ui_MainWindow(object): self.formLayout_6.setObjectName("formLayout_6") self.rrcSymbolRateLabel = QtGui.QLabel(self.rrcPage) self.rrcSymbolRateLabel.setObjectName("rrcSymbolRateLabel") - self.formLayout_6.setWidget(0, QtGui.QFormLayout.LabelRole, self.rrcSymbolRateLabel) + self.formLayout_6.setWidget( + 0, QtGui.QFormLayout.LabelRole, self.rrcSymbolRateLabel) self.rrcAlphaLabel = QtGui.QLabel(self.rrcPage) self.rrcAlphaLabel.setObjectName("rrcAlphaLabel") - self.formLayout_6.setWidget(1, QtGui.QFormLayout.LabelRole, self.rrcAlphaLabel) + self.formLayout_6.setWidget( + 1, QtGui.QFormLayout.LabelRole, self.rrcAlphaLabel) self.rrcNumTapsLabel = QtGui.QLabel(self.rrcPage) self.rrcNumTapsLabel.setObjectName("rrcNumTapsLabel") - self.formLayout_6.setWidget(2, QtGui.QFormLayout.LabelRole, self.rrcNumTapsLabel) + self.formLayout_6.setWidget( + 2, QtGui.QFormLayout.LabelRole, self.rrcNumTapsLabel) self.rrcSymbolRateEdit = QtGui.QLineEdit(self.rrcPage) self.rrcSymbolRateEdit.setObjectName("rrcSymbolRateEdit") - self.formLayout_6.setWidget(0, QtGui.QFormLayout.FieldRole, self.rrcSymbolRateEdit) + self.formLayout_6.setWidget( + 0, QtGui.QFormLayout.FieldRole, self.rrcSymbolRateEdit) self.rrcAlphaEdit = QtGui.QLineEdit(self.rrcPage) self.rrcAlphaEdit.setObjectName("rrcAlphaEdit") - self.formLayout_6.setWidget(1, QtGui.QFormLayout.FieldRole, self.rrcAlphaEdit) + self.formLayout_6.setWidget( + 1, QtGui.QFormLayout.FieldRole, self.rrcAlphaEdit) self.rrcNumTapsEdit = QtGui.QLineEdit(self.rrcPage) self.rrcNumTapsEdit.setObjectName("rrcNumTapsEdit") - self.formLayout_6.setWidget(2, QtGui.QFormLayout.FieldRole, self.rrcNumTapsEdit) + self.formLayout_6.setWidget( + 2, QtGui.QFormLayout.FieldRole, self.rrcNumTapsEdit) self.filterTypeWidget.addWidget(self.rrcPage) self.gausPage = QtGui.QWidget() self.gausPage.setObjectName("gausPage") @@ -224,40 +275,49 @@ class Ui_MainWindow(object): self.formLayout_7.setObjectName("formLayout_7") self.gausSymbolRateLabel = QtGui.QLabel(self.gausPage) self.gausSymbolRateLabel.setObjectName("gausSymbolRateLabel") - self.formLayout_7.setWidget(0, QtGui.QFormLayout.LabelRole, self.gausSymbolRateLabel) + self.formLayout_7.setWidget( + 0, QtGui.QFormLayout.LabelRole, self.gausSymbolRateLabel) self.gausSymbolRateEdit = QtGui.QLineEdit(self.gausPage) self.gausSymbolRateEdit.setObjectName("gausSymbolRateEdit") - self.formLayout_7.setWidget(0, QtGui.QFormLayout.FieldRole, self.gausSymbolRateEdit) + self.formLayout_7.setWidget( + 0, QtGui.QFormLayout.FieldRole, self.gausSymbolRateEdit) self.gausBTLabel = QtGui.QLabel(self.gausPage) self.gausBTLabel.setObjectName("gausBTLabel") - self.formLayout_7.setWidget(1, QtGui.QFormLayout.LabelRole, self.gausBTLabel) + self.formLayout_7.setWidget( + 1, QtGui.QFormLayout.LabelRole, self.gausBTLabel) self.gausBTEdit = QtGui.QLineEdit(self.gausPage) self.gausBTEdit.setObjectName("gausBTEdit") - self.formLayout_7.setWidget(1, QtGui.QFormLayout.FieldRole, self.gausBTEdit) + self.formLayout_7.setWidget( + 1, QtGui.QFormLayout.FieldRole, self.gausBTEdit) self.gausNumTapsLabel = QtGui.QLabel(self.gausPage) self.gausNumTapsLabel.setObjectName("gausNumTapsLabel") - self.formLayout_7.setWidget(2, QtGui.QFormLayout.LabelRole, self.gausNumTapsLabel) + self.formLayout_7.setWidget( + 2, QtGui.QFormLayout.LabelRole, self.gausNumTapsLabel) self.gausNumTapsEdit = QtGui.QLineEdit(self.gausPage) self.gausNumTapsEdit.setObjectName("gausNumTapsEdit") - self.formLayout_7.setWidget(2, QtGui.QFormLayout.FieldRole, self.gausNumTapsEdit) + self.formLayout_7.setWidget( + 2, QtGui.QFormLayout.FieldRole, self.gausNumTapsEdit) self.filterTypeWidget.addWidget(self.gausPage) self.verticalLayout.addWidget(self.filterTypeWidget) self.filterPropsBox = QtGui.QGroupBox(self.filterFrame) self.filterPropsBox.setObjectName("filterPropsBox") self.formLayout_8 = QtGui.QFormLayout(self.filterPropsBox) - self.formLayout_8.setFieldGrowthPolicy(QtGui.QFormLayout.AllNonFixedFieldsGrow) + self.formLayout_8.setFieldGrowthPolicy( + QtGui.QFormLayout.AllNonFixedFieldsGrow) self.formLayout_8.setObjectName("formLayout_8") self.nTapsLabel = QtGui.QLabel(self.filterPropsBox) self.nTapsLabel.setMinimumSize(QtCore.QSize(150, 0)) self.nTapsLabel.setObjectName("nTapsLabel") - self.formLayout_8.setWidget(1, QtGui.QFormLayout.LabelRole, self.nTapsLabel) + self.formLayout_8.setWidget( + 1, QtGui.QFormLayout.LabelRole, self.nTapsLabel) self.nTapsEdit = QtGui.QLabel(self.filterPropsBox) self.nTapsEdit.setMaximumSize(QtCore.QSize(100, 16777215)) self.nTapsEdit.setFrameShape(QtGui.QFrame.Box) self.nTapsEdit.setFrameShadow(QtGui.QFrame.Raised) self.nTapsEdit.setText("") self.nTapsEdit.setObjectName("nTapsEdit") - self.formLayout_8.setWidget(1, QtGui.QFormLayout.FieldRole, self.nTapsEdit) + self.formLayout_8.setWidget( + 1, QtGui.QFormLayout.FieldRole, self.nTapsEdit) self.verticalLayout.addWidget(self.filterPropsBox) self.sysParamsBox = QtGui.QGroupBox(self.filterFrame) self.sysParamsBox.setObjectName("sysParamsBox") @@ -265,11 +325,13 @@ class Ui_MainWindow(object): self.formLayout_4.setObjectName("formLayout_4") self.nfftEdit = QtGui.QLineEdit(self.sysParamsBox) self.nfftEdit.setObjectName("nfftEdit") - self.formLayout_4.setWidget(1, QtGui.QFormLayout.FieldRole, self.nfftEdit) + self.formLayout_4.setWidget( + 1, QtGui.QFormLayout.FieldRole, self.nfftEdit) self.nfftLabel = QtGui.QLabel(self.sysParamsBox) self.nfftLabel.setMinimumSize(QtCore.QSize(150, 0)) self.nfftLabel.setObjectName("nfftLabel") - self.formLayout_4.setWidget(1, QtGui.QFormLayout.LabelRole, self.nfftLabel) + self.formLayout_4.setWidget( + 1, QtGui.QFormLayout.LabelRole, self.nfftLabel) self.verticalLayout.addWidget(self.sysParamsBox) self.designButton = QtGui.QPushButton(self.filterFrame) self.designButton.setMinimumSize(QtCore.QSize(0, 0)) @@ -339,30 +401,51 @@ class Ui_MainWindow(object): self.retranslateUi(MainWindow) self.filterTypeWidget.setCurrentIndex(5) self.tabGroup.setCurrentIndex(0) - QtCore.QObject.connect(self.action_exit, QtCore.SIGNAL("activated()"), MainWindow.close) + QtCore.QObject.connect(self.action_exit, QtCore.SIGNAL( + "activated()"), MainWindow.close) QtCore.QMetaObject.connectSlotsByName(MainWindow) - MainWindow.setTabOrder(self.filterTypeComboBox, self.filterDesignTypeComboBox) - MainWindow.setTabOrder(self.filterDesignTypeComboBox, self.sampleRateEdit) + MainWindow.setTabOrder(self.filterTypeComboBox, + self.filterDesignTypeComboBox) + MainWindow.setTabOrder( + self.filterDesignTypeComboBox, self.sampleRateEdit) MainWindow.setTabOrder(self.sampleRateEdit, self.filterGainEdit) MainWindow.setTabOrder(self.filterGainEdit, self.endofLpfPassBandEdit) - MainWindow.setTabOrder(self.endofLpfPassBandEdit, self.startofLpfStopBandEdit) - MainWindow.setTabOrder(self.startofLpfStopBandEdit, self.lpfStopBandAttenEdit) - MainWindow.setTabOrder(self.lpfStopBandAttenEdit, self.lpfPassBandRippleEdit) - MainWindow.setTabOrder(self.lpfPassBandRippleEdit, self.startofBpfPassBandEdit) - MainWindow.setTabOrder(self.startofBpfPassBandEdit, self.endofBpfPassBandEdit) - MainWindow.setTabOrder(self.endofBpfPassBandEdit, self.bpfTransitionEdit) - MainWindow.setTabOrder(self.bpfTransitionEdit, self.bpfStopBandAttenEdit) - MainWindow.setTabOrder(self.bpfStopBandAttenEdit, self.bpfPassBandRippleEdit) - MainWindow.setTabOrder(self.bpfPassBandRippleEdit, self.startofBnfStopBandEdit) - MainWindow.setTabOrder(self.startofBnfStopBandEdit, self.endofBnfStopBandEdit) - MainWindow.setTabOrder(self.endofBnfStopBandEdit, self.bnfTransitionEdit) - MainWindow.setTabOrder(self.bnfTransitionEdit, self.bnfStopBandAttenEdit) - MainWindow.setTabOrder(self.bnfStopBandAttenEdit, self.bnfPassBandRippleEdit) - MainWindow.setTabOrder(self.bnfPassBandRippleEdit, self.endofHpfStopBandEdit) - MainWindow.setTabOrder(self.endofHpfStopBandEdit, self.startofHpfPassBandEdit) - MainWindow.setTabOrder(self.startofHpfPassBandEdit, self.hpfStopBandAttenEdit) - MainWindow.setTabOrder(self.hpfStopBandAttenEdit, self.hpfPassBandRippleEdit) - MainWindow.setTabOrder(self.hpfPassBandRippleEdit, self.rrcSymbolRateEdit) + MainWindow.setTabOrder(self.endofLpfPassBandEdit, + self.startofLpfStopBandEdit) + MainWindow.setTabOrder(self.startofLpfStopBandEdit, + self.lpfStopBandAttenEdit) + MainWindow.setTabOrder(self.lpfStopBandAttenEdit, + self.lpfPassBandRippleEdit) + MainWindow.setTabOrder(self.lpfPassBandRippleEdit, + self.startofBpfPassBandEdit) + MainWindow.setTabOrder(self.startofBpfPassBandEdit, + self.endofBpfPassBandEdit) + MainWindow.setTabOrder(self.endofBpfPassBandEdit, + self.bpfTransitionEdit) + MainWindow.setTabOrder(self.bpfTransitionEdit, + self.bpfStopBandAttenEdit) + MainWindow.setTabOrder(self.bpfStopBandAttenEdit, + self.bpfPassBandRippleEdit) + MainWindow.setTabOrder(self.bpfPassBandRippleEdit, + self.startofBnfStopBandEdit) + MainWindow.setTabOrder(self.startofBnfStopBandEdit, + self.endofBnfStopBandEdit) + MainWindow.setTabOrder(self.endofBnfStopBandEdit, + self.bnfTransitionEdit) + MainWindow.setTabOrder(self.bnfTransitionEdit, + self.bnfStopBandAttenEdit) + MainWindow.setTabOrder(self.bnfStopBandAttenEdit, + self.bnfPassBandRippleEdit) + MainWindow.setTabOrder(self.bnfPassBandRippleEdit, + self.endofHpfStopBandEdit) + MainWindow.setTabOrder(self.endofHpfStopBandEdit, + self.startofHpfPassBandEdit) + MainWindow.setTabOrder(self.startofHpfPassBandEdit, + self.hpfStopBandAttenEdit) + MainWindow.setTabOrder(self.hpfStopBandAttenEdit, + self.hpfPassBandRippleEdit) + MainWindow.setTabOrder( + self.hpfPassBandRippleEdit, self.rrcSymbolRateEdit) MainWindow.setTabOrder(self.rrcSymbolRateEdit, self.rrcAlphaEdit) MainWindow.setTabOrder(self.rrcAlphaEdit, self.rrcNumTapsEdit) MainWindow.setTabOrder(self.rrcNumTapsEdit, self.gausSymbolRateEdit) @@ -373,63 +456,118 @@ class Ui_MainWindow(object): MainWindow.setTabOrder(self.designButton, self.tabGroup) def retranslateUi(self, MainWindow): - MainWindow.setWindowTitle(QtGui.QApplication.translate("MainWindow", "GNU Radio Filter Design Tool", None, QtGui.QApplication.UnicodeUTF8)) - self.filterTypeComboBox.setItemText(0, QtGui.QApplication.translate("MainWindow", "Low Pass", None, QtGui.QApplication.UnicodeUTF8)) - self.filterTypeComboBox.setItemText(1, QtGui.QApplication.translate("MainWindow", "Band Pass", None, QtGui.QApplication.UnicodeUTF8)) - self.filterTypeComboBox.setItemText(2, QtGui.QApplication.translate("MainWindow", "Complex Band Pass", None, QtGui.QApplication.UnicodeUTF8)) - self.filterTypeComboBox.setItemText(3, QtGui.QApplication.translate("MainWindow", "Band Notch", None, QtGui.QApplication.UnicodeUTF8)) - self.filterTypeComboBox.setItemText(4, QtGui.QApplication.translate("MainWindow", "High Pass", None, QtGui.QApplication.UnicodeUTF8)) - self.filterTypeComboBox.setItemText(5, QtGui.QApplication.translate("MainWindow", "Root Raised Cosine", None, QtGui.QApplication.UnicodeUTF8)) - self.filterTypeComboBox.setItemText(6, QtGui.QApplication.translate("MainWindow", "Gaussian", None, QtGui.QApplication.UnicodeUTF8)) - self.filterDesignTypeComboBox.setItemText(0, QtGui.QApplication.translate("MainWindow", "Hamming Window", None, QtGui.QApplication.UnicodeUTF8)) - self.filterDesignTypeComboBox.setItemText(1, QtGui.QApplication.translate("MainWindow", "Hann Window", None, QtGui.QApplication.UnicodeUTF8)) - self.filterDesignTypeComboBox.setItemText(2, QtGui.QApplication.translate("MainWindow", "Blackman Window", None, QtGui.QApplication.UnicodeUTF8)) - self.filterDesignTypeComboBox.setItemText(3, QtGui.QApplication.translate("MainWindow", "Rectangular Window", None, QtGui.QApplication.UnicodeUTF8)) - self.filterDesignTypeComboBox.setItemText(4, QtGui.QApplication.translate("MainWindow", "Kaiser Window", None, QtGui.QApplication.UnicodeUTF8)) - self.filterDesignTypeComboBox.setItemText(5, QtGui.QApplication.translate("MainWindow", "Blackman-harris Window", None, QtGui.QApplication.UnicodeUTF8)) - self.filterDesignTypeComboBox.setItemText(6, QtGui.QApplication.translate("MainWindow", "Equiripple", None, QtGui.QApplication.UnicodeUTF8)) - self.sampleRateLabel.setText(QtGui.QApplication.translate("MainWindow", "Sample Rate (sps)", None, QtGui.QApplication.UnicodeUTF8)) - self.filterGainLabel.setText(QtGui.QApplication.translate("MainWindow", "Filter Gain", None, QtGui.QApplication.UnicodeUTF8)) - self.endofLpfPassBandLabel.setText(QtGui.QApplication.translate("MainWindow", "End of Pass Band (Hz)", None, QtGui.QApplication.UnicodeUTF8)) - self.startofLpfStopBandLabel.setText(QtGui.QApplication.translate("MainWindow", "Start of Stop Band (Hz)", None, QtGui.QApplication.UnicodeUTF8)) - self.lpfStopBandAttenLabel.setText(QtGui.QApplication.translate("MainWindow", "Stop Band Attenuation (dB)", None, QtGui.QApplication.UnicodeUTF8)) - self.lpfPassBandRippleLabel.setText(QtGui.QApplication.translate("MainWindow", "Pass Band Ripple (dB)", None, QtGui.QApplication.UnicodeUTF8)) - self.startofBpfPassBandLabel.setText(QtGui.QApplication.translate("MainWindow", "Start of Pass Band (Hz)", None, QtGui.QApplication.UnicodeUTF8)) - self.endofBpfPassBandLabel.setText(QtGui.QApplication.translate("MainWindow", "End of Pass Band (Hz)", None, QtGui.QApplication.UnicodeUTF8)) - self.bpfStopBandAttenLabel.setText(QtGui.QApplication.translate("MainWindow", "Stop Band Attenuation (dB)", None, QtGui.QApplication.UnicodeUTF8)) - self.bpfTransitionLabel.setText(QtGui.QApplication.translate("MainWindow", "Transition Width (Hz)", None, QtGui.QApplication.UnicodeUTF8)) - self.bpfPassBandRippleLabel.setText(QtGui.QApplication.translate("MainWindow", "Pass Band Ripple (dB)", None, QtGui.QApplication.UnicodeUTF8)) - self.startofBnfStopBandLabel.setText(QtGui.QApplication.translate("MainWindow", "Start of Stop Band (Hz)", None, QtGui.QApplication.UnicodeUTF8)) - self.endofBnfStopBandLabel.setText(QtGui.QApplication.translate("MainWindow", "End of Stop Band (Hz)", None, QtGui.QApplication.UnicodeUTF8)) - self.bnfTransitionLabel.setText(QtGui.QApplication.translate("MainWindow", "Transition Width (Hz)", None, QtGui.QApplication.UnicodeUTF8)) - self.bnfStopBandAttenLabel.setText(QtGui.QApplication.translate("MainWindow", "Stop Band Attenuation (dB)", None, QtGui.QApplication.UnicodeUTF8)) - self.bnfPassBandRippleLabel.setText(QtGui.QApplication.translate("MainWindow", "Pass Band Ripple (dB)", None, QtGui.QApplication.UnicodeUTF8)) - self.endofHpfStopBandLabel.setText(QtGui.QApplication.translate("MainWindow", "End of Stop Band (Hz)", None, QtGui.QApplication.UnicodeUTF8)) - self.startofHpfPassBandLabel.setText(QtGui.QApplication.translate("MainWindow", "Start of Pass Band (Hz)", None, QtGui.QApplication.UnicodeUTF8)) - self.hpfStopBandAttenLabel.setText(QtGui.QApplication.translate("MainWindow", "Stop Band Attenuation (dB)", None, QtGui.QApplication.UnicodeUTF8)) - self.hpfPassBandRippleLabel.setText(QtGui.QApplication.translate("MainWindow", "Pass Band Ripple (dB)", None, QtGui.QApplication.UnicodeUTF8)) - self.rrcSymbolRateLabel.setText(QtGui.QApplication.translate("MainWindow", "Symbol Rate (sps)", None, QtGui.QApplication.UnicodeUTF8)) - self.rrcAlphaLabel.setText(QtGui.QApplication.translate("MainWindow", "Roll-off Factor", None, QtGui.QApplication.UnicodeUTF8)) - self.rrcNumTapsLabel.setText(QtGui.QApplication.translate("MainWindow", "Number of Taps", None, QtGui.QApplication.UnicodeUTF8)) - self.gausSymbolRateLabel.setText(QtGui.QApplication.translate("MainWindow", "Symbol Rate (sps)", None, QtGui.QApplication.UnicodeUTF8)) - self.gausBTLabel.setText(QtGui.QApplication.translate("MainWindow", "Roll-off Factor", None, QtGui.QApplication.UnicodeUTF8)) - self.gausNumTapsLabel.setText(QtGui.QApplication.translate("MainWindow", "Number of Taps", None, QtGui.QApplication.UnicodeUTF8)) - self.filterPropsBox.setTitle(QtGui.QApplication.translate("MainWindow", "Filter Properties", None, QtGui.QApplication.UnicodeUTF8)) - self.nTapsLabel.setText(QtGui.QApplication.translate("MainWindow", "Number of Taps:", None, QtGui.QApplication.UnicodeUTF8)) - self.sysParamsBox.setTitle(QtGui.QApplication.translate("MainWindow", "System Parameters", None, QtGui.QApplication.UnicodeUTF8)) - self.nfftLabel.setText(QtGui.QApplication.translate("MainWindow", "Num FFT points", None, QtGui.QApplication.UnicodeUTF8)) - self.designButton.setText(QtGui.QApplication.translate("MainWindow", "Design", None, QtGui.QApplication.UnicodeUTF8)) - self.tabGroup.setTabText(self.tabGroup.indexOf(self.freqTab), QtGui.QApplication.translate("MainWindow", "Frequency Domain", None, QtGui.QApplication.UnicodeUTF8)) - self.tabGroup.setTabText(self.tabGroup.indexOf(self.timeTab), QtGui.QApplication.translate("MainWindow", "Time Domain", None, QtGui.QApplication.UnicodeUTF8)) - self.tabGroup.setTabText(self.tabGroup.indexOf(self.phaseTab), QtGui.QApplication.translate("MainWindow", "Phase", None, QtGui.QApplication.UnicodeUTF8)) - self.tabGroup.setTabText(self.tabGroup.indexOf(self.groupTab), QtGui.QApplication.translate("MainWindow", "Group Delay", None, QtGui.QApplication.UnicodeUTF8)) - self.menu_File.setTitle(QtGui.QApplication.translate("MainWindow", "&File", None, QtGui.QApplication.UnicodeUTF8)) - self.action_exit.setText(QtGui.QApplication.translate("MainWindow", "E&xit", None, QtGui.QApplication.UnicodeUTF8)) - self.action_save.setText(QtGui.QApplication.translate("MainWindow", "&Save", None, QtGui.QApplication.UnicodeUTF8)) - self.action_save.setShortcut(QtGui.QApplication.translate("MainWindow", "Ctrl+S", 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)) + MainWindow.setWindowTitle(QtGui.QApplication.translate( + "MainWindow", "GNU Radio Filter Design Tool", None, QtGui.QApplication.UnicodeUTF8)) + self.filterTypeComboBox.setItemText(0, QtGui.QApplication.translate( + "MainWindow", "Low Pass", None, QtGui.QApplication.UnicodeUTF8)) + self.filterTypeComboBox.setItemText(1, QtGui.QApplication.translate( + "MainWindow", "Band Pass", None, QtGui.QApplication.UnicodeUTF8)) + self.filterTypeComboBox.setItemText(2, QtGui.QApplication.translate( + "MainWindow", "Complex Band Pass", None, QtGui.QApplication.UnicodeUTF8)) + self.filterTypeComboBox.setItemText(3, QtGui.QApplication.translate( + "MainWindow", "Band Notch", None, QtGui.QApplication.UnicodeUTF8)) + self.filterTypeComboBox.setItemText(4, QtGui.QApplication.translate( + "MainWindow", "High Pass", None, QtGui.QApplication.UnicodeUTF8)) + self.filterTypeComboBox.setItemText(5, QtGui.QApplication.translate( + "MainWindow", "Root Raised Cosine", None, QtGui.QApplication.UnicodeUTF8)) + self.filterTypeComboBox.setItemText(6, QtGui.QApplication.translate( + "MainWindow", "Gaussian", None, QtGui.QApplication.UnicodeUTF8)) + self.filterDesignTypeComboBox.setItemText(0, QtGui.QApplication.translate( + "MainWindow", "Hamming Window", None, QtGui.QApplication.UnicodeUTF8)) + self.filterDesignTypeComboBox.setItemText(1, QtGui.QApplication.translate( + "MainWindow", "Hann Window", None, QtGui.QApplication.UnicodeUTF8)) + self.filterDesignTypeComboBox.setItemText(2, QtGui.QApplication.translate( + "MainWindow", "Blackman Window", None, QtGui.QApplication.UnicodeUTF8)) + self.filterDesignTypeComboBox.setItemText(3, QtGui.QApplication.translate( + "MainWindow", "Rectangular Window", None, QtGui.QApplication.UnicodeUTF8)) + self.filterDesignTypeComboBox.setItemText(4, QtGui.QApplication.translate( + "MainWindow", "Kaiser Window", None, QtGui.QApplication.UnicodeUTF8)) + self.filterDesignTypeComboBox.setItemText(5, QtGui.QApplication.translate( + "MainWindow", "Blackman-harris Window", None, QtGui.QApplication.UnicodeUTF8)) + self.filterDesignTypeComboBox.setItemText(6, QtGui.QApplication.translate( + "MainWindow", "Equiripple", None, QtGui.QApplication.UnicodeUTF8)) + self.sampleRateLabel.setText(QtGui.QApplication.translate( + "MainWindow", "Sample Rate (sps)", None, QtGui.QApplication.UnicodeUTF8)) + self.filterGainLabel.setText(QtGui.QApplication.translate( + "MainWindow", "Filter Gain", None, QtGui.QApplication.UnicodeUTF8)) + self.endofLpfPassBandLabel.setText(QtGui.QApplication.translate( + "MainWindow", "End of Pass Band (Hz)", None, QtGui.QApplication.UnicodeUTF8)) + self.startofLpfStopBandLabel.setText(QtGui.QApplication.translate( + "MainWindow", "Start of Stop Band (Hz)", None, QtGui.QApplication.UnicodeUTF8)) + self.lpfStopBandAttenLabel.setText(QtGui.QApplication.translate( + "MainWindow", "Stop Band Attenuation (dB)", None, QtGui.QApplication.UnicodeUTF8)) + self.lpfPassBandRippleLabel.setText(QtGui.QApplication.translate( + "MainWindow", "Pass Band Ripple (dB)", None, QtGui.QApplication.UnicodeUTF8)) + self.startofBpfPassBandLabel.setText(QtGui.QApplication.translate( + "MainWindow", "Start of Pass Band (Hz)", None, QtGui.QApplication.UnicodeUTF8)) + self.endofBpfPassBandLabel.setText(QtGui.QApplication.translate( + "MainWindow", "End of Pass Band (Hz)", None, QtGui.QApplication.UnicodeUTF8)) + self.bpfStopBandAttenLabel.setText(QtGui.QApplication.translate( + "MainWindow", "Stop Band Attenuation (dB)", None, QtGui.QApplication.UnicodeUTF8)) + self.bpfTransitionLabel.setText(QtGui.QApplication.translate( + "MainWindow", "Transition Width (Hz)", None, QtGui.QApplication.UnicodeUTF8)) + self.bpfPassBandRippleLabel.setText(QtGui.QApplication.translate( + "MainWindow", "Pass Band Ripple (dB)", None, QtGui.QApplication.UnicodeUTF8)) + self.startofBnfStopBandLabel.setText(QtGui.QApplication.translate( + "MainWindow", "Start of Stop Band (Hz)", None, QtGui.QApplication.UnicodeUTF8)) + self.endofBnfStopBandLabel.setText(QtGui.QApplication.translate( + "MainWindow", "End of Stop Band (Hz)", None, QtGui.QApplication.UnicodeUTF8)) + self.bnfTransitionLabel.setText(QtGui.QApplication.translate( + "MainWindow", "Transition Width (Hz)", None, QtGui.QApplication.UnicodeUTF8)) + self.bnfStopBandAttenLabel.setText(QtGui.QApplication.translate( + "MainWindow", "Stop Band Attenuation (dB)", None, QtGui.QApplication.UnicodeUTF8)) + self.bnfPassBandRippleLabel.setText(QtGui.QApplication.translate( + "MainWindow", "Pass Band Ripple (dB)", None, QtGui.QApplication.UnicodeUTF8)) + self.endofHpfStopBandLabel.setText(QtGui.QApplication.translate( + "MainWindow", "End of Stop Band (Hz)", None, QtGui.QApplication.UnicodeUTF8)) + self.startofHpfPassBandLabel.setText(QtGui.QApplication.translate( + "MainWindow", "Start of Pass Band (Hz)", None, QtGui.QApplication.UnicodeUTF8)) + self.hpfStopBandAttenLabel.setText(QtGui.QApplication.translate( + "MainWindow", "Stop Band Attenuation (dB)", None, QtGui.QApplication.UnicodeUTF8)) + self.hpfPassBandRippleLabel.setText(QtGui.QApplication.translate( + "MainWindow", "Pass Band Ripple (dB)", None, QtGui.QApplication.UnicodeUTF8)) + self.rrcSymbolRateLabel.setText(QtGui.QApplication.translate( + "MainWindow", "Symbol Rate (sps)", None, QtGui.QApplication.UnicodeUTF8)) + self.rrcAlphaLabel.setText(QtGui.QApplication.translate( + "MainWindow", "Roll-off Factor", None, QtGui.QApplication.UnicodeUTF8)) + self.rrcNumTapsLabel.setText(QtGui.QApplication.translate( + "MainWindow", "Number of Taps", None, QtGui.QApplication.UnicodeUTF8)) + self.gausSymbolRateLabel.setText(QtGui.QApplication.translate( + "MainWindow", "Symbol Rate (sps)", None, QtGui.QApplication.UnicodeUTF8)) + self.gausBTLabel.setText(QtGui.QApplication.translate( + "MainWindow", "Roll-off Factor", None, QtGui.QApplication.UnicodeUTF8)) + self.gausNumTapsLabel.setText(QtGui.QApplication.translate( + "MainWindow", "Number of Taps", None, QtGui.QApplication.UnicodeUTF8)) + self.filterPropsBox.setTitle(QtGui.QApplication.translate( + "MainWindow", "Filter Properties", None, QtGui.QApplication.UnicodeUTF8)) + self.nTapsLabel.setText(QtGui.QApplication.translate( + "MainWindow", "Number of Taps:", None, QtGui.QApplication.UnicodeUTF8)) + self.sysParamsBox.setTitle(QtGui.QApplication.translate( + "MainWindow", "System Parameters", None, QtGui.QApplication.UnicodeUTF8)) + self.nfftLabel.setText(QtGui.QApplication.translate( + "MainWindow", "Num FFT points", None, QtGui.QApplication.UnicodeUTF8)) + self.designButton.setText(QtGui.QApplication.translate( + "MainWindow", "Design", None, QtGui.QApplication.UnicodeUTF8)) + self.tabGroup.setTabText(self.tabGroup.indexOf(self.freqTab), QtGui.QApplication.translate( + "MainWindow", "Frequency Domain", None, QtGui.QApplication.UnicodeUTF8)) + self.tabGroup.setTabText(self.tabGroup.indexOf(self.timeTab), QtGui.QApplication.translate( + "MainWindow", "Time Domain", None, QtGui.QApplication.UnicodeUTF8)) + self.tabGroup.setTabText(self.tabGroup.indexOf(self.phaseTab), QtGui.QApplication.translate( + "MainWindow", "Phase", None, QtGui.QApplication.UnicodeUTF8)) + self.tabGroup.setTabText(self.tabGroup.indexOf(self.groupTab), QtGui.QApplication.translate( + "MainWindow", "Group Delay", None, QtGui.QApplication.UnicodeUTF8)) + self.menu_File.setTitle(QtGui.QApplication.translate( + "MainWindow", "&File", None, QtGui.QApplication.UnicodeUTF8)) + self.action_exit.setText(QtGui.QApplication.translate( + "MainWindow", "E&xit", None, QtGui.QApplication.UnicodeUTF8)) + self.action_save.setText(QtGui.QApplication.translate( + "MainWindow", "&Save", None, QtGui.QApplication.UnicodeUTF8)) + self.action_save.setShortcut(QtGui.QApplication.translate( + "MainWindow", "Ctrl+S", 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)) -#from qwt_plot import QwtPlot -from PyQt5.Qwt import QwtPlot +#from qwt_plot import QwtPlot diff --git a/gr-utils/plot_tools/pyqt_plot.py b/gr-utils/plot_tools/pyqt_plot.py index 2d4df6c5a7..f102fe50e4 100644 --- a/gr-utils/plot_tools/pyqt_plot.py +++ b/gr-utils/plot_tools/pyqt_plot.py @@ -6,6 +6,7 @@ # # WARNING! All changes made in this file will be lost! +from PyQt5 import Qwt from PyQt5 import QtCore, QtGui try: @@ -16,12 +17,14 @@ except AttributeError: try: _encoding = QtGui.QApplication.UnicodeUTF8 + def _translate(context, text, disambig): return QtGui.QApplication.translate(context, text, disambig, _encoding) except AttributeError: def _translate(context, text, disambig): return QtGui.QApplication.translate(context, text, disambig) + class Ui_MainWindow(object): def setupUi(self, MainWindow): MainWindow.setObjectName(_fromUtf8("MainWindow")) @@ -44,54 +47,73 @@ class Ui_MainWindow(object): self.filePosStartLineEdit = QtGui.QLineEdit(self.filePosBox) self.filePosStartLineEdit.setMinimumSize(QtCore.QSize(50, 0)) self.filePosStartLineEdit.setMaximumSize(QtCore.QSize(100, 16777215)) - self.filePosStartLineEdit.setObjectName(_fromUtf8("filePosStartLineEdit")) - self.filePosLayout.setWidget(0, QtGui.QFormLayout.FieldRole, self.filePosStartLineEdit) + self.filePosStartLineEdit.setObjectName( + _fromUtf8("filePosStartLineEdit")) + self.filePosLayout.setWidget( + 0, QtGui.QFormLayout.FieldRole, self.filePosStartLineEdit) self.filePosStopLabel = QtGui.QLabel(self.filePosBox) self.filePosStopLabel.setObjectName(_fromUtf8("filePosStopLabel")) - self.filePosLayout.setWidget(1, QtGui.QFormLayout.LabelRole, self.filePosStopLabel) + self.filePosLayout.setWidget( + 1, QtGui.QFormLayout.LabelRole, self.filePosStopLabel) self.filePosStopLineEdit = QtGui.QLineEdit(self.filePosBox) self.filePosStopLineEdit.setMinimumSize(QtCore.QSize(50, 0)) self.filePosStopLineEdit.setMaximumSize(QtCore.QSize(100, 16777215)) - self.filePosStopLineEdit.setObjectName(_fromUtf8("filePosStopLineEdit")) - self.filePosLayout.setWidget(1, QtGui.QFormLayout.FieldRole, self.filePosStopLineEdit) + self.filePosStopLineEdit.setObjectName( + _fromUtf8("filePosStopLineEdit")) + self.filePosLayout.setWidget( + 1, QtGui.QFormLayout.FieldRole, self.filePosStopLineEdit) self.filePosLengthLabel = QtGui.QLabel(self.filePosBox) self.filePosLengthLabel.setObjectName(_fromUtf8("filePosLengthLabel")) - self.filePosLayout.setWidget(2, QtGui.QFormLayout.LabelRole, self.filePosLengthLabel) + self.filePosLayout.setWidget( + 2, QtGui.QFormLayout.LabelRole, self.filePosLengthLabel) self.filePosLengthLineEdit = QtGui.QLineEdit(self.filePosBox) self.filePosLengthLineEdit.setMinimumSize(QtCore.QSize(50, 0)) self.filePosLengthLineEdit.setMaximumSize(QtCore.QSize(100, 16777215)) - self.filePosLengthLineEdit.setObjectName(_fromUtf8("filePosLengthLineEdit")) - self.filePosLayout.setWidget(2, QtGui.QFormLayout.FieldRole, self.filePosLengthLineEdit) + self.filePosLengthLineEdit.setObjectName( + _fromUtf8("filePosLengthLineEdit")) + self.filePosLayout.setWidget( + 2, QtGui.QFormLayout.FieldRole, self.filePosLengthLineEdit) self.filePosStartLabel = QtGui.QLabel(self.filePosBox) self.filePosStartLabel.setObjectName(_fromUtf8("filePosStartLabel")) - self.filePosLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.filePosStartLabel) + self.filePosLayout.setWidget( + 0, QtGui.QFormLayout.LabelRole, self.filePosStartLabel) self.gridLayout_4.addLayout(self.filePosLayout, 0, 0, 1, 1) self.fileTimeLayout = QtGui.QFormLayout() self.fileTimeLayout.setObjectName(_fromUtf8("fileTimeLayout")) self.fileTimeStartLabel = QtGui.QLabel(self.filePosBox) self.fileTimeStartLabel.setObjectName(_fromUtf8("fileTimeStartLabel")) - self.fileTimeLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.fileTimeStartLabel) + self.fileTimeLayout.setWidget( + 0, QtGui.QFormLayout.LabelRole, self.fileTimeStartLabel) self.fileTimeStartLineEdit = QtGui.QLineEdit(self.filePosBox) self.fileTimeStartLineEdit.setMinimumSize(QtCore.QSize(50, 0)) self.fileTimeStartLineEdit.setMaximumSize(QtCore.QSize(100, 16777215)) - self.fileTimeStartLineEdit.setObjectName(_fromUtf8("fileTimeStartLineEdit")) - self.fileTimeLayout.setWidget(0, QtGui.QFormLayout.FieldRole, self.fileTimeStartLineEdit) + self.fileTimeStartLineEdit.setObjectName( + _fromUtf8("fileTimeStartLineEdit")) + self.fileTimeLayout.setWidget( + 0, QtGui.QFormLayout.FieldRole, self.fileTimeStartLineEdit) self.fileTimeStopLabel = QtGui.QLabel(self.filePosBox) self.fileTimeStopLabel.setObjectName(_fromUtf8("fileTimeStopLabel")) - self.fileTimeLayout.setWidget(1, QtGui.QFormLayout.LabelRole, self.fileTimeStopLabel) + self.fileTimeLayout.setWidget( + 1, QtGui.QFormLayout.LabelRole, self.fileTimeStopLabel) self.fileTimeStopLineEdit = QtGui.QLineEdit(self.filePosBox) self.fileTimeStopLineEdit.setMinimumSize(QtCore.QSize(50, 0)) self.fileTimeStopLineEdit.setMaximumSize(QtCore.QSize(100, 16777215)) - self.fileTimeStopLineEdit.setObjectName(_fromUtf8("fileTimeStopLineEdit")) - self.fileTimeLayout.setWidget(1, QtGui.QFormLayout.FieldRole, self.fileTimeStopLineEdit) + self.fileTimeStopLineEdit.setObjectName( + _fromUtf8("fileTimeStopLineEdit")) + self.fileTimeLayout.setWidget( + 1, QtGui.QFormLayout.FieldRole, self.fileTimeStopLineEdit) self.fileTimeLengthLabel = QtGui.QLabel(self.filePosBox) - self.fileTimeLengthLabel.setObjectName(_fromUtf8("fileTimeLengthLabel")) - self.fileTimeLayout.setWidget(2, QtGui.QFormLayout.LabelRole, self.fileTimeLengthLabel) + self.fileTimeLengthLabel.setObjectName( + _fromUtf8("fileTimeLengthLabel")) + self.fileTimeLayout.setWidget( + 2, QtGui.QFormLayout.LabelRole, self.fileTimeLengthLabel) self.fileTimeLengthLineEdit = QtGui.QLineEdit(self.filePosBox) self.fileTimeLengthLineEdit.setMinimumSize(QtCore.QSize(50, 0)) self.fileTimeLengthLineEdit.setMaximumSize(QtCore.QSize(100, 16777215)) - self.fileTimeLengthLineEdit.setObjectName(_fromUtf8("fileTimeLengthLineEdit")) - self.fileTimeLayout.setWidget(2, QtGui.QFormLayout.FieldRole, self.fileTimeLengthLineEdit) + self.fileTimeLengthLineEdit.setObjectName( + _fromUtf8("fileTimeLengthLineEdit")) + self.fileTimeLayout.setWidget( + 2, QtGui.QFormLayout.FieldRole, self.fileTimeLengthLineEdit) self.gridLayout_4.addLayout(self.fileTimeLayout, 0, 1, 1, 1) self.gridLayout.addWidget(self.filePosBox, 2, 0, 1, 1) self.displayGroupBox = QtGui.QGroupBox(self.centralwidget) @@ -131,16 +153,19 @@ class Ui_MainWindow(object): self.sysGroupBox.setMinimumSize(QtCore.QSize(200, 0)) self.sysGroupBox.setObjectName(_fromUtf8("sysGroupBox")) self.formLayout = QtGui.QFormLayout(self.sysGroupBox) - self.formLayout.setFieldGrowthPolicy(QtGui.QFormLayout.AllNonFixedFieldsGrow) + self.formLayout.setFieldGrowthPolicy( + QtGui.QFormLayout.AllNonFixedFieldsGrow) self.formLayout.setObjectName(_fromUtf8("formLayout")) self.sampleRateLabel = QtGui.QLabel(self.sysGroupBox) self.sampleRateLabel.setObjectName(_fromUtf8("sampleRateLabel")) - self.formLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.sampleRateLabel) + self.formLayout.setWidget( + 0, QtGui.QFormLayout.LabelRole, self.sampleRateLabel) self.sampleRateLineEdit = QtGui.QLineEdit(self.sysGroupBox) self.sampleRateLineEdit.setMinimumSize(QtCore.QSize(50, 0)) self.sampleRateLineEdit.setMaximumSize(QtCore.QSize(100, 16777215)) self.sampleRateLineEdit.setObjectName(_fromUtf8("sampleRateLineEdit")) - self.formLayout.setWidget(0, QtGui.QFormLayout.FieldRole, self.sampleRateLineEdit) + self.formLayout.setWidget( + 0, QtGui.QFormLayout.FieldRole, self.sampleRateLineEdit) self.gridLayout.addWidget(self.sysGroupBox, 2, 1, 1, 1) self.frame = QtGui.QFrame(self.centralwidget) self.frame.setFrameShape(QtGui.QFrame.StyledPanel) @@ -170,16 +195,19 @@ class Ui_MainWindow(object): self.fftPropBox.setMinimumSize(QtCore.QSize(160, 0)) self.fftPropBox.setObjectName(_fromUtf8("fftPropBox")) self.formLayout_4 = QtGui.QFormLayout(self.fftPropBox) - self.formLayout_4.setFieldGrowthPolicy(QtGui.QFormLayout.AllNonFixedFieldsGrow) + self.formLayout_4.setFieldGrowthPolicy( + QtGui.QFormLayout.AllNonFixedFieldsGrow) self.formLayout_4.setObjectName(_fromUtf8("formLayout_4")) self.psdFFTSizeLabel = QtGui.QLabel(self.fftPropBox) self.psdFFTSizeLabel.setObjectName(_fromUtf8("psdFFTSizeLabel")) - self.formLayout_4.setWidget(0, QtGui.QFormLayout.LabelRole, self.psdFFTSizeLabel) + self.formLayout_4.setWidget( + 0, QtGui.QFormLayout.LabelRole, self.psdFFTSizeLabel) self.psdFFTComboBox = QtGui.QComboBox(self.fftPropBox) self.psdFFTComboBox.setMinimumSize(QtCore.QSize(96, 0)) self.psdFFTComboBox.setMaximumSize(QtCore.QSize(96, 16777215)) self.psdFFTComboBox.setObjectName(_fromUtf8("psdFFTComboBox")) - self.formLayout_4.setWidget(0, QtGui.QFormLayout.FieldRole, self.psdFFTComboBox) + self.formLayout_4.setWidget( + 0, QtGui.QFormLayout.FieldRole, self.psdFFTComboBox) self.psdFFTSizeLabel.raise_() self.psdFFTComboBox.raise_() self.horizontalLayout_2.addWidget(self.fftPropBox) @@ -198,12 +226,14 @@ class Ui_MainWindow(object): self.formLayout_3.setObjectName(_fromUtf8("formLayout_3")) self.specFFTLabel = QtGui.QLabel(self.groupBox) self.specFFTLabel.setObjectName(_fromUtf8("specFFTLabel")) - self.formLayout_3.setWidget(1, QtGui.QFormLayout.LabelRole, self.specFFTLabel) + self.formLayout_3.setWidget( + 1, QtGui.QFormLayout.LabelRole, self.specFFTLabel) self.specFFTComboBox = QtGui.QComboBox(self.groupBox) self.specFFTComboBox.setMinimumSize(QtCore.QSize(96, 0)) self.specFFTComboBox.setMaximumSize(QtCore.QSize(96, 16777215)) self.specFFTComboBox.setObjectName(_fromUtf8("specFFTComboBox")) - self.formLayout_3.setWidget(1, QtGui.QFormLayout.FieldRole, self.specFFTComboBox) + self.formLayout_3.setWidget( + 1, QtGui.QFormLayout.FieldRole, self.specFFTComboBox) self.horizontalLayout_3.addWidget(self.groupBox) self.specPlot = Qwt5.QwtPlot(self.specTab) self.specPlot.setObjectName(_fromUtf8("specPlot")) @@ -237,35 +267,51 @@ class Ui_MainWindow(object): self.retranslateUi(MainWindow) self.tabGroup.setCurrentIndex(0) - QtCore.QObject.connect(self.action_exit, QtCore.SIGNAL(_fromUtf8("activated()")), MainWindow.close) + QtCore.QObject.connect(self.action_exit, QtCore.SIGNAL( + _fromUtf8("activated()")), MainWindow.close) QtCore.QMetaObject.connectSlotsByName(MainWindow) def retranslateUi(self, MainWindow): MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow", None)) - self.filePosBox.setTitle(_translate("MainWindow", "File Position", None)) + self.filePosBox.setTitle(_translate( + "MainWindow", "File Position", None)) self.filePosStopLabel.setText(_translate("MainWindow", "Stop", None)) - self.filePosLengthLabel.setText(_translate("MainWindow", "Length", None)) + self.filePosLengthLabel.setText( + _translate("MainWindow", "Length", None)) self.filePosStartLabel.setText(_translate("MainWindow", "Start", None)) - self.fileTimeStartLabel.setText(_translate("MainWindow", "time start (sec)", None)) - self.fileTimeStopLabel.setText(_translate("MainWindow", "time stop (sec)", None)) - self.fileTimeLengthLabel.setText(_translate("MainWindow", "time length (sec)", None)) - self.displayGroupBox.setTitle(_translate("MainWindow", "Display Properties", None)) - self.lineWidthLabel.setText(_translate("MainWindow", "Line Width", None)) - self.lineStyleLabel.setText(_translate("MainWindow", "Line Style", None)) - self.styleSizeLabel.setText(_translate("MainWindow", "Style Size", None)) - self.sysGroupBox.setTitle(_translate("MainWindow", "System Properties", None)) - self.sampleRateLabel.setText(_translate("MainWindow", "Sample Rate", None)) - self.tabGroup.setTabText(self.tabGroup.indexOf(self.timeTab), _translate("MainWindow", "Time Domain", None)) - self.fftPropBox.setTitle(_translate("MainWindow", "FFT Properties", None)) - self.psdFFTSizeLabel.setText(_translate("MainWindow", "FFT Size", None)) - self.tabGroup.setTabText(self.tabGroup.indexOf(self.freqTab), _translate("MainWindow", "Frequency Domain", None)) - self.groupBox.setTitle(_translate("MainWindow", "Spectrogram Properties", None)) + self.fileTimeStartLabel.setText(_translate( + "MainWindow", "time start (sec)", None)) + self.fileTimeStopLabel.setText(_translate( + "MainWindow", "time stop (sec)", None)) + self.fileTimeLengthLabel.setText(_translate( + "MainWindow", "time length (sec)", None)) + self.displayGroupBox.setTitle(_translate( + "MainWindow", "Display Properties", None)) + self.lineWidthLabel.setText( + _translate("MainWindow", "Line Width", None)) + self.lineStyleLabel.setText( + _translate("MainWindow", "Line Style", None)) + self.styleSizeLabel.setText( + _translate("MainWindow", "Style Size", None)) + self.sysGroupBox.setTitle(_translate( + "MainWindow", "System Properties", None)) + self.sampleRateLabel.setText( + _translate("MainWindow", "Sample Rate", None)) + self.tabGroup.setTabText(self.tabGroup.indexOf( + self.timeTab), _translate("MainWindow", "Time Domain", None)) + self.fftPropBox.setTitle(_translate( + "MainWindow", "FFT Properties", None)) + self.psdFFTSizeLabel.setText( + _translate("MainWindow", "FFT Size", None)) + self.tabGroup.setTabText(self.tabGroup.indexOf( + self.freqTab), _translate("MainWindow", "Frequency Domain", None)) + self.groupBox.setTitle(_translate( + "MainWindow", "Spectrogram Properties", None)) self.specFFTLabel.setText(_translate("MainWindow", "FFT Size", None)) - self.tabGroup.setTabText(self.tabGroup.indexOf(self.specTab), _translate("MainWindow", "Spectrogram", None)) + self.tabGroup.setTabText(self.tabGroup.indexOf( + self.specTab), _translate("MainWindow", "Spectrogram", None)) self.menu_File.setTitle(_translate("MainWindow", "&File", None)) self.action_open.setText(_translate("MainWindow", "&Open", None)) self.action_open.setShortcut(_translate("MainWindow", "Ctrl+O", None)) self.action_exit.setText(_translate("MainWindow", "E&xit", None)) self.action_reload.setText(_translate("MainWindow", "&Reload", None)) - -from PyQt5 import Qwt |