summaryrefslogtreecommitdiff
path: root/gr-filter/python
diff options
context:
space:
mode:
authorTom Rondeau <trondeau@vt.edu>2012-12-27 10:09:02 -0500
committerTom Rondeau <trondeau@vt.edu>2012-12-27 10:09:02 -0500
commit6a8fc327dc2cbd1fa63b9acd08fa90baea0758e8 (patch)
tree597c7c6fd7b4623601c6d8e9935a7100a1a79a0e /gr-filter/python
parent3332574d8e9e3432e46efb6765daf5c68fa12001 (diff)
filter: handle a log10(0) warning that causes QT to crash when designing filters.
Diffstat (limited to 'gr-filter/python')
-rw-r--r--gr-filter/python/design/filter_design.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/gr-filter/python/design/filter_design.py b/gr-filter/python/design/filter_design.py
index 556ac8edf7..748a435c63 100644
--- a/gr-filter/python/design/filter_design.py
+++ b/gr-filter/python/design/filter_design.py
@@ -1077,7 +1077,13 @@ class gr_plot_filter(QtGui.QMainWindow):
Ts = 1.0/fs
fftpts = fftpack.fft(taps, Npts)
self.freq = scipy.arange(0, fs, 1.0/(Npts*Ts))
- self.fftdB = 20.0*scipy.log10(abs(fftpts))
+ with warnings.catch_warnings(record=True) as w:
+ warnings.simplefilter("always")
+ self.fftdB = 20.0*scipy.log10(abs(fftpts))
+ if any(self.fftdB == float('-inf')):
+ sys.stderr.write('Filter design failed (taking log10 of 0).\n')
+ self.fftdB = scipy.zeros([len(fftpts)])
+
self.fftDeg = scipy.unwrap(scipy.angle(fftpts))
self.groupDelay = -scipy.diff(self.fftDeg)
self.phaseDelay = -self.fftDeg[1:]/self.freq[1:]