summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Ettus2011-09-07 15:25:41 -0700
committerTom Rondeau2011-09-08 10:59:04 -0400
commitc091c56ee98f0f2eca891ebc23524925f7d1a74a (patch)
treea0c4c5e3ec2c0d52c87a1738c1f36cea19da6181
parent67ac7a2420eedb7221384b560fbc57efe6115eb8 (diff)
downloadgnuradio-c091c56ee98f0f2eca891ebc23524925f7d1a74a.tar.gz
gnuradio-c091c56ee98f0f2eca891ebc23524925f7d1a74a.tar.bz2
gnuradio-c091c56ee98f0f2eca891ebc23524925f7d1a74a.zip
logpwrfft.py -- need to average the square, not square the average. Then do proper scaling (no more 3dB kludge).
-rw-r--r--gnuradio-core/src/python/gnuradio/blks2impl/logpwrfft.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/gnuradio-core/src/python/gnuradio/blks2impl/logpwrfft.py b/gnuradio-core/src/python/gnuradio/blks2impl/logpwrfft.py
index 200c4cfbe..6f7fc520f 100644
--- a/gnuradio-core/src/python/gnuradio/blks2impl/logpwrfft.py
+++ b/gnuradio-core/src/python/gnuradio/blks2impl/logpwrfft.py
@@ -54,13 +54,13 @@ class _logpwrfft_base(gr.hier_block2):
fft = self._fft_block[0](fft_size, True, fft_window)
window_power = sum(map(lambda x: x*x, fft_window))
- c2mag = gr.complex_to_mag(fft_size)
+ c2magsq = gr.complex_to_mag_squared(fft_size)
self._avg = gr.single_pole_iir_filter_ff(1.0, fft_size)
- self._log = gr.nlog10_ff(20, fft_size,
+ self._log = gr.nlog10_ff(10, fft_size,
-20*math.log10(fft_size) # Adjust for number of bins
-10*math.log10(window_power/fft_size) # Adjust for windowing loss
- -20*math.log10(ref_scale/2)+3.0) # Adjust for reference scale
- self.connect(self, self._sd, fft, c2mag, self._avg, self._log, self)
+ -20*math.log10(ref_scale/2)) # Adjust for reference scale
+ self.connect(self, self._sd, fft, c2magsq, self._avg, self._log, self)
self._average = average
self._avg_alpha = avg_alpha