summaryrefslogtreecommitdiff
path: root/gr-wxgui/src/python
diff options
context:
space:
mode:
authorJosh Blum2009-10-09 15:35:43 -0700
committerJosh Blum2009-10-09 15:35:43 -0700
commit9a9582715d87521b53b1f0bb64dc8e133ce01954 (patch)
treeaf84a65cdbe67acb9a0390f7998f2c1ed5f3c61d /gr-wxgui/src/python
parenta154cc5c12ccf65b480ae86e0c984c4a66ad69a3 (diff)
downloadgnuradio-9a9582715d87521b53b1f0bb64dc8e133ce01954.tar.gz
gnuradio-9a9582715d87521b53b1f0bb64dc8e133ce01954.tar.bz2
gnuradio-9a9582715d87521b53b1f0bb64dc8e133ce01954.zip
tweaks to scope autoscaling
Diffstat (limited to 'gr-wxgui/src/python')
-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 fa11b3152..a03c36d88 100644
--- a/gr-wxgui/src/python/common.py
+++ b/gr-wxgui/src/python/common.py
@@ -213,12 +213,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):
"""