summaryrefslogtreecommitdiff
path: root/gr-wxgui/src/python/common.py
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/python/common.py
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/python/common.py')
-rw-r--r--gr-wxgui/src/python/common.py11
1 files changed, 6 insertions, 5 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):
"""