diff options
-rwxr-xr-x | gr-utils/src/python/gr_filter_design.py | 21 | ||||
-rw-r--r-- | gr-utils/src/python/pyqt_filter.py | 35 | ||||
-rw-r--r-- | gr-utils/src/python/pyqt_filter.ui | 44 |
3 files changed, 99 insertions, 1 deletions
diff --git a/gr-utils/src/python/gr_filter_design.py b/gr-utils/src/python/gr_filter_design.py index c69fa26c7..9ef12294d 100755 --- a/gr-utils/src/python/gr_filter_design.py +++ b/gr-utils/src/python/gr_filter_design.py @@ -145,6 +145,8 @@ class gr_plot_filter(QtGui.QMainWindow): self.gui.filterTypeWidget.setCurrentWidget(self.gui.firbpfPage) elif(ftype == "Complex Band Pass"): self.gui.filterTypeWidget.setCurrentWidget(self.gui.firbpfPage) + elif(ftype == "Band Notch"): + self.gui.filterTypeWidget.setCurrentWidget(self.gui.firbnfPage) elif(ftype == "High Pass"): self.gui.filterTypeWidget.setCurrentWidget(self.gui.firhpfPage) @@ -197,6 +199,7 @@ class gr_plot_filter(QtGui.QMainWindow): designer = {"Low Pass" : self.design_win_lpf, "Band Pass" : self.design_win_bpf, "Complex Band Pass" : self.design_win_cbpf, + "Band Notch" : self.design_win_bnf, "High Pass" : self.design_win_hpf} wintype = self.filterWindows[winstr] taps,r = designer[ftype](fs, gain, wintype) @@ -264,6 +267,24 @@ class gr_plot_filter(QtGui.QMainWindow): else: return ([],r) + def design_win_bnf(self, fs, gain, wintype): + ret = True + pb1,r = self.gui.startofBnfStopBandEdit.text().toDouble() + ret = r and ret + pb2,r = self.gui.endofBnfStopBandEdit.text().toDouble() + ret = r and ret + tb,r = self.gui.bnfTransitionEdit.text().toDouble() + ret = r and ret + atten,r = self.gui.bnfStopBandAttenEdit.text().toDouble() + ret = r and ret + + if(r): + taps = gr.firdes.band_reject_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() diff --git a/gr-utils/src/python/pyqt_filter.py b/gr-utils/src/python/pyqt_filter.py index 6b95e03bb..5fa0979de 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: Sun Aug 23 21:53:02 2009 +# Created: Sun Aug 23 23:26:14 2009 # by: PyQt4 UI code generator 4.4.4 # # WARNING! All changes made in this file will be lost! @@ -129,6 +129,35 @@ class Ui_MainWindow(object): self.bpfPassBandRippleLabel.setObjectName("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.setObjectName("formLayout_5") + self.startofBnfStopBandLabel = QtGui.QLabel(self.firbnfPage) + self.startofBnfStopBandLabel.setObjectName("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.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.bnfTransitionLabel = QtGui.QLabel(self.firbnfPage) + self.bnfTransitionLabel.setObjectName("bnfTransitionLabel") + self.formLayout_5.setWidget(2, QtGui.QFormLayout.LabelRole, self.bnfTransitionLabel) + self.bnfStopBandAttenLabel = QtGui.QLabel(self.firbnfPage) + self.bnfStopBandAttenLabel.setObjectName("bnfStopBandAttenLabel") + self.formLayout_5.setWidget(3, QtGui.QFormLayout.LabelRole, self.bnfStopBandAttenLabel) + self.filterTypeWidget.addWidget(self.firbnfPage) self.firhpfPage = QtGui.QWidget() self.firhpfPage.setObjectName("firhpfPage") self.formLayout_3 = QtGui.QFormLayout(self.firhpfPage) @@ -283,6 +312,10 @@ class Ui_MainWindow(object): 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.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)) diff --git a/gr-utils/src/python/pyqt_filter.ui b/gr-utils/src/python/pyqt_filter.ui index 773b4cca9..4e6c958a5 100644 --- a/gr-utils/src/python/pyqt_filter.ui +++ b/gr-utils/src/python/pyqt_filter.ui @@ -257,6 +257,50 @@ </item> </layout> </widget> + <widget class="QWidget" name="firbnfPage"> + <layout class="QFormLayout" name="formLayout_5"> + <item row="0" column="0"> + <widget class="QLabel" name="startofBnfStopBandLabel"> + <property name="text"> + <string>Start of Stop Band (Hz)</string> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QLineEdit" name="startofBnfStopBandEdit"/> + </item> + <item row="1" column="1"> + <widget class="QLineEdit" name="endofBnfStopBandEdit"/> + </item> + <item row="2" column="1"> + <widget class="QLineEdit" name="bnfTransitionEdit"/> + </item> + <item row="3" column="1"> + <widget class="QLineEdit" name="bnfStopBandAttenEdit"/> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="endofBnfStopBandLabel"> + <property name="text"> + <string>End of Stop Band (Hz)</string> + </property> + </widget> + </item> + <item row="2" column="0"> + <widget class="QLabel" name="bnfTransitionLabel"> + <property name="text"> + <string>Transition Width (Hz)</string> + </property> + </widget> + </item> + <item row="3" column="0"> + <widget class="QLabel" name="bnfStopBandAttenLabel"> + <property name="text"> + <string>Stop Band Attenuation (dB)</string> + </property> + </widget> + </item> + </layout> + </widget> <widget class="QWidget" name="firhpfPage"> <layout class="QFormLayout" name="formLayout_3"> <property name="fieldGrowthPolicy"> |