From f513de947ec9d15eb332abcba8a96927ff4dcc63 Mon Sep 17 00:00:00 2001 From: Tom Date: Mon, 24 Aug 2009 23:02:52 -0400 Subject: [PATCH] Adding display for the number of taps in the filter. --- gr-utils/src/python/gr_filter_design.py | 8 +- gr-utils/src/python/pyqt_filter.py | 50 ++- gr-utils/src/python/pyqt_filter.ui | 514 +++++++++++++----------- 3 files changed, 325 insertions(+), 247 deletions(-) diff --git a/gr-utils/src/python/gr_filter_design.py b/gr-utils/src/python/gr_filter_design.py index 238fd63f..2e490253 100755 --- a/gr-utils/src/python/gr_filter_design.py +++ b/gr-utils/src/python/gr_filter_design.py @@ -128,6 +128,9 @@ class gr_plot_filter(QtGui.QMainWindow): self.phasecurve.setPen(Qt.QPen(blueBrush, 2)) self.groupcurve.setPen(Qt.QPen(blueBrush, 2)) + + self.gui.nTapsEdit.setText("0") + self.filterWindows = {"Hamming Window" : gr.firdes.WIN_HAMMING, "Hann Window" : gr.firdes.WIN_HANN, "Blackman Window" : gr.firdes.WIN_BLACKMAN, @@ -217,8 +220,6 @@ class gr_plot_filter(QtGui.QMainWindow): taps,r = designer[ftype](fs, gain, wintype) if(r): - print "Number of taps: ", len(taps) - self.taps = scipy.array(taps) self.get_fft(fs, self.taps, self.nfftpts) self.update_time_curves() @@ -226,6 +227,9 @@ class gr_plot_filter(QtGui.QMainWindow): self.update_phase_curves() self.update_group_curves() + self.gui.nTapsEdit.setText(Qt.QString("%1").arg(self.taps.size)) + + # Filter design functions using a window def design_win_lpf(self, fs, gain, wintype): ret = True diff --git a/gr-utils/src/python/pyqt_filter.py b/gr-utils/src/python/pyqt_filter.py index c10429cf..18e96bc1 100644 --- a/gr-utils/src/python/pyqt_filter.py +++ b/gr-utils/src/python/pyqt_filter.py @@ -2,8 +2,8 @@ # Form implementation generated from reading ui file 'pyqt_filter.ui' # -# Created: Mon Aug 24 17:59:37 2009 -# by: PyQt4 UI code generator 4.4.3 +# Created: Mon Aug 24 23:01:33 2009 +# by: PyQt4 UI code generator 4.4.4 # # WARNING! All changes made in this file will be lost! @@ -132,6 +132,7 @@ class Ui_MainWindow(object): 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.setObjectName("formLayout_5") self.startofBnfStopBandLabel = QtGui.QLabel(self.firbnfPage) self.startofBnfStopBandLabel.setObjectName("startofBnfStopBandLabel") @@ -139,30 +140,30 @@ class Ui_MainWindow(object): self.startofBnfStopBandEdit = QtGui.QLineEdit(self.firbnfPage) self.startofBnfStopBandEdit.setObjectName("startofBnfStopBandEdit") self.formLayout_5.setWidget(0, QtGui.QFormLayout.FieldRole, self.startofBnfStopBandEdit) - self.endofBnfStopBandEdit = QtGui.QLineEdit(self.firbnfPage) - self.endofBnfStopBandEdit.setObjectName("endofBnfStopBandEdit") - self.formLayout_5.setWidget(1, QtGui.QFormLayout.FieldRole, self.endofBnfStopBandEdit) - self.bnfTransitionEdit = QtGui.QLineEdit(self.firbnfPage) - self.bnfTransitionEdit.setObjectName("bnfTransitionEdit") - self.formLayout_5.setWidget(2, QtGui.QFormLayout.FieldRole, self.bnfTransitionEdit) - self.bnfStopBandAttenEdit = QtGui.QLineEdit(self.firbnfPage) - self.bnfStopBandAttenEdit.setObjectName("bnfStopBandAttenEdit") - self.formLayout_5.setWidget(3, QtGui.QFormLayout.FieldRole, self.bnfStopBandAttenEdit) self.endofBnfStopBandLabel = QtGui.QLabel(self.firbnfPage) self.endofBnfStopBandLabel.setObjectName("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.bnfTransitionLabel = QtGui.QLabel(self.firbnfPage) self.bnfTransitionLabel.setObjectName("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.bnfStopBandAttenLabel = QtGui.QLabel(self.firbnfPage) self.bnfStopBandAttenLabel.setObjectName("bnfStopBandAttenLabel") self.formLayout_5.setWidget(3, QtGui.QFormLayout.LabelRole, self.bnfStopBandAttenLabel) - self.bnfPassBandRippleEdit = QtGui.QLineEdit(self.firbnfPage) - self.bnfPassBandRippleEdit.setObjectName("bnfPassBandRippleEdit") - self.formLayout_5.setWidget(4, QtGui.QFormLayout.FieldRole, self.bnfPassBandRippleEdit) + self.bnfStopBandAttenEdit = QtGui.QLineEdit(self.firbnfPage) + self.bnfStopBandAttenEdit.setObjectName("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.bnfPassBandRippleEdit = QtGui.QLineEdit(self.firbnfPage) + self.bnfPassBandRippleEdit.setObjectName("bnfPassBandRippleEdit") + self.formLayout_5.setWidget(4, QtGui.QFormLayout.FieldRole, self.bnfPassBandRippleEdit) self.filterTypeWidget.addWidget(self.firbnfPage) self.firhpfPage = QtGui.QWidget() self.firhpfPage.setObjectName("firhpfPage") @@ -241,6 +242,22 @@ class Ui_MainWindow(object): 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.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.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.setObjectName("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") self.formLayout_4 = QtGui.QFormLayout(self.sysParamsBox) @@ -249,6 +266,7 @@ class Ui_MainWindow(object): self.nfftEdit.setObjectName("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.verticalLayout.addWidget(self.sysParamsBox) @@ -298,7 +316,7 @@ class Ui_MainWindow(object): 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, 1124, 24)) + 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") @@ -379,6 +397,8 @@ class Ui_MainWindow(object): 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)) diff --git a/gr-utils/src/python/pyqt_filter.ui b/gr-utils/src/python/pyqt_filter.ui index d7dccfba..b1f79f0b 100644 --- a/gr-utils/src/python/pyqt_filter.ui +++ b/gr-utils/src/python/pyqt_filter.ui @@ -1,7 +1,8 @@ - + + MainWindow - - + + 0 0 @@ -9,131 +10,131 @@ 696 - + GNU Radio Filter Design Tool - - - - - + + + + + 300 0 - + 300 16777215 - + QFrame::StyledPanel - + QFrame::Raised - + - + - + Low Pass - + Band Pass - + Complex Band Pass - + Band Notch - + High Pass - + Root Raised Cosine - + Gaussian - + - + Hamming Window - + Hann Window - + Blackman Window - + Rectangular Window - + Kaiser Window - + Blackman-harris Window - + Equiripple - - + + QFormLayout::AllNonFixedFieldsGrow - - - + + + 16777215 30 - + Sample Rate (sps) - - - + + + 16777215 30 @@ -141,304 +142,357 @@ - - - + + + Filter Gain - - + + - - + + 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) - - - - - + + + + QFormLayout::AllNonFixedFieldsGrow + + + + Start of Stop Band (Hz) - - - - - - - - + + - - - - - - + + + End of Stop Band (Hz) - - - + + + + + + Transition Width (Hz) - - - + + + + + + Stop Band Attenuation (dB) - - + + - - - + + + Pass Band Ripple (dB) + + + - - - + + + QFormLayout::AllNonFixedFieldsGrow - - - + + + End of Stop Band (Hz) - - + + - - - + + + Start of Pass Band (Hz) - - + + - - - + + + Stop Band Attenuation (dB) - - + + - - - + + + Pass Band Ripple (dB) - - + + - - - - - + + + + + Symbol Rate (sps) - - - + + + Roll-off Factor - - - + + + Number of Taps - - + + - - + + - - + + - - - - - + + + + + Symbol Rate (sps) - - + + - - - + + + Roll-off Factor - - + + - - - + + + Number of Taps - - + + - - + + + Filter Properties + + + + QFormLayout::AllNonFixedFieldsGrow + + + + + + 150 + 0 + + + + Number of Taps: + + + + + + + + 100 + 16777215 + + + + QFrame::Box + + + QFrame::Raised + + + + + + + + + + + + System Parameters - - - + + + - - - + + + + + 150 + 0 + + + Num FFT points @@ -447,26 +501,26 @@ - - + + 0 0 - + 200 16777215 - + Design - + true - + true @@ -474,54 +528,54 @@ - - - + + + 800 0 - + 0 - - + + Frequency Domain - + - + - - + + Time Domain - + - + - - + + Phase - + - + - - + + Group Delay - + - + @@ -529,34 +583,34 @@ - - + + 0 0 1124 - 24 + 25 - - + + &File - + - + - - - + + + &Open - + Ctrl+O - - + + E&xit @@ -597,11 +651,11 @@ MainWindow close() - + -1 -1 - + 399 347 -- 2.30.2