summaryrefslogtreecommitdiff
path: root/gr-trellis/doc/test_tcm.py.xml
diff options
context:
space:
mode:
authorTom Rondeau2012-04-13 18:36:53 -0400
committerTom Rondeau2012-04-13 18:36:53 -0400
commitf919f9dcbb54a08e6e26d6c229ce92fb784fa1b2 (patch)
tree7e846386b9eb1676f9a93fc4a1e55916b9accc97 /gr-trellis/doc/test_tcm.py.xml
parent6a1e9783fec6ed827f49db27c171591d30f32933 (diff)
downloadgnuradio-f919f9dcbb54a08e6e26d6c229ce92fb784fa1b2.tar.gz
gnuradio-f919f9dcbb54a08e6e26d6c229ce92fb784fa1b2.tar.bz2
gnuradio-f919f9dcbb54a08e6e26d6c229ce92fb784fa1b2.zip
Removed whitespace and added dtools/bin/remove-whitespace as a tool to do this in the future.
The sed script was provided by Moritz Fischer.
Diffstat (limited to 'gr-trellis/doc/test_tcm.py.xml')
-rw-r--r--gr-trellis/doc/test_tcm.py.xml36
1 files changed, 18 insertions, 18 deletions
diff --git a/gr-trellis/doc/test_tcm.py.xml b/gr-trellis/doc/test_tcm.py.xml
index b957f682d..b5074cb2f 100644
--- a/gr-trellis/doc/test_tcm.py.xml
+++ b/gr-trellis/doc/test_tcm.py.xml
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<programlisting>
1 #!/usr/bin/env python
- 2
+ 2
3 from gnuradio import gr
4 from gnuradio import audio
5 from gnuradio import trellis
@@ -10,46 +10,46 @@
8 import sys
9 import random
10 import fsm_utils
- 11
+ 11
12 def run_test (f,Kb,bitspersymbol,K,dimensionality,constellation,N0,seed):
13 tb = gr.top_block ()
- 14
+ 14
15 # TX
16 src = gr.lfsr_32k_source_s()
17 src_head = gr.head (gr.sizeof_short,Kb/16) # packet size in shorts
18 s2fsmi = gr.packed_to_unpacked_ss(bitspersymbol,gr.GR_MSB_FIRST) # unpack shorts to symbols compatible with the FSM input cardinality
19 enc = trellis.encoder_ss(f,0) # initial state = 0
20 mod = gr.chunks_to_symbols_sf(constellation,dimensionality)
- 21
+ 21
22 # CHANNEL
23 add = gr.add_ff()
24 noise = gr.noise_source_f(gr.GR_GAUSSIAN,math.sqrt(N0/2),seed)
- 25
+ 25
26 # RX
27 metrics = trellis.metrics_f(f.O(),dimensionality,constellation,trellis.TRELLIS_EUCLIDEAN) # data preprocessing to generate metrics for Viterbi
28 va = trellis.viterbi_s(f,K,0,-1) # Put -1 if the Initial/Final states are not set.
29 fsmi2s = gr.unpacked_to_packed_ss(bitspersymbol,gr.GR_MSB_FIRST) # pack FSM input symbols to shorts
- 30 dst = gr.check_lfsr_32k_s();
- 31
+ 30 dst = gr.check_lfsr_32k_s();
+ 31
32 tb.connect (src,src_head,s2fsmi,enc,mod)
33 tb.connect (mod,(add,0))
34 tb.connect (noise,(add,1))
35 tb.connect (add,metrics)
36 tb.connect (metrics,va,fsmi2s,dst)
- 37
+ 37
38 tb.run()
- 39
- 40 # A bit of cheating: run the program once and print the
+ 39
+ 40 # A bit of cheating: run the program once and print the
41 # final encoder state.
42 # Then put it as the last argument in the viterbi block
43 #print &quot;final state = &quot; , enc.ST()
- 44
+ 44
45 ntotal = dst.ntotal ()
46 nright = dst.nright ()
47 runlength = dst.runlength ()
48 return (ntotal,ntotal-nright)
- 49
- 50
+ 49
+ 50
51 def main(args):
52 nargs = len (args)
53 if nargs == 3:
@@ -59,7 +59,7 @@
57 else:
58 sys.stderr.write (&apos;usage: test_tcm.py fsm_fname Es/No_db repetitions\n&apos;)
59 sys.exit (1)
- 60
+ 60
61 # system parameters
62 f=trellis.fsm(fname) # get the FSM specification from a file
63 Kb=1024*16 # packet size in bits (make it multiple of 16 so it can be packed in a short)
@@ -67,7 +67,7 @@
65 K=Kb/bitspersymbol # packet size in trellis steps
66 modulation = fsm_utils.psk4 # see fsm_utlis.py for available predefined modulations
67 dimensionality = modulation[0]
- 68 constellation = modulation[1]
+ 68 constellation = modulation[1]
69 if len(constellation)/dimensionality != f.O():
70 sys.stderr.write (&apos;Incompatible FSM output cardinality and modulation size.\n&apos;)
71 sys.exit (1)
@@ -77,7 +77,7 @@
75 Es = Es + constellation[i]**2
76 Es = Es / (len(constellation)/dimensionality)
77 N0=Es/pow(10.0,esn0_db/10.0); # noise variance
- 78
+ 78
79 tot_s=0
80 terr_s=0
81 for i in range(rep):
@@ -88,8 +88,8 @@
86 print i,s,e,tot_s,terr_s, &apos;%e&apos; % ((1.0*terr_s)/tot_s)
87 # estimate of the (short) error rate
88 print tot_s,terr_s, &apos;%e&apos; % ((1.0*terr_s)/tot_s)
- 89
- 90
+ 89
+ 90
91 if __name__ == &apos;__main__&apos;:
92 main (sys.argv[1:])
</programlisting>