Skip to content

Instantly share code, notes, and snippets.

@nowls
Created September 15, 2015 19:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nowls/8566d649e20ac0fa6d4e to your computer and use it in GitHub Desktop.
Save nowls/8566d649e20ac0fa6d4e to your computer and use it in GitHub Desktop.
diff --git a/gr-trellis/examples/python/test_cpm.py b/gr-trellis/examples/python/test_cpm.py
index 8014c87..67a7e0c 100755
--- a/gr-trellis/examples/python/test_cpm.py
+++ b/gr-trellis/examples/python/test_cpm.py
@@ -34,29 +34,29 @@ def run_test(seed,blocksize):
# Variables
##################################################
M = 2
- K = 1
- P = 2
+ K = 25
+ P = 3
h = (1.0*K)/P
- L = 3
- Q = 4
+ L = 1
+ Q = 16
frac = 0.99
f = trellis.fsm(P,M,L)
# CPFSK signals
- #p = numpy.ones(L*Q)
- #p = p/sum(p)*Q/2.0;
- #q = numpy.cumsum(p)
- #q = q/q[-1]/2.0;
+ p = numpy.ones(L*Q)
+ p = p/sum(p)*Q/2.0;
+ q = numpy.cumsum(p)
+ q = q/q[-1]/2.0;
# GMSK signals
- BT=0.3;
- tt=numpy.arange(0,L*Q)/(1.0*Q)-L/2.0;
+ #BT=0.3;
+ #tt=numpy.arange(0,L*Q)/(1.0*Q)-L/2.0;
#print tt
- p=(0.5*scipy.special.erfc(2*math.pi*BT*(tt-0.5)/math.sqrt(math.log(2.0))/math.sqrt(2.0))-0.5*scipy.special.erfc(2*math.pi*BT*(tt+0.5)/math.sqrt(math.log(2.0))/math.sqrt(2.0)))/2.0;
- p=p/sum(p)*Q/2.0;
+ #p=(0.5*scipy.special.erfc(2*math.pi*BT*(tt-0.5)/math.sqrt(math.log(2.0))/math.sqrt(2.0))-0.5*scipy.special.erfc(2*math.pi*BT*(tt+0.5)/math.sqrt(math.log(2.0))/math.sqrt(2.0)))/2.0;
+ #p=p/sum(p)*Q/2.0;
#print p
- q=numpy.cumsum(p);
- q=q/q[-1]/2.0;
+ #q=numpy.cumsum(p);
+ #q=q/q[-1]/2.0;
#print q
(f0T,SS,S,F,Sf,Ff,N) = fsm_utils.make_cpm_signals(K,P,M,L,q,frac)
@@ -76,7 +76,7 @@ def run_test(seed,blocksize):
#print constellation
#print numpy.max(numpy.abs(SS - numpy.dot(Ff , Sf)))
- EsN0_db = 10.0
+ EsN0_db = 6.0
N0 = Es * 10.0**(-(1.0*EsN0_db)/10.0)
#N0 = 0.0
#print N0
@@ -149,7 +149,7 @@ def run_test(seed,blocksize):
return (err,perr)
if __name__ == '__main__':
- blocksize = 1000
+ blocksize = 64*8
ss=0
ee=0
for i in range(10000):
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment