From 7b4b2dd7ef749a25d51305f6f8ab9488b4a1e27f Mon Sep 17 00:00:00 2001 From: Roman Zeyde Date: Fri, 27 Mar 2015 09:49:04 +0300 Subject: [PATCH] sampling: fix lint warning --- amodem/sampling.py | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/amodem/sampling.py b/amodem/sampling.py index aa21b9d..b9e8d86 100644 --- a/amodem/sampling.py +++ b/amodem/sampling.py @@ -57,26 +57,26 @@ class Sampler(object): def _take(self, size): frame = np.zeros(size) count = 0 - try: - for frame_index in range(size): - offset = self.offset - # offset = k + (j / self.resolution) - k = int(offset) # integer part - j = int((offset - k) * self.resolution) # fractional part - coeffs = self.filt[j] # choose correct filter phase - end = k + self.width - # process input until all buffer is full with samples + for frame_index in range(size): + offset = self.offset + # offset = k + (j / self.resolution) + k = int(offset) # integer part + j = int((offset - k) * self.resolution) # fractional part + coeffs = self.filt[j] # choose correct filter phase + end = k + self.width + # process input until all buffer is full with samples + try: while self.index < end: self.buff[:-1] = self.buff[1:] self.buff[-1] = next(self.src) # throws StopIteration self.index += 1 + except StopIteration: + break - self.offset += self.freq - # apply interpolation filter - frame[frame_index] = np.dot(coeffs, self.buff) - count = frame_index + 1 - except StopIteration: - pass + self.offset += self.freq + # apply interpolation filter + frame[frame_index] = np.dot(coeffs, self.buff) + count = frame_index + 1 return self.equalizer(frame[:count])