From 72bc864565d2c6fb6242d7739f48932ca407d077 Mon Sep 17 00:00:00 2001 From: Roman Zeyde Date: Mon, 21 Jul 2014 12:11:39 +0300 Subject: [PATCH] move file loading to recv.detect() --- recv.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/recv.py b/recv.py index fb77a9b..dcf1a82 100755 --- a/recv.py +++ b/recv.py @@ -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