Houston, we have a trunk.
[debian/gnuradio] / gr-radar / src / python / complex_to_short.py
1 #!/usr/bin/env python
2
3 from gnuradio import gr, gru, eng_notation, optfir
4 from gnuradio.eng_option import eng_option
5 from optparse import OptionParser
6 import os.path
7 import re
8
9 class my_graph(gr.flow_graph):
10     def __init__(self):
11         gr.flow_graph.__init__(self)
12
13         usage="%prog: [options] input_file output_file"
14         parser = OptionParser (option_class=eng_option, usage=usage)
15         (options, args) = parser.parse_args()
16         if len(args) != 2:
17             parser.print_help()
18             raise SystemExit, 1
19
20         input_filename = args[0]
21         output_filename = args[1]
22
23         inf = gr.file_source(gr.sizeof_gr_complex, input_filename)
24         c2s = gr.complex_to_interleaved_short()
25         outf = gr.file_sink(gr.sizeof_short, output_filename)
26         self.connect(inf, c2s, outf)
27
28
29 if __name__ == '__main__':
30     try:
31         my_graph().run()
32     except KeyboardInterrupt:
33         pass