mirror of
https://github.com/romanz/amodem.git
synced 2026-02-06 16:48:06 +08:00
remove dead code
This commit is contained in:
@@ -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)
|
||||
@@ -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)
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user