recv: remove saturation detection

This commit is contained in:
Roman Zeyde
2014-12-31 11:03:36 +02:00
parent c38208e10b
commit 477013fcdd
4 changed files with 1 additions and 27 deletions

View File

@@ -5,17 +5,6 @@ import logging
log = logging.getLogger(__name__)
scaling = 32000.0 # out of 2**15
SATURATION_THRESHOLD = (2**15 - 1) / scaling
class SaturationError(ValueError):
pass
def check_saturation(x):
peak = np.max(np.abs(x))
if peak >= SATURATION_THRESHOLD:
raise SaturationError(peak)
def load(fileobj):

View File

@@ -217,8 +217,6 @@ def main(config, src, dst, pylab=None):
log.debug('Skipping %.3f seconds', config.skip_start)
common.take(signal, to_skip)
reader.check = common.check_saturation
detector = detect.Detector(config=config)
receiver = Receiver(config=config, pylab=pylab)
success = False

View File

@@ -12,7 +12,6 @@ class Reader(object):
self.timeout = timeout
self.wait = wait
self.total = 0
self.check = None
def __iter__(self):
return self
@@ -37,10 +36,7 @@ class Reader(object):
block.extend(data)
if len(block) == self.bufsize:
values = self.data_type(block)
if self.check:
self.check(values)
return values
return self.data_type(block)
time.sleep(self.wait)

View File

@@ -47,15 +47,6 @@ def test_dumps_loads():
assert all(x == y)
def test_saturation():
x = np.array([1, -1, 1, -1]) * 1e10
try:
common.check_saturation(x)
assert False
except common.SaturationError as e:
assert e.args == (max(x),)
def test_izip():
x = range(10)
y = range(-10, 0)