diff options
Diffstat (limited to 'gr-shd/apps')
-rw-r--r-- | gr-shd/apps/.gitignore | 3 | ||||
-rw-r--r-- | gr-shd/apps/CMakeLists.txt | 6 | ||||
-rw-r--r-- | gr-shd/apps/Makefile.am | 33 | ||||
-rwxr-xr-x | gr-shd/apps/shd_fft (renamed from gr-shd/apps/shd_fft.py) | 38 | ||||
-rwxr-xr-x | gr-shd/apps/shd_rx_cfile (renamed from gr-shd/apps/shd_rx_cfile.py) | 24 | ||||
-rwxr-xr-x | gr-shd/apps/shd_siggen (renamed from gr-shd/apps/shd_siggen.py) | 20 |
6 files changed, 44 insertions, 80 deletions
diff --git a/gr-shd/apps/.gitignore b/gr-shd/apps/.gitignore deleted file mode 100644 index 22a4e7292..000000000 --- a/gr-shd/apps/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -Makefile -Makefile.in - diff --git a/gr-shd/apps/CMakeLists.txt b/gr-shd/apps/CMakeLists.txt index 3930abb57..d36121da1 100644 --- a/gr-shd/apps/CMakeLists.txt +++ b/gr-shd/apps/CMakeLists.txt @@ -24,9 +24,9 @@ include(GrPython) ######################################################################## GR_PYTHON_INSTALL( PROGRAMS - shd_fft.py - shd_rx_cfile.py - shd_siggen.py + shd_fft + shd_rx_cfile + shd_siggen DESTINATION ${GR_RUNTIME_DIR} COMPONENT "shd_python" ) diff --git a/gr-shd/apps/Makefile.am b/gr-shd/apps/Makefile.am deleted file mode 100644 index ac50e892e..000000000 --- a/gr-shd/apps/Makefile.am +++ /dev/null @@ -1,33 +0,0 @@ -# -# 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. -# - -include $(top_srcdir)/Makefile.common - -EXTRA_DIST += \ - $(bin_SCRIPTS) - -ourpythondir = $(grpythondir) - -bin_SCRIPTS = \ - shd_fft.py \ - shd_rx_cfile.py \ - shd_siggen.py - diff --git a/gr-shd/apps/shd_fft.py b/gr-shd/apps/shd_fft index 46832784d..60d07e55e 100755 --- a/gr-shd/apps/shd_fft.py +++ b/gr-shd/apps/shd_fft @@ -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, gru from gnuradio import shd @@ -37,7 +37,7 @@ class app_top_block(stdgui2.std_top_block): self.frame = frame self.panel = panel - + parser = OptionParser(option_class=eng_option) parser.add_option("-a", "--address", type="string", default="type=xmini", @@ -66,7 +66,7 @@ class app_top_block(stdgui2.std_top_block): sys.exit(1) self.options = options self.show_debug_info = True - + self.src = shd.smini_source(device_addr=options.address, io_type=shd.io_type.COMPLEX_FLOAT32, num_channels=1) @@ -88,7 +88,7 @@ class app_top_block(stdgui2.std_top_block): else: self.scope = fftsink2.fft_sink_c (panel, fft_size=options.fft_size, - sample_rate=input_rate, + sample_rate=input_rate, ref_scale=options.ref_scale, ref_level=20.0, y_divs = 12, @@ -100,7 +100,7 @@ class app_top_block(stdgui2.std_top_block): self._build_gui(vbox) self._setup_events() - + # set initial values if options.gain is None: @@ -112,7 +112,7 @@ class app_top_block(stdgui2.std_top_block): # if no freq was specified, use the mid-point r = self.src.get_freq_range() options.freq = float(r.start()+r.stop())/2 - + self.set_gain(options.gain) if self.show_debug_info: @@ -137,9 +137,9 @@ class app_top_block(stdgui2.std_top_block): def _form_set_freq(kv): return self.set_freq(kv['freq']) - + vbox.Add(self.scope.win, 10, wx.EXPAND) - + # add control area at the bottom self.myform = myform = form.form() hbox = wx.BoxSizer(wx.HORIZONTAL) @@ -171,7 +171,7 @@ class app_top_block(stdgui2.std_top_block): # FIXME figure out how to have this be a subpanel that is always # created, but has its visibility controlled by foo.Show(True/False) - + def _form_set_samp_rate(kv): return self.set_samp_rate(kv['samprate']) @@ -204,7 +204,7 @@ class app_top_block(stdgui2.std_top_block): hbox.Add((5,0), 0) vbox.Add(hbox, 0, wx.EXPAND) - + def set_freq(self, target_freq): """ Set the center frequency we're interested in. @@ -244,12 +244,12 @@ class app_top_block(stdgui2.std_top_block): self.myform['fs@gbe'].set_value(input_rate) # shd set_samp_rate never fails; always falls back to closest requested. - return True + return True def _setup_events(self): if not self.options.waterfall and not self.options.oscilloscope: self.scope.win.Bind(wx.EVT_LEFT_DCLICK, self.evt_left_dclick) - + def evt_left_dclick(self, event): (ux, uy) = self.scope.win.GetXY(event) if event.CmdDown(): @@ -265,13 +265,13 @@ class app_top_block(stdgui2.std_top_block): (freq, pwr) = points[ind] target_freq = freq/self.scope.win._scale_factor print ind, freq, pwr - self.set_freq(target_freq) + self.set_freq(target_freq) else: # Re-center on clicked frequency target_freq = ux/self.scope.win._scale_factor self.set_freq(target_freq) - - + + def main (): app = stdgui2.stdapp(app_top_block, "SHD FFT", nstatus=1) app.MainLoop() diff --git a/gr-shd/apps/shd_rx_cfile.py b/gr-shd/apps/shd_rx_cfile index 007bc809f..5b4178cf7 100755 --- a/gr-shd/apps/shd_rx_cfile.py +++ b/gr-shd/apps/shd_rx_cfile @@ -1,28 +1,28 @@ #!/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. -# +# """ Read samples from a SHD device and write to file formatted as binary -outputs single precision complex float values or complex short values +outputs single precision complex float values or complex short values (interleaved 16 bit signed short integers). """ @@ -50,7 +50,7 @@ class rx_cfile_block(gr.top_block): io_type=shd.io_type.COMPLEX_FLOAT32, num_channels=1) self._sink = gr.file_sink(gr.sizeof_gr_complex, filename) - + # Set receiver sample rate self._src.set_samp_rate(options.samp_rate) @@ -90,7 +90,7 @@ class rx_cfile_block(gr.top_block): self.connect(self._src, self._head, self._sink) input_rate = self._src.get_samp_rate() - + if options.verbose: print "Address:", options.address print "Rx gain:", options.gain @@ -106,7 +106,7 @@ class rx_cfile_block(gr.top_block): else: print "Writing 32-bit complex floats" print "Output filename:", filename - + def get_options(): usage="%prog: [options] output_filename" parser = OptionParser(option_class=eng_option, usage=usage) @@ -133,19 +133,19 @@ def get_options(): if len(args) != 1: parser.print_help() raise SystemExit, 1 - + if options.freq is None: parser.print_help() sys.stderr.write('You must specify the frequency with -f FREQ\n'); raise SystemExit, 1 - + return (options, args[0]) if __name__ == '__main__': (options, filename) = get_options() tb = rx_cfile_block(options, filename) - + try: tb.run() except KeyboardInterrupt: diff --git a/gr-shd/apps/shd_siggen.py b/gr-shd/apps/shd_siggen index 112eeea15..9629d80d2 100755 --- a/gr-shd/apps/shd_siggen.py +++ b/gr-shd/apps/shd_siggen @@ -1,28 +1,28 @@ #!/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. -# +# """ Read samples from a SHD device and write to file formatted as binary -outputs single precision complex float values or complex short values +outputs single precision complex float values or complex short values (interleaved 16 bit signed short integers). """ @@ -74,14 +74,14 @@ class shd_siggen(gr.top_block): # Create head block if needed and wire it up self.connect(self._src, self._snk) input_rate = self._snk.get_samp_rate() - + if options.verbose: print "Address:", options.address print "Rx gain:", options.gain print "Rx baseband frequency:", n2s(tr.actual_rf_freq) print "Rx DDC frequency:", n2s(tr.actual_dsp_freq) print "Rx Sample Rate:", n2s(input_rate) - + def get_options(): usage="%prog: [options]" parser = OptionParser(option_class=eng_option, usage=usage) @@ -106,14 +106,14 @@ def get_options(): parser.print_help() sys.stderr.write('You must specify the frequency with -f FREQ\n'); raise SystemExit, 1 - + return (options) if __name__ == '__main__': options = get_options() tb = shd_siggen(options) - + try: tb.run() except KeyboardInterrupt: |