diff options
author | Josh Blum | 2009-10-09 15:35:43 -0700 |
---|---|---|
committer | Josh Blum | 2009-10-09 15:35:43 -0700 |
commit | 9a9582715d87521b53b1f0bb64dc8e133ce01954 (patch) | |
tree | af84a65cdbe67acb9a0390f7998f2c1ed5f3c61d /gr-wxgui/src/python | |
parent | a154cc5c12ccf65b480ae86e0c984c4a66ad69a3 (diff) | |
download | gnuradio-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.py | 11 |
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): """ |