diff options
author | Tom Rondeau <tom@trondeau.com> | 2015-05-06 11:49:39 -0400 |
---|---|---|
committer | Tom Rondeau <tom@trondeau.com> | 2015-05-06 11:49:39 -0400 |
commit | be49144dc10e455bdf0bb5bf95dbc742d76acdfb (patch) | |
tree | 4189ec4d8e6c8bcf6d3805829f1cf47b652f5bcf /gr-uhd/examples/python/usrp_spectrum_sense.py | |
parent | 3853855aef8090bbe8fe860ec2967b040c1c0f0f (diff) | |
parent | cab7c1eb5c0d323ade589f33e0703dd6fe9c237b (diff) |
Merge remote-tracking branch 'ckuethe/spectrum_sense'
Diffstat (limited to 'gr-uhd/examples/python/usrp_spectrum_sense.py')
-rwxr-xr-x | gr-uhd/examples/python/usrp_spectrum_sense.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/gr-uhd/examples/python/usrp_spectrum_sense.py b/gr-uhd/examples/python/usrp_spectrum_sense.py index ba45a2e80e..b1ea6b44d8 100755 --- a/gr-uhd/examples/python/usrp_spectrum_sense.py +++ b/gr-uhd/examples/python/usrp_spectrum_sense.py @@ -33,6 +33,7 @@ import math import struct import threading from datetime import datetime +import time sys.stderr.write("Warning: this may have issues on some machines+Python version combinations to seg fault due to the callback in bin_statitics.\n\n") @@ -271,6 +272,8 @@ def main_loop(tb): bin_start = int(tb.fft_size * ((1 - 0.75) / 2)) bin_stop = int(tb.fft_size - bin_start) + timestamp = 0 + centerfreq = 0 while 1: # Get the next message sent from the C++ code (blocking call). @@ -282,6 +285,15 @@ def main_loop(tb): # m.raw_data is a string that contains the binary floats. # You could write this as binary to a file. + # Scanning rate + if timestamp == 0: + timestamp = time.time() + centerfreq = m.center_freq + if m.center_freq < centerfreq: + sys.stderr.write("scanned %.1fMHz in %.1fs\n" % ((centerfreq - m.center_freq)/1.0e6, time.time() - timestamp)) + timestamp = time.time() + centerfreq = m.center_freq + for i_bin in range(bin_start, bin_stop): center_freq = m.center_freq |