diff options
author | anastas <anastas@221aa14e-8319-0410-a670-987f0aec2ac5> | 2006-08-09 16:58:13 +0000 |
---|---|---|
committer | anastas <anastas@221aa14e-8319-0410-a670-987f0aec2ac5> | 2006-08-09 16:58:13 +0000 |
commit | 30f2121800afe283879a3369a7462d699a77af50 (patch) | |
tree | afb84215ccfaf94f020208f228857f985a660715 /gr-trellis/doc/test_tcm.py | |
parent | 943fc694d03a23906d1d537cd50259905004a77c (diff) |
Improved documentation files\n
git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@3230 221aa14e-8319-0410-a670-987f0aec2ac5
Diffstat (limited to 'gr-trellis/doc/test_tcm.py')
-rw-r--r-- | gr-trellis/doc/test_tcm.py | 32 |
1 files changed, 2 insertions, 30 deletions
diff --git a/gr-trellis/doc/test_tcm.py b/gr-trellis/doc/test_tcm.py index 02d1e6c5c1..bf93a421f8 100644 --- a/gr-trellis/doc/test_tcm.py +++ b/gr-trellis/doc/test_tcm.py @@ -12,67 +12,42 @@ import fsm_utils def run_test (f,Kb,bitspersymbol,K,dimensionality,constellation,N0,seed): fg = gr.flow_graph () - # TX - #packet = [0]*Kb - #for i in range(Kb-1*16): # last 16 bits = 0 to drive the final state to 0 - #packet[i] = random.randint(0, 1) # random 0s and 1s - #src = gr.vector_source_s(packet,False) src = gr.lfsr_32k_source_s() src_head = gr.head (gr.sizeof_short,Kb/16) # packet size in shorts - #b2s = gr.unpacked_to_packed_ss(1,gr.GR_MSB_FIRST) # pack bits in shorts s2fsmi = gr.packed_to_unpacked_ss(bitspersymbol,gr.GR_MSB_FIRST) # unpack shorts to symbols compatible with the FSM input cardinality enc = trellis.encoder_ss(f,0) # initial state = 0 mod = gr.chunks_to_symbols_sf(constellation,dimensionality) - # CHANNEL add = gr.add_ff() noise = gr.noise_source_f(gr.GR_GAUSSIAN,math.sqrt(N0/2),seed) - # RX metrics = trellis.metrics_f(f.O(),dimensionality,constellation,trellis.TRELLIS_EUCLIDEAN) # data preprocessing to generate metrics for Viterbi 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.check_lfsr_32k_s(); - fg.connect (src,src_head,s2fsmi,enc,mod) - #fg.connect (src,b2s,s2fsmi,enc,mod) fg.connect (mod,(add,0)) fg.connect (noise,(add,1)) fg.connect (add,metrics) fg.connect (metrics,va,fsmi2s,dst) - #fg.connect (metrics,va,fsmi2s,s2b,dst) - fg.run() # A bit of cheating: run the program once and print the - # final encoder state.. + # final encoder state. # Then put it as the last argument in the viterbi block #print "final state = " , enc.ST() ntotal = dst.ntotal () nright = dst.nright () runlength = dst.runlength () - #ntotal = len(packet) - #if len(dst.data()) != ntotal: - #print "Error: not enough data\n" - #nright = 0; - #for i in range(ntotal): - #if packet[i]==dst.data()[i]: - #nright=nright+1 - #else: - #print "Error in ", i return (ntotal,ntotal-nright) - - def main(args): nargs = len (args) if nargs == 3: @@ -101,8 +76,6 @@ def main(args): Es = Es / (len(constellation)/dimensionality) N0=Es/pow(10.0,esn0_db/10.0); # noise variance - - tot_s=0 terr_s=0 for i in range(rep): @@ -111,10 +84,9 @@ def main(args): terr_s=terr_s+e if (i%100==0): print i,s,e,tot_s,terr_s, '%e' % ((1.0*terr_s)/tot_s) - # estimate of the (short or bit) error rate + # estimate of the (short) error rate print tot_s,terr_s, '%e' % ((1.0*terr_s)/tot_s) if __name__ == '__main__': main (sys.argv[1:]) - |