diff options
author | jcorgan <jcorgan@221aa14e-8319-0410-a670-987f0aec2ac5> | 2008-02-01 16:48:00 +0000 |
---|---|---|
committer | jcorgan <jcorgan@221aa14e-8319-0410-a670-987f0aec2ac5> | 2008-02-01 16:48:00 +0000 |
commit | 6c7ee8932b84fa5dca0c88d7d80f2efe0aa30a06 (patch) | |
tree | 49ad5bb39263b23426f91442eff20b860fa25d19 | |
parent | 42271ef69334b0b9236bdbfd8aa26c2848249d6d (diff) |
Moved gnuradio-core/src/utils/ plotting scripts into gr-utils, with some rework.
The gr_plot_data.py class installs into the gnuradio namespace as
gnuradio.plot_data, and the remainder of the scripts install into
$prefix/bin.
git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@7536 221aa14e-8319-0410-a670-987f0aec2ac5
-rw-r--r-- | gr-utils/src/python/Makefile.am | 20 | ||||
-rw-r--r-- | gr-utils/src/python/README.plot (renamed from gnuradio-core/src/utils/README) | 0 | ||||
-rwxr-xr-x | gr-utils/src/python/gr_plot_char.py (renamed from gnuradio-core/src/utils/gr_plot_char.py) | 2 | ||||
-rwxr-xr-x | gr-utils/src/python/gr_plot_const.py (renamed from gnuradio-core/src/utils/gr_plot_const.py) | 11 | ||||
-rwxr-xr-x | gr-utils/src/python/gr_plot_fft_c.py (renamed from gnuradio-core/src/utils/gr_plot_fft_c.py) | 11 | ||||
-rwxr-xr-x | gr-utils/src/python/gr_plot_fft_f.py (renamed from gnuradio-core/src/utils/gr_plot_fft_f.py) | 12 | ||||
-rwxr-xr-x | gr-utils/src/python/gr_plot_float.py (renamed from gnuradio-core/src/utils/gr_plot_float.py) | 2 | ||||
-rwxr-xr-x | gr-utils/src/python/gr_plot_int.py (renamed from gnuradio-core/src/utils/gr_plot_int.py) | 2 | ||||
-rwxr-xr-x | gr-utils/src/python/gr_plot_iq.py (renamed from gnuradio-core/src/utils/gr_plot_iq.py) | 12 | ||||
-rwxr-xr-x | gr-utils/src/python/gr_plot_short.py (renamed from gnuradio-core/src/utils/gr_plot_short.py) | 2 | ||||
-rw-r--r--[-rwxr-xr-x] | gr-utils/src/python/plot_data.py (renamed from gnuradio-core/src/utils/gr_plot_data.py) | 37 |
11 files changed, 45 insertions, 66 deletions
diff --git a/gr-utils/src/python/Makefile.am b/gr-utils/src/python/Makefile.am index 2311536361..8b190d660a 100644 --- a/gr-utils/src/python/Makefile.am +++ b/gr-utils/src/python/Makefile.am @@ -19,10 +19,26 @@ # Boston, MA 02110-1301, USA. # +include $(top_srcdir)/Makefile.common + EXTRA_DIST = \ - $(bin_SCRIPTS) + $(bin_SCRIPTS) \ + README.plot + +ourpythondir = $(grpythondir) + +ourpython_PYTHON = \ + plot_data.py bin_SCRIPTS = \ + gr_plot_char.py \ + gr_plot_const.py \ + gr_plot_fft_c.py \ + gr_plot_fft_f.py \ + gr_plot_float.py \ + gr_plot_int.py \ + gr_plot_iq.py \ + gr_plot_short.py \ usrp_fft.py \ usrp_oscope.py \ usrp_print_db.py \ @@ -31,3 +47,5 @@ bin_SCRIPTS = \ usrp_siggen.py \ usrp_test_counting.py \ usrp_test_loopback.py + +MOSTLYCLEANFILES = *~ *.pyc diff --git a/gnuradio-core/src/utils/README b/gr-utils/src/python/README.plot index 0c4657ba9d..0c4657ba9d 100644 --- a/gnuradio-core/src/utils/README +++ b/gr-utils/src/python/README.plot diff --git a/gnuradio-core/src/utils/gr_plot_char.py b/gr-utils/src/python/gr_plot_char.py index 71ff4499ae..87a323c9c9 100755 --- a/gnuradio-core/src/utils/gr_plot_char.py +++ b/gr-utils/src/python/gr_plot_char.py @@ -27,7 +27,7 @@ except ImportError: raise SystemExit, 1 from optparse import OptionParser -from gr_plot_data import plot_data +from gnuradio.plot_data import plot_data def main(): usage="%prog: [options] input_filenames" diff --git a/gnuradio-core/src/utils/gr_plot_const.py b/gr-utils/src/python/gr_plot_const.py index 1503363bd5..d9a9daabf9 100755 --- a/gnuradio-core/src/utils/gr_plot_const.py +++ b/gr-utils/src/python/gr_plot_const.py @@ -171,13 +171,12 @@ class draw_constellation: self.update_plots() - -#FIXME: there must be a way to do this with a Python builtin def find(item_in, list_search): - for l in list_search: - if item_in == l: - return True - return False + try: + return list_search.index(item_in) != None + except ValueError: + return False + def main(): usage="%prog: [options] input_filename" diff --git a/gnuradio-core/src/utils/gr_plot_fft_c.py b/gr-utils/src/python/gr_plot_fft_c.py index 702840401c..b7b802fd7d 100755 --- a/gnuradio-core/src/utils/gr_plot_fft_c.py +++ b/gr-utils/src/python/gr_plot_fft_c.py @@ -195,14 +195,11 @@ class draw_fft_c: self.get_data() self.update_plots() - - -#FIXME: there must be a way to do this with a Python builtin def find(item_in, list_search): - for l in list_search: - if item_in == l: - return True - return False + try: + return list_search.index(item_in) != None + except ValueError: + return False def main(): usage="%prog: [options] input_filename" diff --git a/gnuradio-core/src/utils/gr_plot_fft_f.py b/gr-utils/src/python/gr_plot_fft_f.py index bb16529140..8f545c5896 100755 --- a/gnuradio-core/src/utils/gr_plot_fft_f.py +++ b/gr-utils/src/python/gr_plot_fft_f.py @@ -198,14 +198,12 @@ class draw_fft_f: self.update_plots() - -#FIXME: there must be a way to do this with a Python builtin def find(item_in, list_search): - for l in list_search: - if item_in == l: - return True - return False - + try: + return list_search.index(item_in) != None + except ValueError: + return False + def main(): usage="%prog: [options] input_filename" description = "Takes a GNU Radio floating point binary file and displays the sample data versus time as well as the frequency domain (FFT) plot. The y-axis values are plotted assuming volts as the amplitude of the I&Q streams and converted into dBm in the frequency domain (the 1/N power adjustment out of the FFT is performed internally). The script plots a certain block of data at a time, specified on the command line as -B or --block. This value defaults to 1000. The start position in the file can be set by specifying -s or --start and defaults to 0 (the start of the file). By default, the system assumes a sample rate of 1, so in time, each sample is plotted versus the sample number. To set a true time and frequency axis, set the sample rate (-R or --sample-rate) to the sample rate used when capturing the samples." diff --git a/gnuradio-core/src/utils/gr_plot_float.py b/gr-utils/src/python/gr_plot_float.py index 248a84b85a..e5c22a3158 100755 --- a/gnuradio-core/src/utils/gr_plot_float.py +++ b/gr-utils/src/python/gr_plot_float.py @@ -27,7 +27,7 @@ except ImportError: raise SystemExit, 1 from optparse import OptionParser -from gr_plot_data import plot_data +from gnuradio.plot_data import plot_data def main(): usage="%prog: [options] input_filenames" diff --git a/gnuradio-core/src/utils/gr_plot_int.py b/gr-utils/src/python/gr_plot_int.py index 86ecbce7d7..b44d4360af 100755 --- a/gnuradio-core/src/utils/gr_plot_int.py +++ b/gr-utils/src/python/gr_plot_int.py @@ -27,7 +27,7 @@ except ImportError: raise SystemExit, 1 from optparse import OptionParser -from gr_plot_data import plot_data +from gnuradio.plot_data import plot_data def main(): usage="%prog: [options] input_filenames" diff --git a/gnuradio-core/src/utils/gr_plot_iq.py b/gr-utils/src/python/gr_plot_iq.py index f1f1c10526..2a4142a815 100755 --- a/gnuradio-core/src/utils/gr_plot_iq.py +++ b/gr-utils/src/python/gr_plot_iq.py @@ -143,15 +143,13 @@ class draw_fft: self.get_data() self.update_plots() - -#FIXME: there must be a way to do this with a Python builtin def find(item_in, list_search): - for l in list_search: - if item_in == l: - return True - return False - + try: + return list_search.index(item_in) != None + except ValueError: + return False + def main(): usage="%prog: [options] input_filename" description = "Takes a GNU Radio complex binary file and displays the I&Q data versus time. You can set the block size to specify how many points to read in at a time and the start position in the file. By default, the system assumes a sample rate of 1, so in time, each sample is plotted versus the sample number. To set a true time axis, set the sample rate (-R or --sample-rate) to the sample rate used when capturing the samples." diff --git a/gnuradio-core/src/utils/gr_plot_short.py b/gr-utils/src/python/gr_plot_short.py index 399c0aab9c..3466e0b7db 100755 --- a/gnuradio-core/src/utils/gr_plot_short.py +++ b/gr-utils/src/python/gr_plot_short.py @@ -27,7 +27,7 @@ except ImportError: raise SystemExit, 1 from optparse import OptionParser -from gr_plot_data import plot_data +from gnuradio.plot_data import plot_data def main(): usage="%prog: [options] input_filenames" diff --git a/gnuradio-core/src/utils/gr_plot_data.py b/gr-utils/src/python/plot_data.py index abc210c08a..7c79e17143 100755..100644 --- a/gnuradio-core/src/utils/gr_plot_data.py +++ b/gr-utils/src/python/plot_data.py @@ -1,4 +1,3 @@ -#!/usr/bin/env python # # Copyright 2007,2008 Free Software Foundation, Inc. # @@ -161,39 +160,9 @@ class plot_data: hf.seek(-hf.tell(),1) self.update_plots() - -#FIXME: there must be a way to do this with a Python builtin def find(item_in, list_search): - for l in list_search: - if item_in == l: - return True - return False - -def main(): - usage="%prog: [options] input_filenames" - description = "This is just a test program for this class. It should really be called by gr_plot_<datatype>.py for a specific type of file data (float, int, byte, etc.)." - - parser = OptionParser(conflict_handler="resolve", usage=usage, description=description) - parser.add_option("-B", "--block", type="int", default=1000, - help="Specify the block size [default=%default]") - parser.add_option("-s", "--start", type="int", default=0, - help="Specify where to start in the file [default=%default]") - parser.add_option("-R", "--sample-rate", type="float", default=1.0, - help="Set the sampler rate of the data [default=%default]") - - (options, args) = parser.parse_args () - if len(args) < 1: - parser.print_help() - raise SystemExit, 1 - filenames = args - - datatype=scipy.float32 - dc = plot_data(datatype, filenames, options) - -if __name__ == "__main__": try: - main() - except KeyboardInterrupt: - pass - + return list_search.index(item_in) != None + except ValueError: + return False |