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