def test_despreader_peaks(pos):
"""Test correlation peaks with signal at different positions."""
estimator = soa_estimator.SoaEstimator(TEMPLATE, None,
BLOCK_LEN,
len(TEMPLATE))
block = gen_block(pos)
fft = np.fft.fft(block)
corr = estimator.despread(fft)
corr_abs = np.abs(corr)
assert len(corr) == BLOCK_LEN - len(TEMPLATE) + 1
if pos <= BLOCK_LEN - len(TEMPLATE):
peak_idx = np.argmax(corr_abs)
non_peak = np.delete(corr_abs, peak_idx)
assert peak_idx == pos
assert corr_abs[peak_idx] >= PEAK_MAG - 0.1
np.testing.assert_array_less(non_peak, MAX_SIDEBAND + 0.1)
else:
np.testing.assert_array_less(corr_abs, MAX_SIDEBAND + 0.1)
评论列表
文章目录