detect: find actual starting offset of the carrier

This commit is contained in:
Roman Zeyde
2015-02-16 19:11:19 +02:00
parent b3619a75ba
commit 90dd3e55f0
2 changed files with 21 additions and 11 deletions

View File

@@ -19,7 +19,7 @@ def test_detect():
detector = detect.Detector(config, pylab=common.Dummy())
samples, amp, freq_err = detector.run(x)
assert abs(1 - amp) < 1e-12
assert abs(freq_err) < 1e-16
assert abs(freq_err) < 1e-12
x = np.cos(2 * np.pi * (2*config.Fc) * t)
with pytest.raises(ValueError):
@@ -56,6 +56,6 @@ def test_find_start():
for offset in range(32):
bufs = [prefix, [0] * offset, carrier, postfix]
buf = np.concatenate(bufs)
start = detector.find_start(buf, length)
start = detector.find_start(buf)
expected = offset + len(prefix)
assert expected == start