From 30b377810a5021d63597730fc22d3965d9bb0071 Mon Sep 17 00:00:00 2001 From: Roman Zeyde Date: Wed, 16 Jul 2014 20:35:57 +0300 Subject: [PATCH] remove hardcoded data files --- recv.py | 4 ++-- send.py | 5 ++--- test.sh | 4 ++-- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/recv.py b/recv.py index 5359ade..cc8f27f 100755 --- a/recv.py +++ b/recv.py @@ -3,6 +3,7 @@ import numpy as np import logging import itertools import time +import sys import os log = logging.getLogger(__name__) @@ -194,8 +195,7 @@ def main(fname): return log.info('Decoded %.3f kB', len(data) / 1e3) - with file('data.recv', 'wb') as f: - f.write(data) + sys.stdout.write(data) if __name__ == '__main__': logging.basicConfig(level=logging.INFO, diff --git a/send.py b/send.py index 3398b09..fb30a4f 100755 --- a/send.py +++ b/send.py @@ -1,6 +1,6 @@ #!/usr/bin/env python import numpy as np - +import sys import logging import itertools @@ -17,8 +17,7 @@ class Symbol(object): carrier = [np.exp(2j * np.pi * F * t) for F in frequencies] sym = Symbol() - -data = open('data.send', 'r').read() +data = sys.stdin.read() def write(fd, sym, n=1): diff --git a/test.sh b/test.sh index f9de37d..93c82b4 100755 --- a/test.sh +++ b/test.sh @@ -3,7 +3,7 @@ set -u set -e dd if=/dev/urandom of=data.send bs=1024 count=16 status=none -./send.py tx.int16 +./send.py tx.int16 < data.send killall arecord aplay || true @@ -13,7 +13,7 @@ sleep 1 killall arecord aplay || true -./recv.py rx.int16 +./recv.py rx.int16 > data.recv ./errors.py data.* if [ -z $? ]; then ./show.py tx.int16 rx.int16