check for samples before autoscale, avoids potential error condition
authorjblum <jblum@221aa14e-8319-0410-a670-987f0aec2ac5>
Fri, 10 Oct 2008 21:13:33 +0000 (21:13 +0000)
committerjblum <jblum@221aa14e-8319-0410-a670-987f0aec2ac5>
Fri, 10 Oct 2008 21:13:33 +0000 (21:13 +0000)
git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@9767 221aa14e-8319-0410-a670-987f0aec2ac5

gr-wxgui/src/python/fft_window.py
gr-wxgui/src/python/waterfall_window.py

index e7affb1b006fb302f6dac71d39ddc3a29f1a6cf3..6e54aec872dd072a6a202cdf6541a058abe8b1ec 100644 (file)
@@ -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)
index 702f97099ce621ae3da24494ce8553ed8f228772..f24b142a7d25a33c5f648f071b99543c7ee7210b 100644 (file)
@@ -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)