move file loading to recv.detect()

This commit is contained in:
Roman Zeyde
2014-07-21 12:11:39 +03:00
parent 6549fe76c9
commit 72bc864565

View File

@@ -27,7 +27,8 @@ CARRIER_DURATION = sum(train.prefix)
CARRIER_THRESHOLD = int(0.95 * CARRIER_DURATION)
def detect(x, freq):
def detect(fd, freq):
_, x = load(fd)
counter = 0
for offset, buf in iterate(x, Nsym):
coeff = sigproc.coherence(buf, Fc)
@@ -216,8 +217,7 @@ def main(fname):
log.info('Running MODEM @ {:.1f} kbps'.format(sigproc.modem_bps / 1e3))
_, x = load(open(fname, 'rb'))
y = detect(x, Fc)
y = detect(open(fname, 'rb'), Fc)
if y is None:
log.warning('No carrier detected')
return