summaryrefslogtreecommitdiff
path: root/gr-uhd/examples/python/usrp_spectrum_sense.py
diff options
context:
space:
mode:
Diffstat (limited to 'gr-uhd/examples/python/usrp_spectrum_sense.py')
-rwxr-xr-xgr-uhd/examples/python/usrp_spectrum_sense.py24
1 files changed, 14 insertions, 10 deletions
diff --git a/gr-uhd/examples/python/usrp_spectrum_sense.py b/gr-uhd/examples/python/usrp_spectrum_sense.py
index 32980adbfa..077365a916 100755
--- a/gr-uhd/examples/python/usrp_spectrum_sense.py
+++ b/gr-uhd/examples/python/usrp_spectrum_sense.py
@@ -20,8 +20,11 @@
# Boston, MA 02110-1301, USA.
#
-from gnuradio import gr, eng_notation, window
+from gnuradio import gr, eng_notation
+from gnuradio import blocks
from gnuradio import audio
+from gnuradio import filter
+from gnuradio import fft
from gnuradio import uhd
from gnuradio.eng_option import eng_option
from optparse import OptionParser
@@ -151,19 +154,19 @@ class my_top_block(gr.top_block):
self.u.set_samp_rate(usrp_rate)
dev_rate = self.u.get_samp_rate()
- s2v = gr.stream_to_vector(gr.sizeof_gr_complex, self.fft_size)
+ s2v = blocks.stream_to_vector(gr.sizeof_gr_complex, self.fft_size)
- mywindow = window.blackmanharris(self.fft_size)
- fft = gr.fft_vcc(self.fft_size, True, mywindow)
+ mywindow = filter.window.blackmanharris(self.fft_size)
+ ffter = fft.fft_vcc(self.fft_size, True, mywindow)
power = 0
for tap in mywindow:
power += tap*tap
- c2mag = gr.complex_to_mag_squared(self.fft_size)
+ c2mag = blocks.complex_to_mag_squared(self.fft_size)
# FIXME the log10 primitive is dog slow
- log = gr.nlog10_ff(10, self.fft_size,
- -20*math.log10(self.fft_size)-10*math.log10(power/self.fft_size))
+ log = blocks.nlog10_ff(10, self.fft_size,
+ -20*math.log10(self.fft_size)-10*math.log10(power/self.fft_size))
# Set the freq_step to 75% of the actual data throughput.
# This allows us to discard the bins on both ends of the spectrum.
@@ -185,8 +188,8 @@ class my_top_block(gr.top_block):
dwell_delay)
# FIXME leave out the log10 until we speed it up
- #self.connect(self.u, s2v, fft, c2mag, log, stats)
- self.connect(self.u, s2v, fft, c2mag, stats)
+ #self.connect(self.u, s2v, ffter, c2mag, log, stats)
+ self.connect(self.u, s2v, ffter, c2mag, stats)
if options.gain is None:
# if no gain was specified, use the mid-point in dB
@@ -213,7 +216,8 @@ class my_top_block(gr.top_block):
"""
Set the center frequency we're interested in.
- @param target_freq: frequency in Hz
+ Args:
+ target_freq: frequency in Hz
@rypte: bool
"""
r = self.u.set_center_freq(target_freq)