summaryrefslogtreecommitdiff
path: root/gr-trellis/src/examples/test_tcm_parallel.py
diff options
context:
space:
mode:
Diffstat (limited to 'gr-trellis/src/examples/test_tcm_parallel.py')
-rwxr-xr-xgr-trellis/src/examples/test_tcm_parallel.py29
1 files changed, 18 insertions, 11 deletions
diff --git a/gr-trellis/src/examples/test_tcm_parallel.py b/gr-trellis/src/examples/test_tcm_parallel.py
index 8e2f5a230..94761fd01 100755
--- a/gr-trellis/src/examples/test_tcm_parallel.py
+++ b/gr-trellis/src/examples/test_tcm_parallel.py
@@ -1,12 +1,14 @@
#!/usr/bin/env python
from gnuradio import gr
-from gnuradio import audio
from gnuradio import trellis
from gnuradio import eng_notation
import math
import sys
import fsm_utils
+from gnuradio.eng_option import eng_option
+from optparse import OptionParser
+
def run_test (f,Kb,bitspersymbol,K,dimensionality,constellation,N0,seed,P):
tb = gr.top_block ()
@@ -58,15 +60,20 @@ def run_test (f,Kb,bitspersymbol,K,dimensionality,constellation,N0,seed,P):
-def main(args):
- nargs = len (args)
- if nargs == 3:
- fname=args[0]
- esn0_db=float(args[1]) # Es/No in dB
- rep=int(args[2]) # number of times the experiment is run to collect enough errors
- else:
- sys.stderr.write ('usage: test_tcm.py fsm_fname Es/No_db repetitions\n')
- sys.exit (1)
+def main():
+ parser = OptionParser(option_class=eng_option)
+ parser.add_option("-f", "--fsm_file", type="string", default="fsm_files/awgn1o2_4.fsm", help="Filename containing the fsm specification, e.g. -f fsm_files/awgn1o2_4.fsm (default=fsm_files/awgn1o2_4.fsm)")
+ parser.add_option("-e", "--esn0", type="eng_float", default=10.0, help="Symbol energy to noise PSD level ratio in dB, e.g., -e 10.0 (default=10.0)")
+ parser.add_option("-r", "--repetitions", type="int", default=100, help="Number of packets to be generated for the simulation, e.g., -r 100 (default=100)")
+
+ (options, args) = parser.parse_args ()
+ if len(args) != 0:
+ parser.print_help()
+ raise SystemExit, 1
+
+ fname=options.fsm_file
+ esn0_db=float(options.esn0)
+ rep=int(options.repetitions)
# system parameters
f=trellis.fsm(fname) # get the FSM specification from a file
@@ -102,5 +109,5 @@ def main(args):
if __name__ == '__main__':
- main (sys.argv[1:])
+ main()