commit-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Commit-gnuradio] r9086 - gnuradio/branches/features/experimental-gui


From: jblum
Subject: [Commit-gnuradio] r9086 - gnuradio/branches/features/experimental-gui
Date: Thu, 31 Jul 2008 17:34:53 -0600 (MDT)

Author: jblum
Date: 2008-07-31 17:34:52 -0600 (Thu, 31 Jul 2008)
New Revision: 9086

Modified:
   gnuradio/branches/features/experimental-gui/grc_waterfallsink_test.py
   gnuradio/branches/features/experimental-gui/waterfall_window.py
   gnuradio/branches/features/experimental-gui/waterfallsink.py
Log:
dynamic range param for waterfall

Modified: gnuradio/branches/features/experimental-gui/grc_waterfallsink_test.py
===================================================================
--- gnuradio/branches/features/experimental-gui/grc_waterfallsink_test.py       
2008-07-31 05:27:07 UTC (rev 9085)
+++ gnuradio/branches/features/experimental-gui/grc_waterfallsink_test.py       
2008-07-31 23:34:52 UTC (rev 9086)
@@ -77,8 +77,7 @@
                self.wxgui_fftsink2 = waterfallsink.waterfall_sink_c(
                        self.GetWin(),
                        baseband_freq=0,
-                       y_per_div=5,
-                       y_divs=8,
+                       dynamic_range=40,
                        ref_level=-20,
                        sample_rate=samp_rate,
                        fft_size=512,

Modified: gnuradio/branches/features/experimental-gui/waterfall_window.py
===================================================================
--- gnuradio/branches/features/experimental-gui/waterfall_window.py     
2008-07-31 05:27:07 UTC (rev 9085)
+++ gnuradio/branches/features/experimental-gui/waterfall_window.py     
2008-07-31 23:34:52 UTC (rev 9086)
@@ -37,8 +37,7 @@
 DEFAULT_FRAME_RATE = 30
 DEFAULT_WIN_SIZE = (600, 300)
 DIV_LEVELS = (1, 2, 5, 10, 20)
-Y_PER_DIV_KEY = 'y_per_div'
-Y_DIVS_KEY = 'y_divs'
+DYNAMIC_RANGE_KEY = 'dynamic_range'
 X_DIVS_KEY = 'x_divs'
 REF_LEVEL_KEY = 'ref_level'
 BASEBAND_FREQ_KEY = 'baseband_freq'
@@ -73,18 +72,12 @@
                )
                parent.ext_controller.add_listener(parent.average_key, 
self.avg_alpha_slider.Enable)
                control_box.Add(self.avg_alpha_slider, 0, wx.EXPAND)
-               #radio buttons for div size
+               #dyanmic range buttons
                control_box.AddStretchSpacer()
-               control_box.Add(common.LabelText(self, 'Set dB/div'), 0, 
wx.ALIGN_CENTER)
-               radio_box = wx.BoxSizer(wx.VERTICAL)
-               self.radio_buttons = list()
-               for y_per_div in DIV_LEVELS:
-                       radio_button = wx.RadioButton(self, -1, "%d 
dB/div"%y_per_div)
-                       radio_button.Bind(wx.EVT_RADIOBUTTON, 
self._on_y_per_div)
-                       self.radio_buttons.append(radio_button)
-                       radio_box.Add(radio_button, 0, wx.ALIGN_LEFT)
-               parent.controller.add_listener(Y_PER_DIV_KEY, 
self._on_set_y_per_div)
-               control_box.Add(radio_box, 0, wx.EXPAND)
+               control_box.Add(common.LabelText(self, 'Dynamic Range'), 0, 
wx.ALIGN_CENTER)
+               control_box.AddSpacer(2)
+               self._dynamic_range_buttons = common.IncrDecrButtons(self, 
self._on_incr_dynamic_range, self._on_decr_dynamic_range)
+               control_box.Add(self._dynamic_range_buttons, 0, wx.ALIGN_CENTER)
                #ref lvl buttons
                control_box.AddStretchSpacer()
                control_box.Add(common.LabelText(self, 'Set Ref Level'), 0, 
wx.ALIGN_CENTER)
@@ -101,15 +94,12 @@
        ##################################################
        # Event handlers
        ##################################################
-       def _on_set_y_per_div(self, y_per_div):
-               try:
-                       index = list(DIV_LEVELS).index(y_per_div)
-                       self.radio_buttons[index].SetValue(True)
-               except: pass
-       def _on_y_per_div(self, event):
-               selected_radio_button = filter(lambda rb: rb.GetValue(), 
self.radio_buttons)[0]
-               index = self.radio_buttons.index(selected_radio_button)
-               self.parent.controller[Y_PER_DIV_KEY] = DIV_LEVELS[index]
+       def _on_incr_dynamic_range(self, event):
+               self.parent.set_dynamic_range(
+                       2.0*self.parent.controller[DYNAMIC_RANGE_KEY])
+       def _on_decr_dynamic_range(self, event):
+               self.parent.set_dynamic_range(
+                       0.5*self.parent.controller[DYNAMIC_RANGE_KEY])
        def _on_incr_ref_level(self, event):
                self.parent.set_ref_level(
                        self.parent.controller[REF_LEVEL_KEY] + 
self.parent.controller[Y_PER_DIV_KEY])
@@ -131,16 +121,13 @@
                fft_size,
                baseband_freq,
                sample_rate_key,
-               y_per_div,
-               y_divs,
+               dynamic_range,
                ref_level,
                average_key,
                avg_alpha_key,
                msg_key,
        ):
                self.controller = prop_val.prop_val_interface()
-               #ensure y_per_div
-               if y_per_div not in DIV_LEVELS: y_per_div = DIV_LEVELS[0]
                #setup
                self.ext_controller = controller
                self.real = real
@@ -162,8 +149,7 @@
                #initial setup
                self.ext_controller[self.average_key] = 
self.ext_controller[self.average_key]
                self.ext_controller[self.avg_alpha_key] = 
self.ext_controller[self.avg_alpha_key]
-               self._register_set_prop(self.controller, Y_PER_DIV_KEY, 
y_per_div)
-               self._register_set_prop(self.controller, Y_DIVS_KEY, y_divs)
+               self._register_set_prop(self.controller, DYNAMIC_RANGE_KEY, 
dynamic_range)
                self._register_set_prop(self.controller, X_DIVS_KEY, 8) 
#approximate
                self._register_set_prop(self.controller, REF_LEVEL_KEY, 
ref_level)
                self._register_set_prop(self.controller, BASEBAND_FREQ_KEY, 
baseband_freq)
@@ -194,7 +180,7 @@
                #plot the fft
                self.plotter.set_samples(
                        samples, self.controller[REF_LEVEL_KEY], 
-                       
self.controller[Y_PER_DIV_KEY]*self.controller[Y_DIVS_KEY] + 
self.controller[REF_LEVEL_KEY],
+                       self.controller[DYNAMIC_RANGE_KEY] + 
self.controller[REF_LEVEL_KEY],
                )
                #update the plotter
                self.plotter.update()

Modified: gnuradio/branches/features/experimental-gui/waterfallsink.py
===================================================================
--- gnuradio/branches/features/experimental-gui/waterfallsink.py        
2008-07-31 05:27:07 UTC (rev 9085)
+++ gnuradio/branches/features/experimental-gui/waterfallsink.py        
2008-07-31 23:34:52 UTC (rev 9086)
@@ -48,8 +48,7 @@
                parent,
                baseband_freq=0,
                ref_scale=2.0,
-               y_per_div=10,
-               y_divs=8,
+               dynamic_range=80,
                ref_level=50,
                sample_rate=1,
                fft_size=512,
@@ -102,8 +101,7 @@
                        fft_size=fft_size,
                        baseband_freq=baseband_freq,
                        sample_rate_key=SAMPLE_RATE_KEY,
-                       y_per_div=y_per_div,
-                       y_divs=y_divs,
+                       dynamic_range=dynamic_range,
                        ref_level=ref_level,
                        average_key=AVERAGE_KEY,
                        avg_alpha_key=AVG_ALPHA_KEY,





reply via email to

[Prev in Thread] Current Thread [Next in Thread]