diff options
Diffstat (limited to 'gr-trellis/src/examples/python/test_tcm.py')
-rwxr-xr-x | gr-trellis/src/examples/python/test_tcm.py | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/gr-trellis/src/examples/python/test_tcm.py b/gr-trellis/src/examples/python/test_tcm.py index 62fd5135e..a7d6a02d0 100755 --- a/gr-trellis/src/examples/python/test_tcm.py +++ b/gr-trellis/src/examples/python/test_tcm.py @@ -35,9 +35,9 @@ def run_test (f,Kb,bitspersymbol,K,dimensionality,constellation,N0,seed): va = trellis.viterbi_s(f,K,0,-1) # Put -1 if the Initial/Final states are not set. fsmi2s = gr.unpacked_to_packed_ss(bitspersymbol,gr.GR_MSB_FIRST) # pack FSM input symbols to shorts #s2b = gr.packed_to_unpacked_ss(1,gr.GR_MSB_FIRST) # unpack shorts to bits - #dst = gr.vector_sink_s(); + #dst = gr.vector_sink_s(); dst = gr.check_lfsr_32k_s() - + tb.connect (src,src_head,s2fsmi,enc,mod) #tb.connect (src,b2s,s2fsmi,enc,mod) @@ -46,11 +46,11 @@ def run_test (f,Kb,bitspersymbol,K,dimensionality,constellation,N0,seed): tb.connect (add,metrics) tb.connect (metrics,va,fsmi2s,dst) #tb.connect (metrics,va,fsmi2s,s2b,dst) - + tb.run() - - # A bit of cheating: run the program once and print the + + # A bit of cheating: run the program once and print the # final encoder state.. # Then put it as the last argument in the viterbi block #print "final state = " , enc.ST() @@ -90,13 +90,13 @@ def main(): # system parameters f=trellis.fsm(fname) # get the FSM specification from a file # alternatively you can specify the fsm from its generator matrix - #f=trellis.fsm(1,2,[5,7]) + #f=trellis.fsm(1,2,[5,7]) Kb=1024*16 # packet size in bits (make it multiple of 16 so it can be packed in a short) bitspersymbol = int(round(math.log(f.I())/math.log(2))) # bits per FSM input symbol K=Kb/bitspersymbol # packet size in trellis steps modulation = fsm_utils.psk4 # see fsm_utlis.py for available predefined modulations dimensionality = modulation[0] - constellation = modulation[1] + constellation = modulation[1] if len(constellation)/dimensionality != f.O(): sys.stderr.write ('Incompatible FSM output cardinality and modulation size.\n') sys.exit (1) @@ -106,7 +106,7 @@ def main(): Es = Es + constellation[i]**2 Es = Es / (len(constellation)/dimensionality) N0=Es/pow(10.0,esn0_db/10.0); # calculate noise variance - + tot_s=0 # total number of transmitted shorts terr_s=0 # total number of shorts in error terr_p=0 # total number of packets in error |