Fix svn:ignore property
[debian/gnuradio] / gnuradio-examples / python / channel-coding / test_tcm.py
index 0ba2e3c8ef08d63cb5f8e5f151fe9be879eb621e..f2250155800509bef4825a492dbb9db8fea114be 100755 (executable)
@@ -83,7 +83,7 @@ def main(args):
 
     # system parameters
     f=trellis.fsm(fname) # get the FSM specification from a file
-    Kb=1*16  # packet size in bits (make it multiple of 16 so it can be packed in a short)
+    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
@@ -101,14 +101,17 @@ def main(args):
     
     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
     for i in range(rep):
         (s,e)=run_test(f,Kb,bitspersymbol,K,dimensionality,constellation,N0,-long(666+i)) # run experiment with different seed to get different noise realizations
         tot_s=tot_s+s
         terr_s=terr_s+e
-        if (i%100==0) & (i>0): # display progress
-            print i,s,e,tot_s,terr_s, '%e' % ((1.0*terr_s)/tot_s)
+        terr_p=terr_p+(terr_s!=0)
+        if ((i+1)%100==0) : # display progress
+            print i+1,terr_p, '%.2e' % ((1.0*terr_p)/(i+1)),tot_s,terr_s, '%.2e' % ((1.0*terr_s)/tot_s)
     # estimate of the (short or bit) error rate
-    print tot_s,terr_s, '%e' % ((1.0*terr_s)/tot_s)
+    print rep,terr_p, '%.2e' % ((1.0*terr_p)/(i+1)),tot_s,terr_s, '%.2e' % ((1.0*terr_s)/tot_s)
+
 
 
 if __name__ == '__main__':