-
Notifications
You must be signed in to change notification settings - Fork 2
/
FIR_B_PS.py
169 lines (162 loc) · 7.86 KB
/
FIR_B_PS.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_FIR_Design(object):
def setupUi(self, FIR_Design):
FIR_Design.setObjectName("FIR_Design")
FIR_Design.resize(511, 255)
self.gridLayout = QtWidgets.QGridLayout(FIR_Design)
self.gridLayout.setObjectName("gridLayout")
self.horizontalLayout_4 = QtWidgets.QHBoxLayout()
self.horizontalLayout_4.setObjectName("horizontalLayout_4")
self.label = QtWidgets.QLabel(FIR_Design)
font = QtGui.QFont()
font.setFamily("Century Gothic")
font.setPointSize(12)
font.setBold(False)
font.setWeight(50)
self.label.setFont(font)
self.label.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
self.label.setObjectName("label")
self.horizontalLayout_4.addWidget(self.label)
self.numtaps = QtWidgets.QSpinBox(FIR_Design)
font = QtGui.QFont()
font.setFamily("Century Gothic")
font.setPointSize(11)
self.numtaps.setFont(font)
self.numtaps.setMinimum(1)
self.numtaps.setMaximum(100001)
self.numtaps.setSingleStep(2)
self.numtaps.setObjectName("numtaps")
self.horizontalLayout_4.addWidget(self.numtaps)
self.gridLayout.addLayout(self.horizontalLayout_4, 0, 0, 1, 1)
self.horizontalLayout_3 = QtWidgets.QHBoxLayout()
self.horizontalLayout_3.setObjectName("horizontalLayout_3")
self.label_3 = QtWidgets.QLabel(FIR_Design)
font = QtGui.QFont()
font.setFamily("Century Gothic")
font.setPointSize(12)
font.setBold(False)
font.setWeight(50)
self.label_3.setFont(font)
self.label_3.setLayoutDirection(QtCore.Qt.RightToLeft)
self.label_3.setObjectName("label_3")
self.horizontalLayout_3.addWidget(self.label_3)
self.verticalLayout = QtWidgets.QVBoxLayout()
self.verticalLayout.setObjectName("verticalLayout")
self.horizontalLayout_2 = QtWidgets.QHBoxLayout()
self.horizontalLayout_2.setObjectName("horizontalLayout_2")
self.label_5 = QtWidgets.QLabel(FIR_Design)
font = QtGui.QFont()
font.setFamily("Century Gothic")
font.setPointSize(12)
self.label_5.setFont(font)
self.label_5.setObjectName("label_5")
self.horizontalLayout_2.addWidget(self.label_5)
self.frequency_ = QtWidgets.QDoubleSpinBox(FIR_Design)
font = QtGui.QFont()
font.setFamily("Century Gothic")
font.setPointSize(11)
self.frequency_.setFont(font)
self.frequency_.setDecimals(6)
self.frequency_.setMaximum(1.0)
self.frequency_.setSingleStep(0.0001)
self.frequency_.setProperty("value", 0.1)
self.frequency_.setObjectName("frequency_")
self.horizontalLayout_2.addWidget(self.frequency_)
self.verticalLayout.addLayout(self.horizontalLayout_2)
self.horizontalLayout = QtWidgets.QHBoxLayout()
self.horizontalLayout.setObjectName("horizontalLayout")
self.label_2 = QtWidgets.QLabel(FIR_Design)
font = QtGui.QFont()
font.setFamily("Century Gothic")
font.setPointSize(12)
self.label_2.setFont(font)
self.label_2.setObjectName("label_2")
self.horizontalLayout.addWidget(self.label_2)
self.frequency_1 = QtWidgets.QDoubleSpinBox(FIR_Design)
font = QtGui.QFont()
font.setFamily("Century Gothic")
font.setPointSize(11)
self.frequency_1.setFont(font)
self.frequency_1.setDecimals(6)
self.frequency_1.setMaximum(1.0)
self.frequency_1.setSingleStep(0.001)
self.frequency_1.setProperty("value", 0.1)
self.frequency_1.setObjectName("frequency_1")
self.horizontalLayout.addWidget(self.frequency_1)
self.verticalLayout.addLayout(self.horizontalLayout)
self.horizontalLayout_3.addLayout(self.verticalLayout)
self.gridLayout.addLayout(self.horizontalLayout_3, 1, 0, 1, 1)
self.horizontalLayout_5 = QtWidgets.QHBoxLayout()
self.horizontalLayout_5.setObjectName("horizontalLayout_5")
self.label_4 = QtWidgets.QLabel(FIR_Design)
font = QtGui.QFont()
font.setFamily("Century Gothic")
font.setPointSize(12)
font.setBold(False)
font.setWeight(50)
self.label_4.setFont(font)
self.label_4.setLayoutDirection(QtCore.Qt.RightToLeft)
self.label_4.setObjectName("label_4")
self.horizontalLayout_5.addWidget(self.label_4)
self.comboBox = QtWidgets.QComboBox(FIR_Design)
font = QtGui.QFont()
font.setFamily("Century Gothic")
font.setPointSize(10)
self.comboBox.setFont(font)
self.comboBox.setObjectName("comboBox")
self.comboBox.addItem("")
self.comboBox.addItem("")
self.comboBox.addItem("")
self.comboBox.addItem("")
self.comboBox.addItem("")
self.comboBox.addItem("")
self.comboBox.addItem("")
self.comboBox.addItem("")
self.comboBox.addItem("")
self.comboBox.addItem("")
self.comboBox.addItem("")
self.comboBox.addItem("")
self.horizontalLayout_5.addWidget(self.comboBox)
self.gridLayout.addLayout(self.horizontalLayout_5, 2, 0, 1, 1)
self.buttonBox = QtWidgets.QDialogButtonBox(FIR_Design)
font = QtGui.QFont()
font.setFamily("Century Gothic")
font.setPointSize(10)
self.buttonBox.setFont(font)
self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok)
self.buttonBox.setObjectName("buttonBox")
self.gridLayout.addWidget(self.buttonBox, 3, 0, 1, 1)
self.retranslateUi(FIR_Design)
self.buttonBox.accepted.connect(self.onOk)# Added
self.buttonBox.rejected.connect(FIR_Design.reject)
QtCore.QMetaObject.connectSlotsByName(FIR_Design)
self.buttonBox.accepted.connect(FIR_Design.accept) # Displaced
def retranslateUi(self, FIR_Design):
_translate = QtCore.QCoreApplication.translate
FIR_Design.setWindowTitle(_translate("FIR_Design", "Design FIR Filter "))
self.label.setText(_translate("FIR_Design", " No. of taps : "))
self.label_3.setText(_translate("FIR_Design", " Cutoff Frequencies (0-1)"))
self.label_5.setText(_translate("FIR_Design", " f1"))
self.label_2.setText(_translate("FIR_Design", " f2"))
self.label_4.setText(_translate("FIR_Design", " Window : "))
self.comboBox.setItemText(0, _translate("FIR_Design", "boxcar"))
self.comboBox.setItemText(1, _translate("FIR_Design", "triang"))
self.comboBox.setItemText(2, _translate("FIR_Design", "blackman"))
self.comboBox.setItemText(3, _translate("FIR_Design", "hamming"))
self.comboBox.setItemText(4, _translate("FIR_Design", "hann"))
self.comboBox.setItemText(5, _translate("FIR_Design", "bartlett"))
self.comboBox.setItemText(6, _translate("FIR_Design", "flattop"))
self.comboBox.setItemText(7, _translate("FIR_Design", "parzen"))
self.comboBox.setItemText(8, _translate("FIR_Design", "bohman"))
self.comboBox.setItemText(9, _translate("FIR_Design", "blackmanharris"))
self.comboBox.setItemText(10, _translate("FIR_Design", "nuttall"))
self.comboBox.setItemText(11, _translate("FIR_Design", "barthann"))
############ Added
def onOk(self):
ntaps = str(self.numtaps.text())
freq1 = str(self.frequency_.text())
freq2 = str(self.frequency_1.text())
win = str(self.comboBox.currentText())
return int(ntaps), float(freq1),float(freq2), win
############