mirror of
https://github.com/romanz/amodem.git
synced 2026-03-06 23:05:57 +08:00
fix UTs
This commit is contained in:
@@ -4,12 +4,10 @@ import numpy as np
|
||||
|
||||
def test_resample():
|
||||
x = np.arange(300)
|
||||
s = sampling.Sampler(x, )
|
||||
s = sampling.Sampler(x)
|
||||
y = np.array(list(s))
|
||||
|
||||
w = s.interp.width
|
||||
x = x[w-1:-w]
|
||||
err = x - y
|
||||
err = x[1:len(y)+1] - y
|
||||
assert np.max(np.abs(err)) < 1e-10
|
||||
|
||||
|
||||
|
||||
@@ -8,7 +8,8 @@ import random
|
||||
def test_qam():
|
||||
q = sigproc.QAM(common.symbols)
|
||||
r = random.Random(0)
|
||||
bits = [tuple(r.randint(0, 1) for j in range(4)) for i in range(1024)]
|
||||
m = q.bits_per_symbol
|
||||
bits = [tuple(r.randint(0, 1) for j in range(m)) for i in range(1024)]
|
||||
stream = itertools.chain(*bits)
|
||||
S = q.encode(list(stream))
|
||||
decoded = list(q.decode(list(S)))
|
||||
|
||||
Reference in New Issue
Block a user