remove dead code

This commit is contained in:
Roman Zeyde
2014-08-07 18:34:39 +03:00
parent 49810ed537
commit 22986a591f
3 changed files with 18 additions and 39 deletions

View File

@@ -1,37 +0,0 @@
import numpy as np
import itertools
from . import sampling
from . import sigproc
from . import common
class Filter(object):
def __init__(self, b, a=()):
self.b = b
self.a = a
self.x = [0] * len(b)
self.y = [0] * len(a)
def __call__(self, x):
self.x = [x] + self.x
self.x = self.x[:len(self.b)]
self.y = self.y[:len(self.a)]
y = np.dot(self.x, self.b) + np.dot(self.y, self.a)
self.y = [y] + self.y
return y
class FreqLoop(object):
def __init__(self, src, freqs):
interp = sampling.Interpolator()
self.sampler = sampling.Sampler(src, interp)
self.gens = []
samplers = itertools.tee(self.sampler, len(freqs))
for freq, generator in zip(freqs, samplers):
gen = sigproc.extract_symbols(generator, freq)
self.gens.append(gen)
def __iter__(self):
return common.izip(*self.gens)

View File

@@ -14,7 +14,6 @@ log = logging.getLogger(__name__)
from . import stream
from . import sigproc
from . import loop
from . import train
from . import common
from . import config
@@ -212,7 +211,7 @@ def demodulate(symbols, filters, freqs, sampler):
def receive(signal, freqs, gain=1.0):
signal = loop.FreqLoop(signal, freqs)
signal = sigproc.FreqLoop(signal, freqs)
signal.sampler.gain = gain
symbols = iter(signal)

View File

@@ -1,6 +1,8 @@
import numpy as np
from numpy import linalg
import itertools
from . import sampling
from . import common
from .config import Ts, Nsym
@@ -58,6 +60,21 @@ class QAM(object):
yield self._dec[S]
class FreqLoop(object):
def __init__(self, src, freqs):
interp = sampling.Interpolator()
self.sampler = sampling.Sampler(src, interp)
self.gens = []
samplers = itertools.tee(self.sampler, len(freqs))
for freq, generator in zip(freqs, samplers):
gen = extract_symbols(generator, freq)
self.gens.append(gen)
def __iter__(self):
return common.izip(*self.gens)
class MODEM(object):
def __init__(self, config):
self.qam = QAM(config.symbols)