diff options
Diffstat (limited to 'gr-digital/examples/narrowband/benchmark_rx.py')
-rw-r--r--[-rwxr-xr-x] | gr-digital/examples/narrowband/benchmark_rx.py | 36 |
1 files changed, 20 insertions, 16 deletions
diff --git a/gr-digital/examples/narrowband/benchmark_rx.py b/gr-digital/examples/narrowband/benchmark_rx.py index 09d923fc6b..8467d376e7 100755..100644 --- a/gr-digital/examples/narrowband/benchmark_rx.py +++ b/gr-digital/examples/narrowband/benchmark_rx.py @@ -1,24 +1,28 @@ #!/usr/bin/env python # # Copyright 2010,2011,2013 Free Software Foundation, Inc. -# +# # This file is part of GNU Radio -# +# # GNU Radio is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at your option) # any later version. -# +# # GNU Radio is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -# +# # You should have received a copy of the GNU General Public License # along with GNU Radio; see the file COPYING. If not, write to # the Free Software Foundation, Inc., 51 Franklin Street, # Boston, MA 02110-1301, USA. -# +# + +from __future__ import print_function +from __future__ import division +from __future__ import unicode_literals from gnuradio import gr, gru from gnuradio import blocks @@ -37,7 +41,7 @@ import struct import sys #import os -#print os.getpid() +#print(os.getpid()) #raw_input('Attach and press enter: ') class my_top_block(gr.top_block): @@ -47,10 +51,10 @@ class my_top_block(gr.top_block): if(options.rx_freq is not None): # Work-around to get the modulation's bits_per_symbol args = demodulator.extract_kwargs_from_options(options) - symbol_rate = options.bitrate / demodulator(**args).bits_per_symbol() + symbol_rate = options.bitrate / demodulator(**args.bits_per_symbol()) self.source = uhd_receiver(options.args, symbol_rate, - options.samples_per_symbol, options.rx_freq, + options.samples_per_symbol, options.rx_freq, options.lo_offset, options.rx_gain, options.spec, options.antenna, options.clock_source, options.verbose) @@ -66,7 +70,7 @@ class my_top_block(gr.top_block): # Set up receive path # do this after for any adjustments to the options that may # occur in the sinks (specifically the UHD sink) - self.rxpath = receive_path(demodulator, rx_callback, options) + self.rxpath = receive_path(demodulator, rx_callback, options) self.connect(self.source, self.rxpath) @@ -82,7 +86,7 @@ def main(): n_rcvd = 0 n_right = 0 - + def rx_callback(ok, payload): global n_rcvd, n_right (pktno,) = struct.unpack('!H', payload[0:2]) @@ -90,8 +94,8 @@ def main(): if ok: n_right += 1 - print "ok = %5s pktno = %4d n_rcvd = %4d n_right = %4d" % ( - ok, pktno, n_rcvd, n_right) + print("ok = %5s pktno = %4d n_rcvd = %4d n_right = %4d" % ( + ok, pktno, n_rcvd, n_right)) demods = digital.modulation_utils.type_1_demods() @@ -99,17 +103,17 @@ def main(): parser = OptionParser (option_class=eng_option, conflict_handler="resolve") expert_grp = parser.add_option_group("Expert") - parser.add_option("-m", "--modulation", type="choice", choices=demods.keys(), + parser.add_option("-m", "--modulation", type="choice", choices=list(demods.keys()), default='psk', help="Select modulation from: %s [default=%%default]" - % (', '.join(demods.keys()),)) + % (', '.join(list(demods.keys())),)) parser.add_option("","--from-file", default=None, help="input file of samples to demod") receive_path.add_options(parser, expert_grp) uhd_receiver.add_options(parser) - for mod in demods.values(): + for mod in list(demods.values()): mod.add_options(expert_grp) (options, args) = parser.parse_args () @@ -130,7 +134,7 @@ def main(): r = gr.enable_realtime_scheduling() if r != gr.RT_OK: - print "Warning: Failed to enable realtime scheduling." + print("Warning: Failed to enable realtime scheduling.") tb.start() # start flow graph tb.wait() # wait for it to finish |