From 1139f56655a1d4180f2eec14260644459f0fde1c Mon Sep 17 00:00:00 2001 From: Roman Zeyde Date: Mon, 4 Aug 2014 08:53:18 +0300 Subject: [PATCH] reorganize directory structure --- calib.py => amodem/calib.py | 0 colorhash.py => amodem/colorhash.py | 0 common.py => amodem/common.py | 0 config.py => amodem/config.py | 0 constellation.py => amodem/constellation.py | 0 drift.py => amodem/drift.py | 0 ecc.py => amodem/ecc.py | 0 errors.py => amodem/errors.py | 0 loop.py => amodem/loop.py | 0 pll.py => amodem/pll.py | 0 recv.py => amodem/recv.py | 0 sampling.py => amodem/sampling.py | 0 send.py => amodem/send.py | 0 show.py => amodem/show.py | 0 sigproc.py => amodem/sigproc.py | 0 stream.py => amodem/stream.py | 0 test_common.py => amodem/test/test_common.py | 0 amodem/test/test_ecc.py | 15 +++++++++++++ .../test/test_sampling.py | 0 .../test/test_sigproc.py | 0 test_stream.py => amodem/test/test_stream.py | 0 train.py => amodem/train.py | 0 wave.py => amodem/wave.py | 0 loop.sh | 2 -- test_ecc.py | 22 ------------------- 25 files changed, 15 insertions(+), 24 deletions(-) rename calib.py => amodem/calib.py (100%) rename colorhash.py => amodem/colorhash.py (100%) rename common.py => amodem/common.py (100%) rename config.py => amodem/config.py (100%) rename constellation.py => amodem/constellation.py (100%) rename drift.py => amodem/drift.py (100%) rename ecc.py => amodem/ecc.py (100%) rename errors.py => amodem/errors.py (100%) rename loop.py => amodem/loop.py (100%) rename pll.py => amodem/pll.py (100%) rename recv.py => amodem/recv.py (100%) rename sampling.py => amodem/sampling.py (100%) rename send.py => amodem/send.py (100%) rename show.py => amodem/show.py (100%) rename sigproc.py => amodem/sigproc.py (100%) rename stream.py => amodem/stream.py (100%) rename test_common.py => amodem/test/test_common.py (100%) create mode 100644 amodem/test/test_ecc.py rename test_sampling.py => amodem/test/test_sampling.py (100%) rename test_sigproc.py => amodem/test/test_sigproc.py (100%) rename test_stream.py => amodem/test/test_stream.py (100%) rename train.py => amodem/train.py (100%) rename wave.py => amodem/wave.py (100%) delete mode 100755 loop.sh delete mode 100644 test_ecc.py diff --git a/calib.py b/amodem/calib.py similarity index 100% rename from calib.py rename to amodem/calib.py diff --git a/colorhash.py b/amodem/colorhash.py similarity index 100% rename from colorhash.py rename to amodem/colorhash.py diff --git a/common.py b/amodem/common.py similarity index 100% rename from common.py rename to amodem/common.py diff --git a/config.py b/amodem/config.py similarity index 100% rename from config.py rename to amodem/config.py diff --git a/constellation.py b/amodem/constellation.py similarity index 100% rename from constellation.py rename to amodem/constellation.py diff --git a/drift.py b/amodem/drift.py similarity index 100% rename from drift.py rename to amodem/drift.py diff --git a/ecc.py b/amodem/ecc.py similarity index 100% rename from ecc.py rename to amodem/ecc.py diff --git a/errors.py b/amodem/errors.py similarity index 100% rename from errors.py rename to amodem/errors.py diff --git a/loop.py b/amodem/loop.py similarity index 100% rename from loop.py rename to amodem/loop.py diff --git a/pll.py b/amodem/pll.py similarity index 100% rename from pll.py rename to amodem/pll.py diff --git a/recv.py b/amodem/recv.py similarity index 100% rename from recv.py rename to amodem/recv.py diff --git a/sampling.py b/amodem/sampling.py similarity index 100% rename from sampling.py rename to amodem/sampling.py diff --git a/send.py b/amodem/send.py similarity index 100% rename from send.py rename to amodem/send.py diff --git a/show.py b/amodem/show.py similarity index 100% rename from show.py rename to amodem/show.py diff --git a/sigproc.py b/amodem/sigproc.py similarity index 100% rename from sigproc.py rename to amodem/sigproc.py diff --git a/stream.py b/amodem/stream.py similarity index 100% rename from stream.py rename to amodem/stream.py diff --git a/test_common.py b/amodem/test/test_common.py similarity index 100% rename from test_common.py rename to amodem/test/test_common.py diff --git a/amodem/test/test_ecc.py b/amodem/test/test_ecc.py new file mode 100644 index 0000000..3fba091 --- /dev/null +++ b/amodem/test/test_ecc.py @@ -0,0 +1,15 @@ +import ecc +import random +import itertools + + +def concat(chunks): + return bytearray(itertools.chain.from_iterable(chunks)) + + +def test_random(): + r = random.Random(0) + x = bytearray(r.randrange(0, 256) for i in range(64 * 1024)) + y = ecc.encode(x) + x_ = concat(ecc.decode(y)) + assert x_ == x diff --git a/test_sampling.py b/amodem/test/test_sampling.py similarity index 100% rename from test_sampling.py rename to amodem/test/test_sampling.py diff --git a/test_sigproc.py b/amodem/test/test_sigproc.py similarity index 100% rename from test_sigproc.py rename to amodem/test/test_sigproc.py diff --git a/test_stream.py b/amodem/test/test_stream.py similarity index 100% rename from test_stream.py rename to amodem/test/test_stream.py diff --git a/train.py b/amodem/train.py similarity index 100% rename from train.py rename to amodem/train.py diff --git a/wave.py b/amodem/wave.py similarity index 100% rename from wave.py rename to amodem/wave.py diff --git a/loop.sh b/loop.sh deleted file mode 100755 index d700848..0000000 --- a/loop.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -(while [ true ]; do cat $1; done ) | aplay -q -f S16_LE -c 1 -r 32000 diff --git a/test_ecc.py b/test_ecc.py deleted file mode 100644 index f7a51de..0000000 --- a/test_ecc.py +++ /dev/null @@ -1,22 +0,0 @@ -import ecc -import random -import itertools - - -def concat(chunks): - return bytearray(itertools.chain.from_iterable(chunks)) - - -def test_random(): - r = random.Random(0) - x = bytearray(r.randrange(0, 256) for i in range(16 * 1024)) - y = ecc.encode(x) - x_ = concat(ecc.decode(y)) - assert x_[:len(x)] == x - assert all(v == 0 for v in x_[len(x):]) - - -def test_file(): - data = open('data.send').read() - enc = ecc.encode(data) - assert concat(ecc.decode(enc)) == data