diff options
author | Johnathan Corgan <jcorgan@corganenterprises.com> | 2009-09-02 09:33:32 -0700 |
---|---|---|
committer | Johnathan Corgan <jcorgan@corganenterprises.com> | 2009-09-02 09:33:32 -0700 |
commit | 12b02687d8504adc6efb747a51d3c2fa77a21d63 (patch) | |
tree | 30d420ca7bf36aec579ad0329101e2574132bb37 /gr-wxgui/src/python/fft_window.py | |
parent | 31c94994fa22a9d5f8584449edee4e86013ae916 (diff) | |
parent | 0c68c486ec09da471c27b6f4d658ae0ba8f861b7 (diff) |
Merge branch 'wxgui' from http://gnuradio.org/git/jblum.git into master
* Modified log power fft block so ref scale is peak to peak.
* Tweaked fft sink autoscale routine to come up with better numbers.
* Modified scope sink ac couple block to use constant tap. The previous
tap calculation would cause failure for very small sample rates.
Diffstat (limited to 'gr-wxgui/src/python/fft_window.py')
-rw-r--r-- | gr-wxgui/src/python/fft_window.py | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/gr-wxgui/src/python/fft_window.py b/gr-wxgui/src/python/fft_window.py index 0529e6a5d6..4c575f1a62 100644 --- a/gr-wxgui/src/python/fft_window.py +++ b/gr-wxgui/src/python/fft_window.py @@ -256,15 +256,19 @@ class fft_window(wx.Panel, pubsub.pubsub): if not len(self.samples): return #get the peak level (max of the samples) peak_level = numpy.max(self.samples) - #get the noise floor (averge the smallest samples) - noise_floor = numpy.average(numpy.sort(self.samples)[:len(self.samples)/4]) - #padding - noise_floor -= abs(noise_floor)*.5 - peak_level += abs(peak_level)*.1 - #set the reference level to a multiple of y divs - self[REF_LEVEL_KEY] = self[Y_DIVS_KEY]*math.ceil(peak_level/self[Y_DIVS_KEY]) + #separate noise samples + noise_samps = numpy.sort(self.samples)[:len(self.samples)/2] + #get the noise floor + noise_floor = numpy.average(noise_samps) + #get the noise deviation + noise_dev = numpy.std(noise_samps) + #determine the maximum and minimum levels + max_level = peak_level + min_level = noise_floor - abs(2*noise_dev) #set the range to a clean number of the dynamic range - self[Y_PER_DIV_KEY] = common.get_clean_num((peak_level - noise_floor)/self[Y_DIVS_KEY]) + self[Y_PER_DIV_KEY] = common.get_clean_num(1+(max_level - min_level)/self[Y_DIVS_KEY]) + #set the reference level to a multiple of y per div + self[REF_LEVEL_KEY] = self[Y_PER_DIV_KEY]*round(.5+max_level/self[Y_PER_DIV_KEY]) def _reset_peak_vals(self, *args): self.peak_vals = EMPTY_TRACE |