mirror of
https://github.com/romanz/amodem.git
synced 2026-02-08 02:18:00 +08:00
fix common.load()
This commit is contained in:
@@ -33,9 +33,8 @@ def to_byte(bits):
|
||||
byte = int(np.dot(bits, bit_weights))
|
||||
return chr(byte)
|
||||
|
||||
def load(fname):
|
||||
data = open(fname, 'rb').read()
|
||||
return loads(data)
|
||||
def load(fileobj):
|
||||
return loads(fileobj.read())
|
||||
|
||||
def loads(data):
|
||||
x = np.fromstring(data, dtype='int16')
|
||||
|
||||
2
drift.py
2
drift.py
@@ -28,7 +28,7 @@ import pylab
|
||||
|
||||
def main():
|
||||
f0 = 10e3
|
||||
_, x = common.load('recv_10kHz.pcm')
|
||||
_, x = common.load(file('recv_10kHz.pcm', 'rb'))
|
||||
x = x[100:]
|
||||
|
||||
S = []
|
||||
|
||||
2
recv.py
2
recv.py
@@ -128,7 +128,7 @@ def constellation(y):
|
||||
|
||||
def main(fname):
|
||||
|
||||
_, x = load(fname)
|
||||
_, x = load(open(fname, 'rb'))
|
||||
result = detect(x, Fc)
|
||||
if result is None:
|
||||
log.info('No carrier detected')
|
||||
|
||||
Reference in New Issue
Block a user