summaryrefslogtreecommitdiff
path: root/gr-wxgui/src
diff options
context:
space:
mode:
authorJohnathan Corgan2009-10-15 12:02:04 -0700
committerJohnathan Corgan2009-10-15 12:02:04 -0700
commitc69f5205e13b1ae63a6e4705a892f695e57b20b3 (patch)
treeee50518a79f654244bd7866cb6ba4b761e93767f /gr-wxgui/src
parentcc5253b05a49d87a81f8510188c40196b0965fad (diff)
parent25a8f7a8f09f37ea6f31ce02523170c64d71a561 (diff)
downloadgnuradio-c69f5205e13b1ae63a6e4705a892f695e57b20b3.tar.gz
gnuradio-c69f5205e13b1ae63a6e4705a892f695e57b20b3.tar.bz2
gnuradio-c69f5205e13b1ae63a6e4705a892f695e57b20b3.zip
Merge commit '25a8' from git@gnuradio.org:jblum
* commit '25a8': use clean numbers for waterfall ref and range tweaks to scope autoscaling registered key to hide/show control panel in wxgui windows Added window size param to all wxgui wrappers. add canonical options for copy enable param
Diffstat (limited to 'gr-wxgui/src')
-rw-r--r--gr-wxgui/src/python/common.py11
-rw-r--r--gr-wxgui/src/python/const_window.py2
-rw-r--r--gr-wxgui/src/python/constants.py1
-rw-r--r--gr-wxgui/src/python/fft_window.py2
-rw-r--r--gr-wxgui/src/python/histo_window.py2
-rw-r--r--gr-wxgui/src/python/number_window.py2
-rw-r--r--gr-wxgui/src/python/scope_window.py2
-rw-r--r--gr-wxgui/src/python/waterfall_window.py15
8 files changed, 26 insertions, 11 deletions
diff --git a/gr-wxgui/src/python/common.py b/gr-wxgui/src/python/common.py
index a75f6810d..17a7dc0de 100644
--- a/gr-wxgui/src/python/common.py
+++ b/gr-wxgui/src/python/common.py
@@ -216,12 +216,13 @@ def get_min_max(samples):
@param samples the array of real values
@return a tuple of min, max
"""
- scale_factor = 3
+ factor = 2.0
mean = numpy.average(samples)
- rms = numpy.max([scale_factor*((numpy.sum((samples-mean)**2)/len(samples))**.5), .1])
- min_val = mean - rms
- max_val = mean + rms
- return min_val, max_val
+ std = numpy.std(samples)
+ fft = numpy.abs(numpy.fft.fft(samples - mean))
+ envelope = 2*numpy.max(fft)/len(samples)
+ ampl = max(std, envelope) or 0.1
+ return mean - factor*ampl, mean + factor*ampl
def get_min_max_fft(fft_samps):
"""
diff --git a/gr-wxgui/src/python/const_window.py b/gr-wxgui/src/python/const_window.py
index b128a4a98..f7c7caf07 100644
--- a/gr-wxgui/src/python/const_window.py
+++ b/gr-wxgui/src/python/const_window.py
@@ -64,6 +64,8 @@ class control_panel(wx.Panel):
"""
self.parent = parent
wx.Panel.__init__(self, parent, style=wx.SUNKEN_BORDER)
+ parent[SHOW_CONTROL_PANEL_KEY] = True
+ parent.subscribe(SHOW_CONTROL_PANEL_KEY, self.Show)
control_box = forms.static_box_sizer(
parent=self, label='Options',
bold=True, orient=wx.VERTICAL,
diff --git a/gr-wxgui/src/python/constants.py b/gr-wxgui/src/python/constants.py
index 8ff7fa8fe..825f71c32 100644
--- a/gr-wxgui/src/python/constants.py
+++ b/gr-wxgui/src/python/constants.py
@@ -69,3 +69,4 @@ MINIMUM_KEY = 'minimum'
NUM_BINS_KEY = 'num_bins'
FRAME_SIZE_KEY = 'frame_size'
CHANNEL_OPTIONS_KEY = 'channel_options'
+SHOW_CONTROL_PANEL_KEY = 'show_control_panel'
diff --git a/gr-wxgui/src/python/fft_window.py b/gr-wxgui/src/python/fft_window.py
index e025c28dd..4ee5520f7 100644
--- a/gr-wxgui/src/python/fft_window.py
+++ b/gr-wxgui/src/python/fft_window.py
@@ -64,6 +64,8 @@ class control_panel(wx.Panel):
"""
self.parent = parent
wx.Panel.__init__(self, parent, style=wx.SUNKEN_BORDER)
+ parent[SHOW_CONTROL_PANEL_KEY] = True
+ parent.subscribe(SHOW_CONTROL_PANEL_KEY, self.Show)
control_box = wx.BoxSizer(wx.VERTICAL)
control_box.AddStretchSpacer()
#checkboxes for average and peak hold
diff --git a/gr-wxgui/src/python/histo_window.py b/gr-wxgui/src/python/histo_window.py
index 5f434d70e..a1b520f9c 100644
--- a/gr-wxgui/src/python/histo_window.py
+++ b/gr-wxgui/src/python/histo_window.py
@@ -52,6 +52,8 @@ class control_panel(wx.Panel):
"""
self.parent = parent
wx.Panel.__init__(self, parent, style=wx.SUNKEN_BORDER)
+ parent[SHOW_CONTROL_PANEL_KEY] = True
+ parent.subscribe(SHOW_CONTROL_PANEL_KEY, self.Show)
control_box = wx.BoxSizer(wx.VERTICAL)
SIZE = (100, -1)
control_box = forms.static_box_sizer(
diff --git a/gr-wxgui/src/python/number_window.py b/gr-wxgui/src/python/number_window.py
index 8a8249764..ab9d1ebc0 100644
--- a/gr-wxgui/src/python/number_window.py
+++ b/gr-wxgui/src/python/number_window.py
@@ -58,6 +58,8 @@ class control_panel(wx.Panel):
"""
self.parent = parent
wx.Panel.__init__(self, parent)
+ parent[SHOW_CONTROL_PANEL_KEY] = True
+ parent.subscribe(SHOW_CONTROL_PANEL_KEY, self.Show)
control_box = wx.BoxSizer(wx.VERTICAL)
#checkboxes for average and peak hold
control_box.AddStretchSpacer()
diff --git a/gr-wxgui/src/python/scope_window.py b/gr-wxgui/src/python/scope_window.py
index 449046402..9346a73d8 100644
--- a/gr-wxgui/src/python/scope_window.py
+++ b/gr-wxgui/src/python/scope_window.py
@@ -82,6 +82,8 @@ class control_panel(wx.Panel):
WIDTH = 90
self.parent = parent
wx.Panel.__init__(self, parent, style=wx.SUNKEN_BORDER)
+ parent[SHOW_CONTROL_PANEL_KEY] = True
+ parent.subscribe(SHOW_CONTROL_PANEL_KEY, self.Show)
control_box = wx.BoxSizer(wx.VERTICAL)
##################################################
# Axes Options
diff --git a/gr-wxgui/src/python/waterfall_window.py b/gr-wxgui/src/python/waterfall_window.py
index 28e67a830..b7904e4d9 100644
--- a/gr-wxgui/src/python/waterfall_window.py
+++ b/gr-wxgui/src/python/waterfall_window.py
@@ -41,6 +41,7 @@ DEFAULT_FRAME_RATE = gr.prefs().get_long('wxgui', 'waterfall_rate', 30)
DEFAULT_WIN_SIZE = (600, 300)
DIV_LEVELS = (1, 2, 5, 10, 20)
MIN_DYNAMIC_RANGE, MAX_DYNAMIC_RANGE = 10, 200
+DYNAMIC_RANGE_STEP = 10.
COLOR_MODES = (
('RGB1', 'rgb1'),
('RGB2', 'rgb2'),
@@ -63,6 +64,8 @@ class control_panel(wx.Panel):
"""
self.parent = parent
wx.Panel.__init__(self, parent, style=wx.SUNKEN_BORDER)
+ parent[SHOW_CONTROL_PANEL_KEY] = True
+ parent.subscribe(SHOW_CONTROL_PANEL_KEY, self.Show)
control_box = wx.BoxSizer(wx.VERTICAL)
control_box.AddStretchSpacer()
options_box = forms.static_box_sizer(
@@ -143,13 +146,13 @@ class control_panel(wx.Panel):
def _on_clear_button(self, event):
self.parent[NUM_LINES_KEY] = self.parent[NUM_LINES_KEY]
def _on_incr_dynamic_range(self, event):
- self.parent[DYNAMIC_RANGE_KEY] = min(self.parent[DYNAMIC_RANGE_KEY] + 10, MAX_DYNAMIC_RANGE)
+ self.parent[DYNAMIC_RANGE_KEY] = min(MAX_DYNAMIC_RANGE, common.get_clean_incr(self.parent[DYNAMIC_RANGE_KEY]))
def _on_decr_dynamic_range(self, event):
- self.parent[DYNAMIC_RANGE_KEY] = max(self.parent[DYNAMIC_RANGE_KEY] - 10, MIN_DYNAMIC_RANGE)
+ self.parent[DYNAMIC_RANGE_KEY] = max(MIN_DYNAMIC_RANGE, common.get_clean_decr(self.parent[DYNAMIC_RANGE_KEY]))
def _on_incr_ref_level(self, event):
- self.parent[REF_LEVEL_KEY] = self.parent[REF_LEVEL_KEY] + self.parent[DYNAMIC_RANGE_KEY]*.1
+ self.parent[REF_LEVEL_KEY] = self.parent[REF_LEVEL_KEY] + self.parent[DYNAMIC_RANGE_KEY]/DYNAMIC_RANGE_STEP
def _on_decr_ref_level(self, event):
- self.parent[REF_LEVEL_KEY] = self.parent[REF_LEVEL_KEY] - self.parent[DYNAMIC_RANGE_KEY]*.1
+ self.parent[REF_LEVEL_KEY] = self.parent[REF_LEVEL_KEY] - self.parent[DYNAMIC_RANGE_KEY]/DYNAMIC_RANGE_STEP
def _on_incr_time_scale(self, event):
old_rate = self.parent[FRAME_RATE_KEY]
self.parent[FRAME_RATE_KEY] *= 0.75
@@ -239,8 +242,8 @@ class waterfall_window(wx.Panel, pubsub.pubsub):
if not len(self.samples): return
min_level, max_level = common.get_min_max_fft(self.samples)
#set the range and level
- self[REF_LEVEL_KEY] = max_level
- self[DYNAMIC_RANGE_KEY] = max_level - min_level
+ self[DYNAMIC_RANGE_KEY] = common.get_clean_num(max_level - min_level)
+ self[REF_LEVEL_KEY] = DYNAMIC_RANGE_STEP*round(.5+max_level/DYNAMIC_RANGE_STEP)
def handle_msg(self, msg):
"""