8
8
9
9
import scipy
10
10
from gnuradio import filter , fft
11
- from PyQt5 import QtGui
11
+ from PyQt5 import QtGui , QtWidgets
12
12
13
13
14
14
# Filter design functions using a window
@@ -28,8 +28,8 @@ def design_win_lpf(fs, gain, wintype, mainwin):
28
28
taps = filter .firdes .low_pass_2 (gain , fs , pb , tb ,
29
29
atten , wintype )
30
30
except (RuntimeError , IndexError ) as e :
31
- reply = QtGui .QMessageBox .information (mainwin , "Runtime Error" ,
32
- e .args [0 ], QtGui .QMessageBox .Ok )
31
+ reply = QtWidgets .QMessageBox .information (mainwin , "Runtime Error" ,
32
+ e .args [0 ], QtWidgets .QMessageBox .Ok )
33
33
return ([], [], ret )
34
34
else :
35
35
params = {"fs" : fs , "gain" : gain , "wintype" : wintype ,
@@ -56,8 +56,8 @@ def design_win_bpf(fs, gain, wintype, mainwin):
56
56
taps = filter .firdes .band_pass_2 (gain , fs , pb1 , pb2 , tb ,
57
57
atten , wintype )
58
58
except RuntimeError as e :
59
- reply = QtGui .QMessageBox .information (mainwin , "Runtime Error" ,
60
- e .args [0 ], QtGui .QMessageBox .Ok )
59
+ reply = QtWidgets .QMessageBox .information (mainwin , "Runtime Error" ,
60
+ e .args [0 ], QtWidgets .QMessageBox .Ok )
61
61
return ([], [], ret )
62
62
else :
63
63
params = {"fs" : fs , "gain" : gain , "wintype" : wintype ,
@@ -84,8 +84,8 @@ def design_win_cbpf(fs, gain, wintype, mainwin):
84
84
taps = filter .firdes .complex_band_pass_2 (gain , fs , pb1 , pb2 , tb ,
85
85
atten , wintype )
86
86
except RuntimeError as e :
87
- reply = QtGui .QMessageBox .information (mainwin , "Runtime Error" ,
88
- e .args [0 ], QtGui .QMessageBox .Ok )
87
+ reply = QtWidgets .QMessageBox .information (mainwin , "Runtime Error" ,
88
+ e .args [0 ], QtWidgets .QMessageBox .Ok )
89
89
return ([], [], ret )
90
90
else :
91
91
params = {"fs" : fs , "gain" : gain , "wintype" : wintype ,
@@ -112,8 +112,8 @@ def design_win_bnf(fs, gain, wintype, mainwin):
112
112
taps = filter .firdes .band_reject_2 (gain , fs , pb1 , pb2 , tb ,
113
113
atten , wintype )
114
114
except RuntimeError as e :
115
- reply = QtGui .QMessageBox .information (mainwin , "Runtime Error" ,
116
- e .args [0 ], QtGui .QMessageBox .Ok )
115
+ reply = QtWidgets .QMessageBox .information (mainwin , "Runtime Error" ,
116
+ e .args [0 ], QtWidgets .QMessageBox .Ok )
117
117
return ([], [], ret )
118
118
else :
119
119
params = {"fs" : fs , "gain" : gain , "wintype" : wintype ,
@@ -139,8 +139,8 @@ def design_win_hpf(fs, gain, wintype, mainwin):
139
139
taps = filter .firdes .high_pass_2 (gain , fs , pb , tb ,
140
140
atten , wintype )
141
141
except RuntimeError as e :
142
- reply = QtGui .QMessageBox .information (mainwin , "Runtime Error" ,
143
- e .args [0 ], QtGui .QMessageBox .Ok )
142
+ reply = QtWidgets .QMessageBox .information (mainwin , "Runtime Error" ,
143
+ e .args [0 ], QtWidgets .QMessageBox .Ok )
144
144
else :
145
145
params = {"fs" : fs , "gain" : gain , "wintype" : wintype ,
146
146
"filttype" : "hpf" , "sbend" : sb , "pbstart" : pb ,
@@ -164,8 +164,8 @@ def design_win_hb(fs, gain, wintype, mainwin):
164
164
fft .window .WIN_BLACKMAN_hARRIS : 'blackmanharris' }
165
165
166
166
if int (filtord ) & 1 :
167
- reply = QtGui .QMessageBox .information (mainwin , "Filter order should be even" ,
168
- "Filter order should be even" , QtGui .QMessageBox .Ok )
167
+ reply = QtWidgets .QMessageBox .information (mainwin , "Filter order should be even" ,
168
+ "Filter order should be even" , QtWidgets .QMessageBox .Ok )
169
169
return ([], [], False )
170
170
171
171
if (ret ):
@@ -193,8 +193,8 @@ def design_win_rrc(fs, gain, wintype, mainwin):
193
193
taps = filter .firdes .root_raised_cosine (gain , fs , sr ,
194
194
alpha , ntaps )
195
195
except RuntimeError as e :
196
- reply = QtGui .QMessageBox .information (mainwin , "Runtime Error" ,
197
- e .args [0 ], QtGui .QMessageBox .Ok )
196
+ reply = QtWidgets .QMessageBox .information (mainwin , "Runtime Error" ,
197
+ e .args [0 ], QtWidgets .QMessageBox .Ok )
198
198
else :
199
199
params = {"fs" : fs , "gain" : gain , "wintype" : wintype ,
200
200
"filttype" : "rrc" , "srate" : sr , "alpha" : alpha ,
@@ -219,8 +219,8 @@ def design_win_gaus(fs, gain, wintype, mainwin):
219
219
taps = filter .firdes .gaussian (gain , spb , bt , ntaps )
220
220
221
221
except RuntimeError as e :
222
- reply = QtGui .QMessageBox .information (mainwin , "Runtime Error" ,
223
- e .args [0 ], QtGui .QMessageBox .Ok )
222
+ reply = QtWidgets .QMessageBox .information (mainwin , "Runtime Error" ,
223
+ e .args [0 ], QtWidgets .QMessageBox .Ok )
224
224
else :
225
225
params = {"fs" : fs , "gain" : gain , "wintype" : wintype ,
226
226
"filttype" : "gaus" , "srate" : sr , "bt" : bt ,
@@ -247,8 +247,8 @@ def design_opt_lpf(fs, gain, mainwin):
247
247
taps = filter .optfir .low_pass (gain , fs , pb , sb ,
248
248
ripple , atten )
249
249
except RuntimeError as e :
250
- reply = QtGui .QMessageBox .information (mainwin , "Filter did not converge" ,
251
- e .args [0 ], QtGui .QMessageBox .Ok )
250
+ reply = QtWidgets .QMessageBox .information (mainwin , "Filter did not converge" ,
251
+ e .args [0 ], QtWidgets .QMessageBox .Ok )
252
252
return ([], [], False )
253
253
else :
254
254
params = {"fs" : fs , "gain" : gain , "wintype" : mainwin .EQUIRIPPLE_FILT ,
@@ -279,8 +279,8 @@ def design_opt_bpf(fs, gain, mainwin):
279
279
taps = filter .optfir .band_pass (gain , fs , sb1 , pb1 , pb2 , sb2 ,
280
280
ripple , atten )
281
281
except RuntimeError as e :
282
- reply = QtGui .QMessageBox .information (mainwin , "Filter did not converge" ,
283
- e .args [0 ], QtGui .QMessageBox .Ok )
282
+ reply = QtWidgets .QMessageBox .information (mainwin , "Filter did not converge" ,
283
+ e .args [0 ], QtWidgets .QMessageBox .Ok )
284
284
return ([], [], False )
285
285
286
286
else :
@@ -313,8 +313,8 @@ def design_opt_cbpf(fs, gain, mainwin):
313
313
taps = filter .optfir .complex_band_pass (gain , fs , sb1 , pb1 , pb2 , sb2 ,
314
314
ripple , atten )
315
315
except RuntimeError as e :
316
- reply = QtGui .QMessageBox .information (mainwin , "Filter did not converge" ,
317
- e .args [0 ], QtGui .QMessageBox .Ok )
316
+ reply = QtWidgets .QMessageBox .information (mainwin , "Filter did not converge" ,
317
+ e .args [0 ], QtWidgets .QMessageBox .Ok )
318
318
return ([], [], False )
319
319
else :
320
320
params = {"fs" : fs , "gain" : gain , "wintype" : mainwin .EQUIRIPPLE_FILT ,
@@ -346,8 +346,8 @@ def design_opt_bnf(fs, gain, mainwin):
346
346
taps = filter .optfir .band_reject (gain , fs , pb1 , sb1 , sb2 , pb2 ,
347
347
ripple , atten )
348
348
except RuntimeError as e :
349
- reply = QtGui .QMessageBox .information (mainwin , "Filter did not converge" ,
350
- e .args [0 ], QtGui .QMessageBox .Ok )
349
+ reply = QtWidgets .QMessageBox .information (mainwin , "Filter did not converge" ,
350
+ e .args [0 ], QtWidgets .QMessageBox .Ok )
351
351
return ([], [], False )
352
352
else :
353
353
params = {"fs" : fs , "gain" : gain , "wintype" : mainwin .EQUIRIPPLE_FILT ,
@@ -366,8 +366,8 @@ def design_opt_hb(fs, gain, mainwin):
366
366
trwidth , r = getfloat (mainwin .gui .firhbtrEdit .text ())
367
367
ret = r and ret
368
368
if int (filtord ) & 1 :
369
- reply = QtGui .QMessageBox .information (mainwin , "Filter order should be even" ,
370
- "Filter order should be even" , QtGui .QMessageBox .Ok )
369
+ reply = QtWidgets .QMessageBox .information (mainwin , "Filter order should be even" ,
370
+ "Filter order should be even" , QtWidgets .QMessageBox .Ok )
371
371
return ([], [], False )
372
372
373
373
if (ret ):
@@ -376,8 +376,8 @@ def design_opt_hb(fs, gain, mainwin):
376
376
taps = scipy .signal .remez (int (filtord ) + 1 , bands , [1 , 0 ], [1 , 1 ])
377
377
taps [abs (taps ) <= 1e-6 ] = 0.
378
378
except RuntimeError as e :
379
- reply = QtGui .QMessageBox .information (mainwin , "Filter Design Error" ,
380
- e .args [0 ], QtGui .QMessageBox .Ok )
379
+ reply = QtWidgets .QMessageBox .information (mainwin , "Filter Design Error" ,
380
+ e .args [0 ], QtWidgets .QMessageBox .Ok )
381
381
return ([], [], False )
382
382
else :
383
383
params = {"fs" : fs , "gain" : gain , "wintype" : mainwin .EQUIRIPPLE_FILT ,
@@ -403,8 +403,8 @@ def design_opt_hpf(fs, gain, mainwin):
403
403
taps = filter .optfir .high_pass (gain , fs , sb , pb ,
404
404
atten , ripple )
405
405
except RuntimeError as e :
406
- reply = QtGui .QMessageBox .information (mainwin , "Filter did not converge" ,
407
- e .args [0 ], QtGui .QMessageBox .Ok )
406
+ reply = QtWidgets .QMessageBox .information (mainwin , "Filter did not converge" ,
407
+ e .args [0 ], QtWidgets .QMessageBox .Ok )
408
408
return ([], [], False )
409
409
else :
410
410
params = {"fs" : fs , "gain" : gain , "wintype" : mainwin .EQUIRIPPLE_FILT ,
0 commit comments