mirror of
https://github.com/romanz/amodem.git
synced 2026-02-06 16:48:06 +08:00
use real part at common.dumps()
This commit is contained in:
@@ -47,7 +47,7 @@ def loads(data):
|
||||
|
||||
|
||||
def dumps(sym, n=1):
|
||||
sym = sym.imag * scaling
|
||||
sym = sym.real * scaling
|
||||
sym = sym.astype('int16')
|
||||
data = sym.tostring()
|
||||
return data * n
|
||||
|
||||
@@ -76,5 +76,5 @@ if __name__ == '__main__':
|
||||
sampler = Sampler(x, Interpolator())
|
||||
sampler.freq += df
|
||||
y = np.array(list(sampler))
|
||||
y = common.dumps(y*1j)
|
||||
y = common.dumps(y)
|
||||
sys.stdout.write(y)
|
||||
|
||||
@@ -49,5 +49,5 @@ def test_icapture():
|
||||
|
||||
def test_dumps_loads():
|
||||
x = np.array([.1, .4, .2, .6, .3, .5])
|
||||
y = common.loads(common.dumps(x * 1j))
|
||||
y = common.loads(common.dumps(x))
|
||||
assert all(x == y)
|
||||
|
||||
@@ -29,7 +29,7 @@ def run(size, chan):
|
||||
data = tx_audio.getvalue()
|
||||
data = common.loads(data)
|
||||
data = chan(data)
|
||||
data = common.dumps(data * 1j)
|
||||
data = common.dumps(data)
|
||||
rx_audio = BytesIO(data)
|
||||
|
||||
rx_data = BytesIO()
|
||||
|
||||
Reference in New Issue
Block a user