From: jblum Date: Fri, 10 Oct 2008 21:13:33 +0000 (+0000) Subject: check for samples before autoscale, avoids potential error condition X-Git-Url: https://git.gag.com/?a=commitdiff_plain;h=3fc664ececbafa04ab5a117b418cb7b4fc0652c6;p=debian%2Fgnuradio check for samples before autoscale, avoids potential error condition git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@9767 221aa14e-8319-0410-a670-987f0aec2ac5 --- diff --git a/gr-wxgui/src/python/fft_window.py b/gr-wxgui/src/python/fft_window.py index e7affb1b..6e54aec8 100644 --- a/gr-wxgui/src/python/fft_window.py +++ b/gr-wxgui/src/python/fft_window.py @@ -149,6 +149,7 @@ class fft_window(wx.Panel, pubsub.pubsub, common.prop_setter): #ensure y_per_div if y_per_div not in DIV_LEVELS: y_per_div = DIV_LEVELS[0] #setup + self.samples = list() self.ext_controller = controller self.real = real self.fft_size = fft_size @@ -197,6 +198,7 @@ class fft_window(wx.Panel, pubsub.pubsub, common.prop_setter): Autoscale the fft plot to the last frame. Set the dynamic range and reference level. """ + if not len(self.samples): return #get the peak level (max of the samples) peak_level = numpy.max(self.samples) #get the noise floor (averge the smallest samples) diff --git a/gr-wxgui/src/python/waterfall_window.py b/gr-wxgui/src/python/waterfall_window.py index 702f9709..f24b142a 100644 --- a/gr-wxgui/src/python/waterfall_window.py +++ b/gr-wxgui/src/python/waterfall_window.py @@ -168,6 +168,7 @@ class waterfall_window(wx.Panel, pubsub.pubsub, common.prop_setter): ): pubsub.pubsub.__init__(self) #setup + self.samples = list() self.ext_controller = controller self.real = real self.fft_size = fft_size @@ -220,6 +221,7 @@ class waterfall_window(wx.Panel, pubsub.pubsub, common.prop_setter): Set the dynamic range and reference level. Does not affect the current data in the waterfall. """ + if not len(self.samples): return #get the peak level (max of the samples) peak_level = numpy.max(self.samples) #get the noise floor (averge the smallest samples)