From eec6476e69760994a01fbd3344a2af2f814f7d96 Mon Sep 17 00:00:00 2001 From: Tom Date: Sun, 23 Aug 2009 19:36:24 -0400 Subject: Adding features and usability. --- gr-utils/src/python/gr_filter_design.py | 293 +++++++++++++++++++++++++------- gr-utils/src/python/pyqt_filter.py | 200 ++++++++++++++++++---- gr-utils/src/python/pyqt_filter.ui | 267 ++++++++++++++++++++++++----- 3 files changed, 624 insertions(+), 136 deletions(-) (limited to 'gr-utils') diff --git a/gr-utils/src/python/gr_filter_design.py b/gr-utils/src/python/gr_filter_design.py index a9f36ed02..28afacf08 100755 --- a/gr-utils/src/python/gr_filter_design.py +++ b/gr-utils/src/python/gr_filter_design.py @@ -11,7 +11,7 @@ import sys, os from PyQt4 import Qt, QtCore, QtGui import PyQt4.Qwt5 as Qwt from optparse import OptionParser -from gnuradio import gr, eng_notation +from gnuradio import gr, blks2, eng_notation from scipy import fftpack from pyqt_filter import Ui_MainWindow @@ -34,13 +34,22 @@ class gr_plot_filter(QtGui.QMainWindow): self.connect(self.gui.designButton, Qt.SIGNAL("released()"), self.design) - - self.fltdeslpf = Ui_firlpfForm() - self.fltdeshpf = Ui_firhpfForm() - self.fltdeslpf.setupUi(self.gui.firlpfPage) - self.fltdeshpf.setupUi(self.gui.firhpfPage) + self.connect(self.gui.tabGroup, + Qt.SIGNAL("currentChanged(int)"), + self.tab_changed) + + self.gui.designButton.setShortcut("Return") + + self.taps = [] + self.gui.lpfPassBandRippleLabel.setVisible(False) + self.gui.lpfPassBandRippleEdit.setVisible(False) + self.gui.bpfPassBandRippleLabel.setVisible(False) + self.gui.bpfPassBandRippleEdit.setVisible(False) + self.gui.hpfPassBandRippleLabel.setVisible(False) + self.gui.hpfPassBandRippleEdit.setVisible(False) + # Initialize to LPF self.gui.filterTypeWidget.setCurrentWidget(self.gui.firlpfPage) @@ -70,77 +79,243 @@ class gr_plot_filter(QtGui.QMainWindow): self.freqcurve.setPen(Qt.QPen(blueBrush, 2)) self.rcurve.setPen(Qt.QPen(blueBrush, 2)) + self.filterWindows = {"Hamming Window" : gr.firdes.WIN_HAMMING, + "Hann Window" : gr.firdes.WIN_HANN, + "Blackman Window" : gr.firdes.WIN_BLACKMAN, + "Rectangular Window" : gr.firdes.WIN_RECTANGULAR, + "Kaiser Window" : gr.firdes.WIN_KAISER, + "Blackman-harris Window" : gr.firdes.WIN_BLACKMAN_hARRIS} + self.show() def changed_filter_type(self, ftype): strftype = str(ftype.toAscii()) if(ftype == "Low Pass"): self.gui.filterTypeWidget.setCurrentWidget(self.gui.firlpfPage) + elif(ftype == "Band Pass"): + self.gui.filterTypeWidget.setCurrentWidget(self.gui.firbpfPage) elif(ftype == "High Pass"): self.gui.filterTypeWidget.setCurrentWidget(self.gui.firhpfPage) + + self.design() def changed_filter_design_type(self, design): - print design - + if(design == "Equiripple"): + self.set_equiripple() + else: + self.set_windowed() + + self.design() + + def set_equiripple(self): + self.equiripple = True + self.gui.lpfPassBandRippleLabel.setVisible(True) + self.gui.lpfPassBandRippleEdit.setVisible(True) + self.gui.bpfPassBandRippleLabel.setVisible(True) + self.gui.bpfPassBandRippleEdit.setVisible(True) + self.gui.hpfPassBandRippleLabel.setVisible(True) + self.gui.hpfPassBandRippleEdit.setVisible(True) + + def set_windowed(self): + self.equiripple = False + self.gui.lpfPassBandRippleLabel.setVisible(False) + self.gui.lpfPassBandRippleEdit.setVisible(False) + self.gui.bpfPassBandRippleLabel.setVisible(False) + self.gui.bpfPassBandRippleEdit.setVisible(False) + self.gui.hpfPassBandRippleLabel.setVisible(False) + self.gui.hpfPassBandRippleEdit.setVisible(False) + def design(self): - fs = self.gui.sampleRateEdit.text().toDouble()[0] - gain = self.gui.filterGainEdit.text().toDouble()[0] + ret = True + fs,r = self.gui.sampleRateEdit.text().toDouble() + ret = r and ret + gain,r = self.gui.filterGainEdit.text().toDouble() + ret = r and ret + + if(ret): + winstr = str(self.gui.filterDesignTypeComboBox.currentText().toAscii()) + ftype = str(self.gui.filterTypeComboBox.currentText().toAscii()) + + if(winstr == "Equiripple"): + designer = {"Low Pass" : self.design_opt_lpf, + "Band Pass" : self.design_opt_bpf, + "High Pass" : self.design_opt_hpf} + taps,r = designer[ftype](fs, gain) + + else: + designer = {"Low Pass" : self.design_win_lpf, + "Band Pass" : self.design_win_bpf, + "High Pass" : self.design_win_hpf} + wintype = self.filterWindows[winstr] + taps,r = designer[ftype](fs, gain, wintype) + + if(r): + self.update_time_curves(taps) + self.update_freq_curves(taps) - ftype = self.gui.filterTypeComboBox.currentText() - if(ftype == "Low Pass"): - taps = self.design_win_lpf(fs, gain) - elif(ftype == "High Pass"): - taps = self.design_win_hpf(fs, gain) - self.update_time_curves(taps) - self.update_freq_curves(taps) - - def design_win_lpf(self, fs, gain): - pb = self.fltdeslpf.endofPassBandEdit.text().toDouble()[0] - sb = self.fltdeslpf.startofStopBandEdit.text().toDouble()[0] - atten = self.fltdeslpf.stopBandAttenEdit.text().toDouble()[0] - tb = sb - pb - - taps = gr.firdes.low_pass_2(gain, fs, pb, tb, atten, - gr.firdes.WIN_BLACKMAN_hARRIS) - return taps + # Filter design functions using a window + def design_win_lpf(self, fs, gain, wintype): + ret = True + pb,r = self.gui.endofLpfPassBandEdit.text().toDouble() + ret = r and ret + sb,r = self.gui.startofLpfStopBandEdit.text().toDouble() + ret = r and ret + atten,r = self.gui.lpfStopBandAttenEdit.text().toDouble() + ret = r and ret + + if(ret): + tb = sb - pb + + taps = gr.firdes.low_pass_2(gain, fs, pb, tb, + atten, wintype) + return (taps, ret) + else: + return ([], ret) - def design_win_hpf(self, fs, gain): - print fs - print widget - + def design_win_bpf(self, fs, gain, wintype): + ret = True + pb1,r = self.gui.startofBpfPassBandEdit.text().toDouble() + ret = r and ret + pb2,r = self.gui.endofBpfPassBandEdit.text().toDouble() + ret = r and ret + tb,r = self.gui.bpfTransitionEdit.text().toDouble() + ret = r and ret + atten,r = self.gui.bpfStopBandAttenEdit.text().toDouble() + ret = r and ret + + if(r): + taps = gr.firdes.band_pass_2(gain, fs, pb1, pb2, tb, + atten, wintype) + return (taps,r) + else: + return ([],r) + + def design_win_hpf(self, fs, gain, wintype): + ret = True + sb,r = self.gui.endofHpfStopBandEdit.text().toDouble() + ret = r and ret + pb,r = self.gui.startofHpfPassBandEdit.text().toDouble() + ret = r and ret + atten,r = self.gui.hpfStopBandAttenEdit.text().toDouble() + ret = r and ret + + if(r): + tb = pb - sb + taps = gr.firdes.high_pass_2(gain, fs, pb, tb, + atten, wintype) + return (taps,r) + else: + return ([],r) + + + + # Design Functions for Equiripple Filters + def design_opt_lpf(self, fs, gain, wintype=None): + ret = True + pb,r = self.gui.endofLpfPassBandEdit.text().toDouble() + ret = r and ret + sb,r = self.gui.startofLpfStopBandEdit.text().toDouble() + ret = r and ret + atten,r = self.gui.lpfStopBandAttenEdit.text().toDouble() + ret = r and ret + ripple,r = self.gui.lpfPassBandRippleEdit.text().toDouble() + ret = r and ret + + if(ret): + taps = blks2.optfir.low_pass(gain, fs, pb, sb, + ripple, atten) + return (taps, ret) + else: + return ([], ret) + + def design_opt_bpf(self, fs, gain, wintype=None): + ret = True + pb1,r = self.gui.startofBpfPassBandEdit.text().toDouble() + ret = r and ret + pb2,r = self.gui.endofBpfPassBandEdit.text().toDouble() + ret = r and ret + tb,r = self.gui.bpfTransitionEdit.text().toDouble() + ret = r and ret + atten,r = self.gui.bpfStopBandAttenEdit.text().toDouble() + ret = r and ret + ripple,r = self.gui.bpfPassBandRippleEdit.text().toDouble() + ret = r and ret + + if(r): + sb1 = pb1 - tb + sb2 = pb2 + tb + taps = blks2.optfir.band_pass(gain, fs, sb1, pb1, pb2, sb2, + ripple, atten) + return (taps,r) + else: + return ([],r) + + def design_opt_hpf(self, fs, gain, wintype=None): + ret = True + sb,r = self.gui.endofHpfStopBandEdit.text().toDouble() + ret = r and ret + pb,r = self.gui.startofHpfPassBandEdit.text().toDouble() + ret = r and ret + atten,r = self.gui.hpfStopBandAttenEdit.text().toDouble() + ret = r and ret + ripple,r = self.gui.hpfPassBandRippleEdit.text().toDouble() + ret = r and ret + + if(r): + taps = blks2.optfir.high_pass(gain, fs, sb, pb, + atten, ripple) + return (taps,r) + else: + return ([],r) + + def tab_changed(self, tab): + if(tab == 0): + self.update_freq_curves(self.taps) + if(tab == 1): + self.update_time_curves(self.taps) + def update_time_curves(self, taps): + self.taps = taps ntaps = len(taps) - self.rcurve.setData(scipy.arange(ntaps), taps) - - # Reset the x-axis to the new time scale - ymax = 1.5 * max(taps) - ymin = 1.5 * min(taps) - self.gui.timePlot.setAxisScale(self.gui.timePlot.xBottom, - 0, ntaps) - self.gui.timePlot.setAxisScale(self.gui.timePlot.yLeft, - ymin, ymax) - - # Set the zoomer base to unzoom to the new axis - self.timeZoomer.setZoomBase() - - self.gui.timePlot.replot() + if(ntaps > 0): + self.rcurve.setData(scipy.arange(ntaps), taps) + + # Reset the x-axis to the new time scale + ymax = 1.5 * max(taps) + ymin = 1.5 * min(taps) + self.gui.timePlot.setAxisScale(self.gui.timePlot.xBottom, + 0, ntaps) + self.gui.timePlot.setAxisScale(self.gui.timePlot.yLeft, + ymin, ymax) + + # Set the zoomer base to unzoom to the new axis + rect = Qt.QRectF(0, ymin, (ntaps-0), (ymax-ymin)) + self.timeZoomer.setZoomBase(rect) + + self.gui.timePlot.replot() def update_freq_curves(self, taps, Npts=1000): - fftpts = fftpack.fft(taps, Npts) - freq = scipy.arange(0, Npts) - - fftdB = 20.0*scipy.log10(abs(fftpts)) - - self.freqcurve.setData(freq, fftdB) - - self.gui.freqPlot.setAxisScale(self.gui.freqPlot.xBottom, - 0, Npts/2) - - # Set the zoomer base to unzoom to the new axis - self.freqZoomer.setZoomBase() - - self.gui.freqPlot.replot() + if(len(taps) > 0): + fftpts = fftpack.fft(taps, Npts) + freq = scipy.arange(0, Npts) + + fftdB = 20.0*scipy.log10(abs(fftpts)) + + self.freqcurve.setData(freq, fftdB) + + # Reset the x-axis to the new time scale + ymax = 1.5 * max(fftdB) + ymin = 1.5 * min(fftdB) + self.gui.freqPlot.setAxisScale(self.gui.freqPlot.xBottom, + 0, Npts/2) + self.gui.timePlot.setAxisScale(self.gui.timePlot.yLeft, + ymin, ymax) + + # Set the zoomer base to unzoom to the new axis + self.freqZoomer.setZoomBase() + + self.gui.freqPlot.replot() def setup_options(): diff --git a/gr-utils/src/python/pyqt_filter.py b/gr-utils/src/python/pyqt_filter.py index a02a8e7f9..c848dbd1b 100644 --- a/gr-utils/src/python/pyqt_filter.py +++ b/gr-utils/src/python/pyqt_filter.py @@ -2,7 +2,7 @@ # Form implementation generated from reading ui file 'pyqt_filter.ui' # -# Created: Tue Aug 18 22:48:21 2009 +# Created: Sun Aug 23 18:03:28 2009 # by: PyQt4 UI code generator 4.4.4 # # WARNING! All changes made in this file will be lost! @@ -12,31 +12,11 @@ from PyQt4 import QtCore, QtGui class Ui_MainWindow(object): def setupUi(self, MainWindow): MainWindow.setObjectName("MainWindow") - MainWindow.resize(624, 696) + MainWindow.resize(1124, 696) self.centralwidget = QtGui.QWidget(MainWindow) self.centralwidget.setObjectName("centralwidget") self.gridLayout = QtGui.QGridLayout(self.centralwidget) self.gridLayout.setObjectName("gridLayout") - self.tabGroup = QtGui.QTabWidget(self.centralwidget) - self.tabGroup.setMinimumSize(QtCore.QSize(800, 0)) - self.tabGroup.setObjectName("tabGroup") - self.freqTab = QtGui.QWidget() - self.freqTab.setObjectName("freqTab") - self.horizontalLayout_2 = QtGui.QHBoxLayout(self.freqTab) - self.horizontalLayout_2.setObjectName("horizontalLayout_2") - self.freqPlot = Qwt5.QwtPlot(self.freqTab) - self.freqPlot.setObjectName("freqPlot") - self.horizontalLayout_2.addWidget(self.freqPlot) - self.tabGroup.addTab(self.freqTab, "") - self.timeTab = QtGui.QWidget() - self.timeTab.setObjectName("timeTab") - self.horizontalLayout = QtGui.QHBoxLayout(self.timeTab) - self.horizontalLayout.setObjectName("horizontalLayout") - self.timePlot = Qwt5.QwtPlot(self.timeTab) - self.timePlot.setObjectName("timePlot") - self.horizontalLayout.addWidget(self.timePlot) - self.tabGroup.addTab(self.timeTab, "") - self.gridLayout.addWidget(self.tabGroup, 1, 1, 1, 1) self.filterFrame = QtGui.QFrame(self.centralwidget) self.filterFrame.setMinimumSize(QtCore.QSize(300, 0)) self.filterFrame.setMaximumSize(QtCore.QSize(300, 16777215)) @@ -59,43 +39,157 @@ class Ui_MainWindow(object): self.filterDesignTypeComboBox.setObjectName("filterDesignTypeComboBox") self.filterDesignTypeComboBox.addItem(QtCore.QString()) self.filterDesignTypeComboBox.addItem(QtCore.QString()) + self.filterDesignTypeComboBox.addItem(QtCore.QString()) + self.filterDesignTypeComboBox.addItem(QtCore.QString()) + self.filterDesignTypeComboBox.addItem(QtCore.QString()) + self.filterDesignTypeComboBox.addItem(QtCore.QString()) + self.filterDesignTypeComboBox.addItem(QtCore.QString()) self.verticalLayout.addWidget(self.filterDesignTypeComboBox) - self.formLayout_2 = QtGui.QFormLayout() - self.formLayout_2.setFieldGrowthPolicy(QtGui.QFormLayout.AllNonFixedFieldsGrow) - self.formLayout_2.setObjectName("formLayout_2") + self.globalParamsLayout = QtGui.QFormLayout() + 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.formLayout_2.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.formLayout_2.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.formLayout_2.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.formLayout_2.setWidget(1, QtGui.QFormLayout.FieldRole, self.filterGainEdit) - self.verticalLayout.addLayout(self.formLayout_2) + self.globalParamsLayout.setWidget(1, QtGui.QFormLayout.FieldRole, self.filterGainEdit) + self.verticalLayout.addLayout(self.globalParamsLayout) self.filterTypeWidget = QtGui.QStackedWidget(self.filterFrame) self.filterTypeWidget.setObjectName("filterTypeWidget") self.firlpfPage = QtGui.QWidget() self.firlpfPage.setObjectName("firlpfPage") + self.formLayout = QtGui.QFormLayout(self.firlpfPage) + self.formLayout.setObjectName("formLayout") + self.endofLpfPassBandLabel = QtGui.QLabel(self.firlpfPage) + self.endofLpfPassBandLabel.setObjectName("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.startofLpfStopBandLabel = QtGui.QLabel(self.firlpfPage) + self.startofLpfStopBandLabel.setObjectName("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.lpfStopBandAttenLabel = QtGui.QLabel(self.firlpfPage) + self.lpfStopBandAttenLabel.setObjectName("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.lpfPassBandRippleEdit = QtGui.QLineEdit(self.firlpfPage) + self.lpfPassBandRippleEdit.setObjectName("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.filterTypeWidget.addWidget(self.firlpfPage) + self.firbpfPage = QtGui.QWidget() + self.firbpfPage.setObjectName("firbpfPage") + self.formLayout_2 = QtGui.QFormLayout(self.firbpfPage) + 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.startofBpfPassBandEdit = QtGui.QLineEdit(self.firbpfPage) + self.startofBpfPassBandEdit.setObjectName("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.endofBpfPassBandEdit = QtGui.QLineEdit(self.firbpfPage) + self.endofBpfPassBandEdit.setObjectName("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.bpfStopBandAttenLabel = QtGui.QLabel(self.firbpfPage) + self.bpfStopBandAttenLabel.setObjectName("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.bpfTransitionEdit = QtGui.QLineEdit(self.firbpfPage) + self.bpfTransitionEdit.setObjectName("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.bpfPassBandRippleLabel = QtGui.QLabel(self.firbpfPage) + self.bpfPassBandRippleLabel.setObjectName("bpfPassBandRippleLabel") + self.formLayout_2.setWidget(4, QtGui.QFormLayout.LabelRole, self.bpfPassBandRippleLabel) + self.filterTypeWidget.addWidget(self.firbpfPage) self.firhpfPage = QtGui.QWidget() self.firhpfPage.setObjectName("firhpfPage") + self.formLayout_3 = QtGui.QFormLayout(self.firhpfPage) + 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.endofHpfStopBandEdit = QtGui.QLineEdit(self.firhpfPage) + self.endofHpfStopBandEdit.setObjectName("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.startofHpfPassBandEdit = QtGui.QLineEdit(self.firhpfPage) + self.startofHpfPassBandEdit.setObjectName("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.hpfStopBandAttenEdit = QtGui.QLineEdit(self.firhpfPage) + self.hpfStopBandAttenEdit.setObjectName("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.hpfPassBandRippleEdit = QtGui.QLineEdit(self.firhpfPage) + self.hpfPassBandRippleEdit.setObjectName("hpfPassBandRippleEdit") + self.formLayout_3.setWidget(3, QtGui.QFormLayout.FieldRole, self.hpfPassBandRippleEdit) self.filterTypeWidget.addWidget(self.firhpfPage) self.verticalLayout.addWidget(self.filterTypeWidget) self.designButton = QtGui.QPushButton(self.filterFrame) self.designButton.setMinimumSize(QtCore.QSize(0, 0)) self.designButton.setMaximumSize(QtCore.QSize(200, 16777215)) + self.designButton.setAutoDefault(True) + self.designButton.setDefault(True) self.designButton.setObjectName("designButton") self.verticalLayout.addWidget(self.designButton) self.gridLayout.addWidget(self.filterFrame, 1, 0, 1, 1) + self.tabGroup = QtGui.QTabWidget(self.centralwidget) + self.tabGroup.setMinimumSize(QtCore.QSize(800, 0)) + self.tabGroup.setObjectName("tabGroup") + self.freqTab = QtGui.QWidget() + self.freqTab.setObjectName("freqTab") + self.horizontalLayout_2 = QtGui.QHBoxLayout(self.freqTab) + self.horizontalLayout_2.setObjectName("horizontalLayout_2") + self.freqPlot = Qwt5.QwtPlot(self.freqTab) + self.freqPlot.setObjectName("freqPlot") + self.horizontalLayout_2.addWidget(self.freqPlot) + self.tabGroup.addTab(self.freqTab, "") + self.timeTab = QtGui.QWidget() + self.timeTab.setObjectName("timeTab") + self.horizontalLayout = QtGui.QHBoxLayout(self.timeTab) + self.horizontalLayout.setObjectName("horizontalLayout") + self.timePlot = Qwt5.QwtPlot(self.timeTab) + self.timePlot.setObjectName("timePlot") + self.horizontalLayout.addWidget(self.timePlot) + self.tabGroup.addTab(self.timeTab, "") + self.gridLayout.addWidget(self.tabGroup, 1, 1, 1, 1) MainWindow.setCentralWidget(self.centralwidget) self.menubar = QtGui.QMenuBar(MainWindow) - self.menubar.setGeometry(QtCore.QRect(0, 0, 624, 25)) + self.menubar.setGeometry(QtCore.QRect(0, 0, 1124, 25)) self.menubar.setObjectName("menubar") self.menu_File = QtGui.QMenu(self.menubar) self.menu_File.setObjectName("menu_File") @@ -111,19 +205,31 @@ class Ui_MainWindow(object): self.menubar.addAction(self.menu_File.menuAction()) self.retranslateUi(MainWindow) + self.filterTypeWidget.setCurrentIndex(2) self.tabGroup.setCurrentIndex(0) 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.sampleRateEdit, self.filterGainEdit) - MainWindow.setTabOrder(self.filterGainEdit, self.designButton) + 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.endofHpfStopBandEdit) + MainWindow.setTabOrder(self.endofHpfStopBandEdit, self.startofHpfPassBandEdit) + MainWindow.setTabOrder(self.startofHpfPassBandEdit, self.hpfStopBandAttenEdit) + MainWindow.setTabOrder(self.hpfStopBandAttenEdit, self.hpfPassBandRippleEdit) + MainWindow.setTabOrder(self.hpfPassBandRippleEdit, self.designButton) MainWindow.setTabOrder(self.designButton, self.tabGroup) def retranslateUi(self, MainWindow): - MainWindow.setWindowTitle(QtGui.QApplication.translate("MainWindow", "MainWindow", 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)) + 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)) @@ -131,11 +237,31 @@ class Ui_MainWindow(object): 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", "Windowed", None, QtGui.QApplication.UnicodeUTF8)) - self.filterDesignTypeComboBox.setItemText(1, QtGui.QApplication.translate("MainWindow", "Equiripple", 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.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.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.menu_File.setTitle(QtGui.QApplication.translate("MainWindow", "&File", None, QtGui.QApplication.UnicodeUTF8)) self.action_open.setText(QtGui.QApplication.translate("MainWindow", "&Open", None, QtGui.QApplication.UnicodeUTF8)) self.action_open.setShortcut(QtGui.QApplication.translate("MainWindow", "Ctrl+O", None, QtGui.QApplication.UnicodeUTF8)) diff --git a/gr-utils/src/python/pyqt_filter.ui b/gr-utils/src/python/pyqt_filter.ui index ed3b1860b..69d570775 100644 --- a/gr-utils/src/python/pyqt_filter.ui +++ b/gr-utils/src/python/pyqt_filter.ui @@ -6,48 +6,15 @@ 0 0 - 624 + 1124 696 - MainWindow + GNU Radio Filter Design Tool - - - - - 800 - 0 - - - - 0 - - - - Frequency Domain - - - - - - - - - - Time Domain - - - - - - - - - @@ -112,7 +79,32 @@ - Windowed + Hamming Window + + + + + Hann Window + + + + + Blackman Window + + + + + Rectangular Window + + + + + Kaiser Window + + + + + Blackman-harris Window @@ -123,7 +115,7 @@ - + QFormLayout::AllNonFixedFieldsGrow @@ -164,8 +156,151 @@ - - + + 2 + + + + + + + End of Pass Band (Hz) + + + + + + + + + + Start of Stop Band (Hz) + + + + + + + + + + Stop Band Attenuation (dB) + + + + + + + + + + + + + Pass Band Ripple (dB) + + + + + + + + + + + Start of Pass Band (Hz) + + + + + + + + + + End of Pass Band (Hz) + + + + + + + + + + + + + Stop Band Attenuation (dB) + + + + + + + Transition Width (Hz) + + + + + + + + + + + + + Pass Band Ripple (dB) + + + + + + + + + + + End of Stop Band (Hz) + + + + + + + + + + Start of Pass Band (Hz) + + + + + + + + + + Stop Band Attenuation (dB) + + + + + + + + + + Pass Band Ripple (dB) + + + + + + + + @@ -185,11 +320,50 @@ Design + + true + + + true + + + + + + 800 + 0 + + + + 0 + + + + Frequency Domain + + + + + + + + + + Time Domain + + + + + + + + + @@ -197,7 +371,7 @@ 0 0 - 624 + 1124 25 @@ -236,6 +410,19 @@ filterDesignTypeComboBox sampleRateEdit filterGainEdit + endofLpfPassBandEdit + startofLpfStopBandEdit + lpfStopBandAttenEdit + lpfPassBandRippleEdit + startofBpfPassBandEdit + endofBpfPassBandEdit + bpfTransitionEdit + bpfStopBandAttenEdit + bpfPassBandRippleEdit + endofHpfStopBandEdit + startofHpfPassBandEdit + hpfStopBandAttenEdit + hpfPassBandRippleEdit designButton tabGroup -- cgit