commit-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Commit-gnuradio] [gnuradio] 06/13: utils: gr_plot_char - replace Option


From: git
Subject: [Commit-gnuradio] [gnuradio] 06/13: utils: gr_plot_char - replace OptionParser by ArgumentParser
Date: Mon, 1 Aug 2016 21:58:58 +0000 (UTC)

This is an automated email from the git hooks/post-receive script.

jcorgan pushed a commit to branch next
in repository gnuradio.

commit 208dc8c1553d3a43098b5868642744ceb4e548a6
Author: Jiří Pinkava <address@hidden>
Date:   Sun Jun 26 13:04:42 2016 +0200

    utils: gr_plot_char - replace OptionParser by ArgumentParser
---
 gr-utils/python/utils/gr_plot_char | 33 +++++++++++++++------------------
 1 file changed, 15 insertions(+), 18 deletions(-)

diff --git a/gr-utils/python/utils/gr_plot_char 
b/gr-utils/python/utils/gr_plot_char
index a2b93a6..ee64455 100755
--- a/gr-utils/python/utils/gr_plot_char
+++ b/gr-utils/python/utils/gr_plot_char
@@ -26,29 +26,26 @@ except ImportError:
     print "Please install SciPy to run this script (http://www.scipy.org/)"
     raise SystemExit, 1
 
-from optparse import OptionParser
+from argparse import ArgumentParser
 from gnuradio.plot_data import plot_data
 
 def main():
-    usage="%prog: [options] input_filenames"
     description = "Takes a GNU Radio byte/char binary file and displays the 
samples 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."
 
-    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.int8
-    dc = plot_data(datatype, filenames, options)
+    parser = ArgumentParser(conflict_handler="resolve", 
description=description)
+    parser.add_argument("-B", "--block", type=int, default=1000,
+                      help="Specify the block size [default=%(default)r]")
+    parser.add_argument("-s", "--start", type=int, default=0,
+                      help="Specify where to start in the file 
[default=%(default)r]")
+    parser.add_argument("-R", "--sample-rate", type=float, default=1.0,
+                      help="Set the sampler rate of the data 
[default=%(default)r]")
+    parser.add_argument("files", metavar="FILE", nargs="+",
+                      help="Input file with complex samples")
+
+    args = parser.parse_args()
+
+    datatype = scipy.int8
+    dc = plot_data(datatype, args.files, args)
 
 if __name__ == "__main__":
     try:



reply via email to

[Prev in Thread] Current Thread [Next in Thread]