mirror of
https://github.com/romanz/amodem.git
synced 2026-03-30 23:57:54 +08:00
debug wierd constellation results due to bad indexing
This commit is contained in:
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