test_soa_estimator.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:Thrifty 作者: swkrueger 项目源码 文件源码
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)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号