diff options
Diffstat (limited to 'gr-wxgui/src')
-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): """ |