diff options
author | Tom Rondeau <trondeau@vt.edu> | 2012-04-13 18:36:53 -0400 |
---|---|---|
committer | Tom Rondeau <trondeau@vt.edu> | 2012-04-13 18:36:53 -0400 |
commit | f919f9dcbb54a08e6e26d6c229ce92fb784fa1b2 (patch) | |
tree | 7e846386b9eb1676f9a93fc4a1e55916b9accc97 /gnuradio-core/src/examples | |
parent | 6a1e9783fec6ed827f49db27c171591d30f32933 (diff) |
Removed whitespace and added dtools/bin/remove-whitespace as a tool to do this in the future.
The sed script was provided by Moritz Fischer.
Diffstat (limited to 'gnuradio-core/src/examples')
32 files changed, 267 insertions, 267 deletions
diff --git a/gnuradio-core/src/examples/CMakeLists.txt b/gnuradio-core/src/examples/CMakeLists.txt index 4bdc463e45..c2b847c919 100644 --- a/gnuradio-core/src/examples/CMakeLists.txt +++ b/gnuradio-core/src/examples/CMakeLists.txt @@ -1,17 +1,17 @@ # Copyright 2011 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, diff --git a/gnuradio-core/src/examples/mp-sched/CMakeLists.txt b/gnuradio-core/src/examples/mp-sched/CMakeLists.txt index 2bf70d4644..dc47d17f9e 100644 --- a/gnuradio-core/src/examples/mp-sched/CMakeLists.txt +++ b/gnuradio-core/src/examples/mp-sched/CMakeLists.txt @@ -1,17 +1,17 @@ # Copyright 2011 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, diff --git a/gnuradio-core/src/examples/mp-sched/plot_flops.py b/gnuradio-core/src/examples/mp-sched/plot_flops.py index b3f819397d..d9d810ae2f 100755 --- a/gnuradio-core/src/examples/mp-sched/plot_flops.py +++ b/gnuradio-core/src/examples/mp-sched/plot_flops.py @@ -1,19 +1,19 @@ #!/usr/bin/env python # # Copyright 2008 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 this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. @@ -38,7 +38,7 @@ def parse_file(input_filename, output): s = line.strip() if s.startswith('>>>'): # ignore ">>> using SSE cruft" continue - + if s.startswith('#D'): # machine description desc = s[2:].strip() continue @@ -78,7 +78,7 @@ def handle_file(input_filename): data_file.flush() os.system("gnuplot " + cmd_file_name + " -") - + #sys.stdout.write(open(cmd_file_name,'r').read()) #sys.stdout.write(open(data_file_name,'r').read()) diff --git a/gnuradio-core/src/examples/mp-sched/run_synthetic.py b/gnuradio-core/src/examples/mp-sched/run_synthetic.py index 565e6c5c79..4896bca462 100755 --- a/gnuradio-core/src/examples/mp-sched/run_synthetic.py +++ b/gnuradio-core/src/examples/mp-sched/run_synthetic.py @@ -1,19 +1,19 @@ #!/usr/bin/env python # # Copyright 2008 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 this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. @@ -58,8 +58,8 @@ def write_shell_script(f, data_filename, description, ncores, gflops, max_pipes_ f.write(") 2>&1 | grep --line-buffered -v '^>>>' | tee %s\n" % (data_filename,)) f.flush() - - + + def main(): description = """%prog gathers multiprocessor scaling data using the ./synthetic.py benchmark. @@ -88,14 +88,14 @@ plot_flops.py will make pretty graphs from the output data generated by %prog. output_filename = args[0] shell = os.popen("/bin/sh", "w") - + write_shell_script(shell, output_filename, options.description, options.ncores, options.gflops, options.max_pipes_and_stages) - + if __name__ == '__main__': main() diff --git a/gnuradio-core/src/examples/mp-sched/synthetic.py b/gnuradio-core/src/examples/mp-sched/synthetic.py index e1fcb20bd2..5ce1b5eb89 100755 --- a/gnuradio-core/src/examples/mp-sched/synthetic.py +++ b/gnuradio-core/src/examples/mp-sched/synthetic.py @@ -1,19 +1,19 @@ #!/usr/bin/env python # # Copyright 2008 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 this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. @@ -42,7 +42,7 @@ class pipeline(gr.hier_block2): upstream = op self.connect(upstream, gr.null_sink(gr.sizeof_float)) - + class top(gr.top_block): def __init__(self): @@ -112,7 +112,7 @@ if __name__ == "__main__": time_it(tb) except KeyboardInterrupt: raise SystemExit, 128 - - - + + + diff --git a/gnuradio-core/src/examples/mp-sched/wfm_rcv_pll_to_wav.py b/gnuradio-core/src/examples/mp-sched/wfm_rcv_pll_to_wav.py index 3971d8b738..81613922b8 100755 --- a/gnuradio-core/src/examples/mp-sched/wfm_rcv_pll_to_wav.py +++ b/gnuradio-core/src/examples/mp-sched/wfm_rcv_pll_to_wav.py @@ -1,24 +1,24 @@ #!/usr/bin/env python # # Copyright 2005,2006,2007 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 gnuradio import gr, gru, eng_notation, optfir from gnuradio import audio @@ -41,14 +41,14 @@ class wfm_rx_block (gr.top_block): if len(args) != 2: parser.print_help() sys.exit(1) - + input_filename = args[0] output_filename = args[1] self.vol = 0 - + # build graph - + self.src = gr.file_source(gr.sizeof_gr_complex, input_filename, False) adc_rate = 64e6 # 64 MS/s @@ -84,7 +84,7 @@ class wfm_rx_block (gr.top_block): sink = audio.sink (int (audio_rate), options.audio_output, False) # ok_to_block - + # now wire it all together self.connect (self.src, chan_filt, self.guts) self.connect ((self.guts, 0), self.volume_control_l, (sink, 0)) @@ -117,7 +117,7 @@ class wfm_rx_block (gr.top_block): def volume_range(self): return (-20.0, 0.0, 0.5) - + if __name__ == '__main__': tb = wfm_rx_block() diff --git a/gnuradio-core/src/examples/network/CMakeLists.txt b/gnuradio-core/src/examples/network/CMakeLists.txt index 33e7cb7d0d..902933e297 100644 --- a/gnuradio-core/src/examples/network/CMakeLists.txt +++ b/gnuradio-core/src/examples/network/CMakeLists.txt @@ -1,17 +1,17 @@ # Copyright 2011 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, diff --git a/gnuradio-core/src/examples/network/audio_sink.py b/gnuradio-core/src/examples/network/audio_sink.py index 48b6435785..72a678816c 100755 --- a/gnuradio-core/src/examples/network/audio_sink.py +++ b/gnuradio-core/src/examples/network/audio_sink.py @@ -1,24 +1,24 @@ #!/usr/bin/env python # # Copyright 2006,2007,2010 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 gnuradio import gr from gnuradio.eng_option import eng_option @@ -38,7 +38,7 @@ class audio_sink(gr.top_block): eof=eof, wait=wait) dst = audio.sink(sample_rate) self.connect(src, dst) - + if __name__ == '__main__': parser = OptionParser(option_class=eng_option) parser.add_option("", "--host", type="string", default="0.0.0.0", @@ -62,11 +62,11 @@ if __name__ == '__main__': top_block = audio_sink(options.host, options.port, options.packet_size, options.sample_rate, not options.no_eof, not options.no_wait) - - try: + + try: # Run forever top_block.run() except KeyboardInterrupt: # Ctrl-C exits pass - + diff --git a/gnuradio-core/src/examples/network/audio_source.py b/gnuradio-core/src/examples/network/audio_source.py index ef0dc13ba7..0baf7d2e91 100755 --- a/gnuradio-core/src/examples/network/audio_source.py +++ b/gnuradio-core/src/examples/network/audio_source.py @@ -1,24 +1,24 @@ #!/usr/bin/env python # # Copyright 2006,2007,2010 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 gnuradio import gr from gnuradio.eng_option import eng_option @@ -59,11 +59,11 @@ if __name__ == '__main__': top_block = audio_source(options.host, options.port, options.packet_size, options.sample_rate, not options.no_eof) - - try: + + try: # Run forever top_block.run() except KeyboardInterrupt: # Ctrl-C exits pass - + diff --git a/gnuradio-core/src/examples/network/dial_tone_sink.py b/gnuradio-core/src/examples/network/dial_tone_sink.py index 1b9009552e..83ad376c0c 100755 --- a/gnuradio-core/src/examples/network/dial_tone_sink.py +++ b/gnuradio-core/src/examples/network/dial_tone_sink.py @@ -1,24 +1,24 @@ #!/usr/bin/env python # # Copyright 2006,2007,2010 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 gnuradio import gr, audio from gnuradio.eng_option import eng_option @@ -31,7 +31,7 @@ class dial_tone_sink(gr.top_block): eof=eof, wait=wait) sink = audio.sink(sample_rate) self.connect(udp, sink) - + if __name__ == '__main__': parser = OptionParser(option_class=eng_option) parser.add_option("", "--host", type="string", default="0.0.0.0", @@ -55,11 +55,11 @@ if __name__ == '__main__': top_block = dial_tone_sink(options.host, options.port, options.packet_size, options.sample_rate, not options.no_eof, not options.no_wait) - - try: + + try: # Run forever top_block.run() except KeyboardInterrupt: # Ctrl-C exits pass - + diff --git a/gnuradio-core/src/examples/network/dial_tone_source.py b/gnuradio-core/src/examples/network/dial_tone_source.py index 766ecf16d8..232a06de80 100755 --- a/gnuradio-core/src/examples/network/dial_tone_source.py +++ b/gnuradio-core/src/examples/network/dial_tone_source.py @@ -1,24 +1,24 @@ #!/usr/bin/env python # # Copyright 2006,2007,2010 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 gnuradio import gr from gnuradio.eng_option import eng_option @@ -61,8 +61,8 @@ if __name__ == '__main__': top_block = dial_tone_source(options.host, options.port, options.packet_size, options.sample_rate, not options.no_eof) - - try: + + try: # Run forever top_block.run() except KeyboardInterrupt: diff --git a/gnuradio-core/src/examples/network/vector_sink.py b/gnuradio-core/src/examples/network/vector_sink.py index 5d73858a35..e84a27d9fe 100755 --- a/gnuradio-core/src/examples/network/vector_sink.py +++ b/gnuradio-core/src/examples/network/vector_sink.py @@ -1,24 +1,24 @@ #!/usr/bin/env python # # Copyright 2006,2010 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 gnuradio import gr from gnuradio.eng_option import eng_option @@ -49,16 +49,16 @@ if __name__ == "__main__": if len(args) != 0: parser.print_help() raise SystemExit, 1 - + # Create an instance of a hierarchical block top_block = vector_sink(options.host, options.port, options.packet_size, not options.no_eof, not options.no_wait) - - try: + + try: # Run forever top_block.run() except KeyboardInterrupt: # Ctrl-C exits pass - + diff --git a/gnuradio-core/src/examples/network/vector_source.py b/gnuradio-core/src/examples/network/vector_source.py index 0e7d678445..d322dda3b8 100755 --- a/gnuradio-core/src/examples/network/vector_source.py +++ b/gnuradio-core/src/examples/network/vector_source.py @@ -1,24 +1,24 @@ #!/usr/bin/env python # # Copyright 2006,2010 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 gnuradio import gr from gnuradio.eng_option import eng_option @@ -50,11 +50,11 @@ if __name__ == '__main__': # Create an instance of a hierarchical block top_block = vector_source(options.host, options.port, options.packet_size, not options.no_eof) - - try: + + try: # Run forever top_block.run() except KeyboardInterrupt: # Ctrl-C exits pass - + diff --git a/gnuradio-core/src/examples/pfb/CMakeLists.txt b/gnuradio-core/src/examples/pfb/CMakeLists.txt index 899c47b90d..6bb25568c8 100644 --- a/gnuradio-core/src/examples/pfb/CMakeLists.txt +++ b/gnuradio-core/src/examples/pfb/CMakeLists.txt @@ -1,17 +1,17 @@ # Copyright 2011 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, diff --git a/gnuradio-core/src/examples/pfb/channelize.py b/gnuradio-core/src/examples/pfb/channelize.py index 2fcb14a360..442f263f47 100755 --- a/gnuradio-core/src/examples/pfb/channelize.py +++ b/gnuradio-core/src/examples/pfb/channelize.py @@ -1,24 +1,24 @@ #!/usr/bin/env python # # Copyright 2009 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 gnuradio import gr, blks2 import sys, time @@ -46,7 +46,7 @@ class pfb_top_block(gr.top_block): self._M = 9 # Number of channels to channelize # Create a set of taps for the PFB channelizer - self._taps = gr.firdes.low_pass_2(1, self._fs, 475.50, 50, + self._taps = gr.firdes.low_pass_2(1, self._fs, 475.50, 50, attenuation_dB=100, window=gr.firdes.WIN_BLACKMAN_hARRIS) # Calculate the number of taps per channel for our own information @@ -54,9 +54,9 @@ class pfb_top_block(gr.top_block): print "Number of taps: ", len(self._taps) print "Number of channels: ", self._M print "Taps per channel: ", tpc - + # Create a set of signals at different frequencies - # freqs lists the frequencies of the signals that get stored + # freqs lists the frequencies of the signals that get stored # in the list "signals", which then get summed together self.signals = list() self.add = gr.add_cc() @@ -79,17 +79,17 @@ class pfb_top_block(gr.top_block): # Use this to play with the channel mapping #self.pfb.set_channel_map([5,6,7,8,0,1,2,3,4]) - + # Create a vector sink for each of M output channels of the filter and connect it self.snks = list() for i in xrange(self._M): self.snks.append(gr.vector_sink_c()) self.connect((self.pfb, i), self.snks[i]) - + def main(): tstart = time.time() - + tb = pfb_top_block() tb.run() @@ -100,7 +100,7 @@ def main(): fig_in = pylab.figure(1, figsize=(16,9), facecolor="w") fig1 = pylab.figure(2, figsize=(16,9), facecolor="w") fig2 = pylab.figure(3, figsize=(16,9), facecolor="w") - + Ns = 1000 Ne = 10000 @@ -118,8 +118,8 @@ def main(): X_in = 10.0*scipy.log10(abs(X)) f_in = scipy.arange(-fs/2.0, fs/2.0, fs/float(X_in.size)) pin_f = spin_f.plot(f_in, X_in, "b") - spin_f.set_xlim([min(f_in), max(f_in)+1]) - spin_f.set_ylim([-200.0, 50.0]) + spin_f.set_xlim([min(f_in), max(f_in)+1]) + spin_f.set_ylim([-200.0, 50.0]) spin_f.set_title("Input Signal", weight="bold") spin_f.set_xlabel("Frequency (Hz)") @@ -128,7 +128,7 @@ def main(): Ts = 1.0/fs Tmax = len(d)*Ts - + t_in = scipy.arange(0, Tmax, Ts) x_in = scipy.array(d) spin_t = fig_in.add_subplot(2, 1, 2) @@ -161,8 +161,8 @@ def main(): X_o = 10.0*scipy.log10(abs(X)) f_o = scipy.arange(-fs_o/2.0, fs_o/2.0, fs_o/float(X_o.size)) p2_f = sp1_f.plot(f_o, X_o, "b") - sp1_f.set_xlim([min(f_o), max(f_o)+1]) - sp1_f.set_ylim([-200.0, 50.0]) + sp1_f.set_xlim([min(f_o), max(f_o)+1]) + sp1_f.set_ylim([-200.0, 50.0]) sp1_f.set_title(("Channel %d" % i), weight="bold") sp1_f.set_xlabel("Frequency (Hz)") @@ -173,8 +173,8 @@ def main(): sp2_o = fig2.add_subplot(Nrows, Ncols, 1+i) p2_o = sp2_o.plot(t_o, x_o.real, "b") p2_o = sp2_o.plot(t_o, x_o.imag, "r") - sp2_o.set_xlim([min(t_o), max(t_o)+1]) - sp2_o.set_ylim([-2, 2]) + sp2_o.set_xlim([min(t_o), max(t_o)+1]) + sp2_o.set_ylim([-2, 2]) sp2_o.set_title(("Channel %d" % i), weight="bold") sp2_o.set_xlabel("Time (s)") @@ -188,4 +188,4 @@ if __name__ == "__main__": main() except KeyboardInterrupt: pass - + diff --git a/gnuradio-core/src/examples/pfb/chirp_channelize.py b/gnuradio-core/src/examples/pfb/chirp_channelize.py index 951255d3b0..1c485ea9dd 100755 --- a/gnuradio-core/src/examples/pfb/chirp_channelize.py +++ b/gnuradio-core/src/examples/pfb/chirp_channelize.py @@ -1,24 +1,24 @@ #!/usr/bin/env python # # Copyright 2009 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 gnuradio import gr, blks2 import sys, time @@ -46,7 +46,7 @@ class pfb_top_block(gr.top_block): self._M = 9 # Number of channels to channelize # Create a set of taps for the PFB channelizer - self._taps = gr.firdes.low_pass_2(1, self._fs, 500, 20, + self._taps = gr.firdes.low_pass_2(1, self._fs, 500, 20, attenuation_dB=10, window=gr.firdes.WIN_BLACKMAN_hARRIS) # Calculate the number of taps per channel for our own information @@ -62,7 +62,7 @@ class pfb_top_block(gr.top_block): amp = 100 data = scipy.arange(0, amp, amp/float(self._N)) self.vco_input = gr.vector_source_f(data, False) - + # Build a VCO controlled by either the sinusoid or single chirp tone # Then convert this to a complex signal self.vco = gr.vco_f(self._fs, 225, 1) @@ -86,11 +86,11 @@ class pfb_top_block(gr.top_block): for i in xrange(self._M): self.snks.append(gr.vector_sink_c()) self.connect((self.pfb, i), self.snks[i]) - + def main(): tstart = time.time() - + tb = pfb_top_block() tb.run() @@ -102,7 +102,7 @@ def main(): fig1 = pylab.figure(2, figsize=(16,9), facecolor="w") fig2 = pylab.figure(3, figsize=(16,9), facecolor="w") fig3 = pylab.figure(4, figsize=(16,9), facecolor="w") - + Ns = 650 Ne = 20000 @@ -120,8 +120,8 @@ def main(): X_in = 10.0*scipy.log10(abs(fftpack.fftshift(X))) f_in = scipy.arange(-fs/2.0, fs/2.0, fs/float(X_in.size)) pin_f = spin_f.plot(f_in, X_in, "b") - spin_f.set_xlim([min(f_in), max(f_in)+1]) - spin_f.set_ylim([-200.0, 50.0]) + spin_f.set_xlim([min(f_in), max(f_in)+1]) + spin_f.set_ylim([-200.0, 50.0]) spin_f.set_title("Input Signal", weight="bold") spin_f.set_xlabel("Frequency (Hz)") @@ -130,7 +130,7 @@ def main(): Ts = 1.0/fs Tmax = len(d)*Ts - + t_in = scipy.arange(0, Tmax, Ts) x_in = scipy.array(d) spin_t = fig_in.add_subplot(2, 1, 2) @@ -163,8 +163,8 @@ def main(): X_o = 10.0*scipy.log10(abs(X)) f_o = freq p2_f = sp1_f.plot(f_o, X_o, "b") - sp1_f.set_xlim([min(f_o), max(f_o)+1]) - sp1_f.set_ylim([-200.0, 50.0]) + sp1_f.set_xlim([min(f_o), max(f_o)+1]) + sp1_f.set_ylim([-200.0, 50.0]) sp1_f.set_title(("Channel %d" % i), weight="bold") sp1_f.set_xlabel("Frequency (Hz)") @@ -175,8 +175,8 @@ def main(): sp2_o = fig2.add_subplot(Nrows, Ncols, 1+i) p2_o = sp2_o.plot(t_o, x_o.real, "b") p2_o = sp2_o.plot(t_o, x_o.imag, "r") - sp2_o.set_xlim([min(t_o), max(t_o)+1]) - sp2_o.set_ylim([-2, 2]) + sp2_o.set_xlim([min(t_o), max(t_o)+1]) + sp2_o.set_ylim([-2, 2]) sp2_o.set_title(("Channel %d" % i), weight="bold") sp2_o.set_xlabel("Time (s)") @@ -185,12 +185,12 @@ def main(): sp3 = fig3.add_subplot(1,1,1) p3 = sp3.plot(t_o, x_o.real) - sp3.set_xlim([min(t_o), max(t_o)+1]) - sp3.set_ylim([-2, 2]) + sp3.set_xlim([min(t_o), max(t_o)+1]) + sp3.set_ylim([-2, 2]) sp3.set_title("All Channels") sp3.set_xlabel("Time (s)") - sp3.set_ylabel("Amplitude") + sp3.set_ylabel("Amplitude") pylab.show() @@ -200,4 +200,4 @@ if __name__ == "__main__": main() except KeyboardInterrupt: pass - + diff --git a/gnuradio-core/src/examples/pfb/decimate.py b/gnuradio-core/src/examples/pfb/decimate.py index 643a2c2417..5322d746db 100755 --- a/gnuradio-core/src/examples/pfb/decimate.py +++ b/gnuradio-core/src/examples/pfb/decimate.py @@ -1,24 +1,24 @@ #!/usr/bin/env python # # Copyright 2009 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 gnuradio import gr, blks2 import sys, time @@ -44,7 +44,7 @@ class pfb_top_block(gr.top_block): self._N = 10000000 # number of samples to use self._fs = 10000 # initial sampling rate self._decim = 20 # Decimation rate - + # Generate the prototype filter taps for the decimators with a 200 Hz bandwidth self._taps = gr.firdes.low_pass_2(1, self._fs, 200, 150, attenuation_dB=120, window=gr.firdes.WIN_BLACKMAN_hARRIS) @@ -54,7 +54,7 @@ class pfb_top_block(gr.top_block): print "Number of taps: ", len(self._taps) print "Number of filters: ", self._decim print "Taps per channel: ", tpc - + # Build the input signal source # We create a list of freqs, and a sine wave is generated and added to the source # for each one of these frequencies. @@ -66,7 +66,7 @@ class pfb_top_block(gr.top_block): self.connect(self.signals[i], (self.add,i)) self.head = gr.head(gr.sizeof_gr_complex, self._N) - + # Construct a PFB decimator filter self.pfb = blks2.pfb_decimator_ccf(self._decim, self._taps, 0) @@ -82,12 +82,12 @@ class pfb_top_block(gr.top_block): # Create the sink for the decimated siganl self.snk = gr.vector_sink_c() self.connect(self.pfb, self.snk) - + def main(): tb = pfb_top_block() - tstart = time.time() + tstart = time.time() tb.run() tend = time.time() print "Run time: %f" % (tend - tstart) @@ -95,7 +95,7 @@ def main(): if 1: fig1 = pylab.figure(1, figsize=(16,9)) fig2 = pylab.figure(2, figsize=(16,9)) - + Ns = 10000 Ne = 10000 @@ -114,13 +114,13 @@ def main(): X_in = 10.0*scipy.log10(abs(fftpack.fftshift(X))) f_in = scipy.arange(-fs/2.0, fs/2.0, fs/float(X_in.size)) p1_f = sp1_f.plot(f_in, X_in, "b") - sp1_f.set_xlim([min(f_in), max(f_in)+1]) - sp1_f.set_ylim([-200.0, 50.0]) + sp1_f.set_xlim([min(f_in), max(f_in)+1]) + sp1_f.set_ylim([-200.0, 50.0]) sp1_f.set_title("Input Signal", weight="bold") sp1_f.set_xlabel("Frequency (Hz)") sp1_f.set_ylabel("Power (dBW)") - + Ts = 1.0/fs Tmax = len(d)*Ts @@ -134,7 +134,7 @@ def main(): sp1_t.set_xlabel("Time (s)") sp1_t.set_ylabel("Amplitude") - + # Plot the output of the decimator fs_o = tb._fs / tb._decim @@ -146,13 +146,13 @@ def main(): X_o = 10.0*scipy.log10(abs(fftpack.fftshift(X))) f_o = scipy.arange(-fs_o/2.0, fs_o/2.0, fs_o/float(X_o.size)) p2_f = sp2_f.plot(f_o, X_o, "b") - sp2_f.set_xlim([min(f_o), max(f_o)+1]) - sp2_f.set_ylim([-200.0, 50.0]) + sp2_f.set_xlim([min(f_o), max(f_o)+1]) + sp2_f.set_ylim([-200.0, 50.0]) sp2_f.set_title("PFB Decimated Signal", weight="bold") sp2_f.set_xlabel("Frequency (Hz)") sp2_f.set_ylabel("Power (dBW)") - + Ts_o = 1.0/fs_o Tmax_o = len(d)*Ts_o @@ -175,4 +175,4 @@ if __name__ == "__main__": main() except KeyboardInterrupt: pass - + diff --git a/gnuradio-core/src/examples/pfb/fmtest.py b/gnuradio-core/src/examples/pfb/fmtest.py index 635ee4e9ed..b9dd9b3823 100755 --- a/gnuradio-core/src/examples/pfb/fmtest.py +++ b/gnuradio-core/src/examples/pfb/fmtest.py @@ -1,24 +1,24 @@ #!/usr/bin/env python # # Copyright 2009 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 gnuradio import gr, blks2 import sys, math, time @@ -45,7 +45,7 @@ class fmtx(gr.hier_block2): gr.io_signature(1, 1, gr.sizeof_gr_complex)) # Output signature fmtx = blks2.nbfm_tx (audio_rate, if_rate, max_dev=5e3, tau=75e-6) - + # Local oscillator lo = gr.sig_source_c (if_rate, # sample rate gr.GR_SIN_WAVE, # waveform type @@ -53,7 +53,7 @@ class fmtx(gr.hier_block2): 1.0, # amplitude 0) # DC Offset mixer = gr.multiply_cc () - + self.connect (self, fmtx, (mixer, 0)) self.connect (lo, (mixer, 1)) self.connect (mixer, self) @@ -93,7 +93,7 @@ class fmtest(gr.top_block): bw = chspacing/2.0 t_bw = chspacing/10.0 self._chan_rate = self._if_rate / self._M - self._taps = gr.firdes.low_pass_2(1, self._if_rate, bw, t_bw, + self._taps = gr.firdes.low_pass_2(1, self._if_rate, bw, t_bw, attenuation_dB=100, window=gr.firdes.WIN_BLACKMAN_hARRIS) tpc = math.ceil(float(len(self._taps)) / float(self._M)) @@ -101,11 +101,11 @@ class fmtest(gr.top_block): print "Number of taps: ", len(self._taps) print "Number of channels: ", self._M print "Taps per channel: ", tpc - + self.pfb = blks2.pfb_channelizer_ccf(self._M, self._taps) - + self.connect(self.channel, self.pfb) - + # Create a file sink for each of M output channels of the filter and connect it self.fmdet = list() self.squelch = list() @@ -153,8 +153,8 @@ def main(): X_in = 10.0*scipy.log10(abs(fftpack.fftshift(X))) f_in = scipy.arange(-fs/2.0, fs/2.0, fs/float(X_in.size)) p1_f = sp1_f.plot(f_in, X_in, "b") - sp1_f.set_xlim([min(f_in), max(f_in)+1]) - sp1_f.set_ylim([-120.0, 20.0]) + sp1_f.set_xlim([min(f_in), max(f_in)+1]) + sp1_f.set_ylim([-120.0, 20.0]) sp1_f.set_title("Input Signal", weight="bold") sp1_f.set_xlabel("Frequency (Hz)") @@ -162,7 +162,7 @@ def main(): Ts = 1.0/fs Tmax = len(d)*Ts - + t_in = scipy.arange(0, Tmax, Ts) x_in = scipy.array(d) sp1_t = fig1.add_subplot(2, 1, 2) @@ -194,8 +194,8 @@ def main(): #f_o = scipy.arange(-fs_o/2.0, fs_o/2.0, fs_o/float(X_o.size)) f_o = scipy.arange(0, fs_o/2.0, fs_o/2.0/float(X_o.size)) p2_f = sp2_f.plot(f_o, X_o, "b") - sp2_f.set_xlim([min(f_o), max(f_o)+0.1]) - sp2_f.set_ylim([-120.0, 20.0]) + sp2_f.set_xlim([min(f_o), max(f_o)+0.1]) + sp2_f.set_ylim([-120.0, 20.0]) sp2_f.grid(True) sp2_f.set_title(("Channel %d" % i), weight="bold") @@ -211,8 +211,8 @@ def main(): sp2_t = fig3.add_subplot(Nrows, Ncols, 1+i) p2_t = sp2_t.plot(t_o, x_t.real, "b") p2_t = sp2_t.plot(t_o, x_t.imag, "r") - sp2_t.set_xlim([min(t_o), max(t_o)+1]) - sp2_t.set_ylim([-1, 1]) + sp2_t.set_xlim([min(t_o), max(t_o)+1]) + sp2_t.set_ylim([-1, 1]) sp2_t.set_xlabel("Time (s)") sp2_t.set_ylabel("Amplitude") diff --git a/gnuradio-core/src/examples/pfb/interpolate.py b/gnuradio-core/src/examples/pfb/interpolate.py index 370cf26a72..98068f220b 100755 --- a/gnuradio-core/src/examples/pfb/interpolate.py +++ b/gnuradio-core/src/examples/pfb/interpolate.py @@ -1,24 +1,24 @@ #!/usr/bin/env python # # Copyright 2009 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 gnuradio import gr, blks2 import sys, time @@ -46,13 +46,13 @@ class pfb_top_block(gr.top_block): self._interp = 5 # Interpolation rate for PFB interpolator self._ainterp = 5.5 # Resampling rate for the PFB arbitrary resampler - # Frequencies of the signals we construct + # Frequencies of the signals we construct freq1 = 100 freq2 = 200 # Create a set of taps for the PFB interpolator # This is based on the post-interpolation sample rate - self._taps = gr.firdes.low_pass_2(self._interp, self._interp*self._fs, freq2+50, 50, + self._taps = gr.firdes.low_pass_2(self._interp, self._interp*self._fs, freq2+50, 50, attenuation_dB=120, window=gr.firdes.WIN_BLACKMAN_hARRIS) # Create a set of taps for the PFB arbitrary resampler @@ -61,7 +61,7 @@ class pfb_top_block(gr.top_block): # The taps in this filter are based on a sampling rate of the filter size since it acts # internally as an interpolator. flt_size = 32 - self._taps2 = gr.firdes.low_pass_2(flt_size, flt_size*self._fs, freq2+50, 150, + self._taps2 = gr.firdes.low_pass_2(flt_size, flt_size*self._fs, freq2+50, 150, attenuation_dB=120, window=gr.firdes.WIN_BLACKMAN_hARRIS) # Calculate the number of taps per channel for our own information @@ -74,7 +74,7 @@ class pfb_top_block(gr.top_block): self.signal1 = gr.sig_source_c(self._fs, gr.GR_SIN_WAVE, freq1, 0.5) self.signal2 = gr.sig_source_c(self._fs, gr.GR_SIN_WAVE, freq2, 0.5) self.signal = gr.add_cc() - + self.head = gr.head(gr.sizeof_gr_complex, self._N) # Construct the PFB interpolator filter @@ -86,7 +86,7 @@ class pfb_top_block(gr.top_block): #self.pfb_ar.pfb.print_taps() #self.pfb.pfb.print_taps() - + # Connect the blocks self.connect(self.signal1, self.head, (self.signal,0)) self.connect(self.signal2, (self.signal,1)) @@ -99,7 +99,7 @@ class pfb_top_block(gr.top_block): self.snk2 = gr.vector_sink_c() self.connect(self.pfb, self.snk1) self.connect(self.pfb_ar, self.snk2) - + def main(): tb = pfb_top_block() @@ -114,7 +114,7 @@ def main(): fig1 = pylab.figure(1, figsize=(12,10), facecolor="w") fig2 = pylab.figure(2, figsize=(12,10), facecolor="w") fig3 = pylab.figure(3, figsize=(12,10), facecolor="w") - + Ns = 10000 Ne = 10000 @@ -133,8 +133,8 @@ def main(): X_in = 10.0*scipy.log10(abs(fftpack.fftshift(X))) f_in = scipy.arange(-fs/2.0, fs/2.0, fs/float(X_in.size)) p1_f = sp1_f.plot(f_in, X_in, "b") - sp1_f.set_xlim([min(f_in), max(f_in)+1]) - sp1_f.set_ylim([-200.0, 50.0]) + sp1_f.set_xlim([min(f_in), max(f_in)+1]) + sp1_f.set_ylim([-200.0, 50.0]) sp1_f.set_title("Input Signal", weight="bold") @@ -143,7 +143,7 @@ def main(): Ts = 1.0/fs Tmax = len(d)*Ts - + t_in = scipy.arange(0, Tmax, Ts) x_in = scipy.array(d) sp1_t = fig1.add_subplot(2, 1, 2) @@ -167,8 +167,8 @@ def main(): X_o = 10.0*scipy.log10(abs(fftpack.fftshift(X))) f_o = scipy.arange(-fs_int/2.0, fs_int/2.0, fs_int/float(X_o.size)) p2_f = sp2_f.plot(f_o, X_o, "b") - sp2_f.set_xlim([min(f_o), max(f_o)+1]) - sp2_f.set_ylim([-200.0, 50.0]) + sp2_f.set_xlim([min(f_o), max(f_o)+1]) + sp2_f.set_ylim([-200.0, 50.0]) sp2_f.set_title("Output Signal from PFB Interpolator", weight="bold") sp2_f.set_xlabel("Frequency (Hz)") @@ -200,8 +200,8 @@ def main(): X_o = 10.0*scipy.log10(abs(fftpack.fftshift(X))) f_o = scipy.arange(-fs_aint/2.0, fs_aint/2.0, fs_aint/float(X_o.size)) p3_f = sp3_f.plot(f_o, X_o, "b") - sp3_f.set_xlim([min(f_o), max(f_o)+1]) - sp3_f.set_ylim([-200.0, 50.0]) + sp3_f.set_xlim([min(f_o), max(f_o)+1]) + sp3_f.set_ylim([-200.0, 50.0]) sp3_f.set_title("Output Signal from PFB Arbitrary Resampler", weight="bold") sp3_f.set_xlabel("Frequency (Hz)") @@ -217,7 +217,7 @@ def main(): p3_f = sp3_f.plot(t_o, x_o1.real, "m-o") #p3_f = sp3_f.plot(t_o, x_o2.imag, "r-o") sp3_f.set_ylim([-2.5, 2.5]) - + sp3_f.set_title("Output Signal from PFB Arbitrary Resampler", weight="bold") sp3_f.set_xlabel("Time (s)") sp3_f.set_ylabel("Amplitude") @@ -230,4 +230,4 @@ if __name__ == "__main__": main() except KeyboardInterrupt: pass - + diff --git a/gnuradio-core/src/examples/pfb/reconstruction.py b/gnuradio-core/src/examples/pfb/reconstruction.py index c7909f7a56..59910e4d6d 100755 --- a/gnuradio-core/src/examples/pfb/reconstruction.py +++ b/gnuradio-core/src/examples/pfb/reconstruction.py @@ -36,7 +36,7 @@ def main(): # Split it up into pieces channelizer = blks2.pfb_channelizer_ccf(nchans, proto_taps, 2) - + # Put the pieces back together again syn_taps = [nchans*t for t in proto_taps] synthesizer = gr.pfb_synthesizer_ccf(nchans, syn_taps, True) @@ -48,7 +48,7 @@ def main(): # the channelizer) synthesizer.set_channel_map([ 0, 1, 2, 3, 4, 15, 16, 17, 18, 19]) - + tb = gr.top_block() tb.connect(src, mod, chan, rrc, channelizer) tb.connect(rrc, src_snk) @@ -59,14 +59,14 @@ def main(): vsnk.append(gr.vector_sink_c()) tb.connect((channelizer,i), vsnk[i]) - + tb.connect(synthesizer, snk) tb.run() - + sin = scipy.array(src_snk.data()[1000:]) sout = scipy.array(snk.data()[1000:]) - + # Plot original signal fs_in = nchans*fs f1 = pylab.figure(1, figsize=(16,12), facecolor='w') @@ -87,7 +87,7 @@ def main(): s13.set_title("Constellation") s13.set_xlim([-2, 2]) s13.set_ylim([-2, 2]) - + # Plot channels nrows = int(scipy.sqrt(nchans)) ncols = int(scipy.ceil(float(nchans)/float(nrows))) @@ -122,7 +122,7 @@ def main(): pylab.show() - + if __name__ == "__main__": try: main() diff --git a/gnuradio-core/src/examples/pfb/resampler.py b/gnuradio-core/src/examples/pfb/resampler.py index 7b296ca717..555938d281 100755 --- a/gnuradio-core/src/examples/pfb/resampler.py +++ b/gnuradio-core/src/examples/pfb/resampler.py @@ -1,24 +1,24 @@ #!/usr/bin/env python # # Copyright 2009 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 gnuradio import gr, blks2 import sys @@ -38,7 +38,7 @@ except ImportError: class mytb(gr.top_block): def __init__(self, fs_in, fs_out, fc, N=10000): gr.top_block.__init__(self) - + rerate = float(fs_out) / float(fs_in) print "Resampling from %f to %f by %f " %(fs_in, fs_out, rerate) @@ -56,7 +56,7 @@ class mytb(gr.top_block): # A resampler that just needs a resampling rate. # Filter is created for us and designed to cover # entire bandwidth of the input signal. - # An optional atten=XX rate can be used here to + # An optional atten=XX rate can be used here to # specify the out-of-band rejection (default=80). self.resamp_1 = blks2.pfb_arb_resampler_ccf(rerate) diff --git a/gnuradio-core/src/examples/pfb/synth_filter.py b/gnuradio-core/src/examples/pfb/synth_filter.py index a91edfebf8..c0f7376ec0 100755 --- a/gnuradio-core/src/examples/pfb/synth_filter.py +++ b/gnuradio-core/src/examples/pfb/synth_filter.py @@ -1,27 +1,27 @@ #!/usr/bin/env python # # Copyright 2010 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 gnuradio import gr, blks2 -import sys +import sys try: import scipy @@ -48,7 +48,7 @@ def main(): sigs.append(s) taps = gr.firdes.low_pass_2(len(freqs), fs, fs/float(nchans)/2, 100, 100) - print "Num. Taps = %d (taps per filter = %d)" % (len(taps), + print "Num. Taps = %d (taps per filter = %d)" % (len(taps), len(taps)/nchans) filtbank = gr.pfb_synthesizer_ccf(nchans, taps) @@ -60,14 +60,14 @@ def main(): for i,si in enumerate(sigs): tb.connect(si, (filtbank, i)) - + tb.run() if 1: f1 = pylab.figure(1) s1 = f1.add_subplot(1,1,1) s1.plot(snk.data()[1000:]) - + fftlen = 2048 f2 = pylab.figure(2) s2 = f2.add_subplot(1,1,1) diff --git a/gnuradio-core/src/examples/pfb/synth_to_chan.py b/gnuradio-core/src/examples/pfb/synth_to_chan.py index c6c80b2f85..18b2e7b53f 100755 --- a/gnuradio-core/src/examples/pfb/synth_to_chan.py +++ b/gnuradio-core/src/examples/pfb/synth_to_chan.py @@ -1,27 +1,27 @@ #!/usr/bin/env python # # Copyright 2010 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 gnuradio import gr, blks2 -import sys +import sys try: import scipy @@ -51,10 +51,10 @@ def main(): fmtx.append(fm) syntaps = gr.firdes.low_pass_2(len(freqs), fs, fs/float(nchans)/2, 100, 100) - print "Synthesis Num. Taps = %d (taps per filter = %d)" % (len(syntaps), + print "Synthesis Num. Taps = %d (taps per filter = %d)" % (len(syntaps), len(syntaps)/nchans) chtaps = gr.firdes.low_pass_2(len(freqs), fs, fs/float(nchans)/2, 100, 100) - print "Channelizer Num. Taps = %d (taps per filter = %d)" % (len(chtaps), + print "Channelizer Num. Taps = %d (taps per filter = %d)" % (len(chtaps), len(chtaps)/nchans) filtbank = gr.pfb_synthesizer_ccf(nchans, syntaps) channelizer = blks2.pfb_channelizer_ccf(nchans, chtaps) @@ -79,7 +79,7 @@ def main(): for i in xrange(nchans): snk.append(gr.vector_sink_c()) tb.connect((channelizer, i), snk[i]) - + tb.run() if 1: @@ -90,7 +90,7 @@ def main(): s1 = f1.add_subplot(1,1,1) s1.plot(data[10000:10200] ) s1.set_title(("Output Signal from Channel %d" % channel)) - + fftlen = 2048 winfunc = scipy.blackman #winfunc = scipy.hamming diff --git a/gnuradio-core/src/examples/tags/CMakeLists.txt b/gnuradio-core/src/examples/tags/CMakeLists.txt index 0ba1a4dd91..2d9dc20832 100644 --- a/gnuradio-core/src/examples/tags/CMakeLists.txt +++ b/gnuradio-core/src/examples/tags/CMakeLists.txt @@ -1,17 +1,17 @@ # Copyright 2011 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, diff --git a/gnuradio-core/src/examples/tags/test_file_tags.py b/gnuradio-core/src/examples/tags/test_file_tags.py index 446986cd73..135626d2c6 100755 --- a/gnuradio-core/src/examples/tags/test_file_tags.py +++ b/gnuradio-core/src/examples/tags/test_file_tags.py @@ -1,24 +1,24 @@ #!/usr/bin/env python # # Copyright 2011 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 gnuradio import gr import sys @@ -52,4 +52,4 @@ def main(): if __name__ == "__main__": main() - + diff --git a/gnuradio-core/src/examples/tags/uhd_burst_detector.py b/gnuradio-core/src/examples/tags/uhd_burst_detector.py index 7411ab06e4..512fc715d7 100755 --- a/gnuradio-core/src/examples/tags/uhd_burst_detector.py +++ b/gnuradio-core/src/examples/tags/uhd_burst_detector.py @@ -1,24 +1,24 @@ #!/usr/bin/env python # # Copyright 2011 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 gnuradio import eng_notation from gnuradio import gr @@ -39,11 +39,11 @@ class uhd_burst_detector(gr.top_block): self.gain = options.gain self.threshold = options.threshold self.trigger = options.trigger - + self.uhd_src = uhd.single_usrp_source( device_addr=self.uhd_addr, stream_args=uhd.stream_args('fc32')) - + self.uhd_src.set_samp_rate(self.samp_rate) self.uhd_src.set_center_freq(self.freq, 0) self.uhd_src.set_gain(self.gain, 0) @@ -70,7 +70,7 @@ class uhd_burst_detector(gr.top_block): # Use file sink burst tagger to capture bursts self.fsnk = gr.tagged_file_sink(gr.sizeof_gr_complex, self.samp_rate) - + ################################################## # Connections @@ -87,11 +87,11 @@ class uhd_burst_detector(gr.top_block): self.connect(self.uhd_src, self.det) self.connect(self.det, self.c2m, self.avg, self.scale, self.f2s) self.connect(self.f2s, (self.tagger, 1)) - + def set_samp_rate(self, samp_rate): self.samp_rate = samp_rate self.uhd_src_0.set_samp_rate(self.samp_rate) - + if __name__ == '__main__': parser = OptionParser(option_class=eng_option, usage="%prog: [options]") parser.add_option("-a", "--address", type="string", default="addr=192.168.10.2", @@ -109,7 +109,7 @@ if __name__ == '__main__': parser.add_option("-T", "--trigger", action="store_true", default=False, help="Use internal trigger instead of detector [default=%default]") (options, args) = parser.parse_args() - + uhd_addr = options.address tb = uhd_burst_detector(uhd_addr, options) diff --git a/gnuradio-core/src/examples/volk_benchmark/CMakeLists.txt b/gnuradio-core/src/examples/volk_benchmark/CMakeLists.txt index dfae03f83e..255d9bf5cc 100644 --- a/gnuradio-core/src/examples/volk_benchmark/CMakeLists.txt +++ b/gnuradio-core/src/examples/volk_benchmark/CMakeLists.txt @@ -1,17 +1,17 @@ # Copyright 2012 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, diff --git a/gnuradio-core/src/examples/volk_benchmark/README b/gnuradio-core/src/examples/volk_benchmark/README index 516fc15bdd..c58b40d115 100644 --- a/gnuradio-core/src/examples/volk_benchmark/README +++ b/gnuradio-core/src/examples/volk_benchmark/README @@ -221,7 +221,7 @@ variables to point to the v3.5.1 installation: And when we run the test, we use the same command line, but the GNU Radio libraries and Python files used come from v3.5.1. We also change the label to indicate the different version to store. - + ./volk_math.py -D volk_results_math.db --all -L v3_5_1 We now have a database populated with three tables for the three diff --git a/gnuradio-core/src/examples/volk_benchmark/volk_math.py b/gnuradio-core/src/examples/volk_benchmark/volk_math.py index 8bf9ed6f34..1d8bf04cc0 100755 --- a/gnuradio-core/src/examples/volk_benchmark/volk_math.py +++ b/gnuradio-core/src/examples/volk_benchmark/volk_math.py @@ -125,7 +125,7 @@ def main(): if(args.list): print "Available Tests to Run:" print "\n".join(["\t{0}: {1}".format(i,f.__name__) for i,f in enumerate(avail_tests)]) - sys.exit(0) + sys.exit(0) N = int(args.nitems) iters = args.iterations @@ -143,7 +143,7 @@ def main(): res = run_tests(avail_tests[test], N, iters) if res is not None: replace_results(conn, label, N, iters, res) - + if __name__ == "__main__": try: main() diff --git a/gnuradio-core/src/examples/volk_benchmark/volk_plot.py b/gnuradio-core/src/examples/volk_benchmark/volk_plot.py index 823dfbf641..48f9922054 100755 --- a/gnuradio-core/src/examples/volk_benchmark/volk_plot.py +++ b/gnuradio-core/src/examples/volk_benchmark/volk_plot.py @@ -29,7 +29,7 @@ def main(): default=None, metavar="table", help='Show percent difference to the given type [default: %(default)s]') args = parser.parse_args() - + # Set up global plotting properties matplotlib.rcParams['figure.subplot.bottom'] = 0.2 matplotlib.rcParams['figure.subplot.top'] = 0.95 @@ -37,7 +37,7 @@ def main(): matplotlib.rcParams['ytick.labelsize'] = 16 matplotlib.rcParams['xtick.labelsize'] = 16 matplotlib.rcParams['legend.fontsize'] = 18 - + # Get list of tables to compare conn = create_connection(args.database) tables = list_tables(conn) @@ -64,7 +64,7 @@ def main(): except ValueError: tmp_regs[-1].append(r['kernel']) - # Get only those names that are common in all tables + # Get only those names that are common in all tables name_reg = tmp_regs[0] for t in tmp_regs[1:]: name_reg = list(set(name_reg) & set(t)) @@ -97,7 +97,7 @@ def main(): norm_data.append(table_data[t][name]['min']) elif(args.plot == 'mean'): norm_data.append(table_data[t][name]['avg']) - + # Plot the results x0 = xrange(len(name_reg)) diff --git a/gnuradio-core/src/examples/volk_benchmark/volk_test_funcs.py b/gnuradio-core/src/examples/volk_benchmark/volk_test_funcs.py index 4f4e4afd36..0ce25fcc6a 100644 --- a/gnuradio-core/src/examples/volk_benchmark/volk_test_funcs.py +++ b/gnuradio-core/src/examples/volk_benchmark/volk_test_funcs.py @@ -56,7 +56,7 @@ def insert_results(conn, tablename, nitems, iters, res): ''' cols = "kernel, nitems, iters, avg, var, max, min" cmd = "INSERT INTO {0} ({1}) VALUES ('{2}', {3}, {4}, {5}, {6}, {7}, {8})".format( - tablename, cols, res["kernel"], nitems, iters, + tablename, cols, res["kernel"], nitems, iters, res["avg"], res["var"], res["max"], res["min"]) execute(conn, cmd) @@ -71,7 +71,7 @@ def list_tables(conn): c.close() return t - + def get_results(conn, tablename): ''' Gets all results in tablename. @@ -95,7 +95,7 @@ def get_results(conn, tablename): res.append(r) return res - + class helper(gr.top_block): ''' diff --git a/gnuradio-core/src/examples/volk_benchmark/volk_types.py b/gnuradio-core/src/examples/volk_benchmark/volk_types.py index 3bc5a22aec..5dac23c535 100755 --- a/gnuradio-core/src/examples/volk_benchmark/volk_types.py +++ b/gnuradio-core/src/examples/volk_benchmark/volk_types.py @@ -156,7 +156,7 @@ def main(): if(args.list): print "Available Tests to Run:" print "\n".join(["\t{0}: {1}".format(i,f.__name__) for i,f in enumerate(avail_tests)]) - sys.exit(0) + sys.exit(0) N = int(args.nitems) iters = args.iterations @@ -174,7 +174,7 @@ def main(): res = run_tests(avail_tests[test], N, iters) if res is not None: replace_results(conn, label, N, iters, res) - + if __name__ == "__main__": try: main() |