mirror of
https://github.com/romanz/amodem.git
synced 2026-02-25 00:31:08 +08:00
debug wierd constellation results due to bad indexing
This commit is contained in:
@@ -7,7 +7,7 @@ log = logging.getLogger(__name__)
|
||||
Fs = 32e3
|
||||
Ts = 1.0 / Fs
|
||||
|
||||
frequencies = (np.arange(10) + 1) * 1e3
|
||||
frequencies = (1 + np.arange(1)) * 1e3
|
||||
carrier_index = 0
|
||||
Fc = frequencies[carrier_index]
|
||||
Tc = 1.0 / Fc
|
||||
|
||||
8
loop.py
8
loop.py
@@ -22,14 +22,8 @@ class Filter(object):
|
||||
|
||||
|
||||
class FreqLoop(object):
|
||||
def __init__(self, x, freqs, prefix=0.0):
|
||||
def __init__(self, src, freqs):
|
||||
interp = sampling.Interpolator()
|
||||
if prefix is None:
|
||||
prefix = []
|
||||
else:
|
||||
prefix = [prefix] * (interp.width - 1)
|
||||
|
||||
src = itertools.chain(prefix, x)
|
||||
self.sampler = sampling.Sampler(src, interp)
|
||||
self.gens = []
|
||||
|
||||
|
||||
11
sampling.py
11
sampling.py
@@ -1,4 +1,5 @@
|
||||
import numpy as np
|
||||
import itertools
|
||||
import logging
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
@@ -32,12 +33,14 @@ class Interpolator(object):
|
||||
|
||||
class Sampler(object):
|
||||
def __init__(self, src, interp=None):
|
||||
self.src = iter(src)
|
||||
self.freq = 1.0
|
||||
self.interp = interp if (interp is not None) else Interpolator()
|
||||
coeffs, begin = self.interp.get(0)
|
||||
self.offset = -begin # should fill samples buffer
|
||||
self.buff = np.zeros(len(coeffs))
|
||||
|
||||
# TODO: explain indices arithmetic
|
||||
padding = [0.0] * (self.interp.width - 1)
|
||||
self.src = itertools.chain(padding, src)
|
||||
self.offset = self.interp.width + 1
|
||||
self.buff = np.zeros(self.interp.coeff_len)
|
||||
self.index = 0
|
||||
|
||||
def __iter__(self):
|
||||
|
||||
Reference in New Issue
Block a user