gcd.py 文件源码

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

项目:Spherical-robot 作者: Evan-Zhao 项目源码 文件源码
def fst_delay_snd(fst, snd, samp_rate, max_delay):
    # Verify argument shape.
    s1, s2 = fst.shape, snd.shape
    if len(s1) != 1 or len(s2) != 1 or s1[0] != s2[0]:
        raise Exception("Argument shape invalid, in 'fst_delay_snd' function")

    half_len = int(s1[0]/2)
    a = numpy.array(fst, dtype=numpy.double)
    b = numpy.array(snd, dtype=numpy.double)
    corr = numpy.correlate(a, b, 'same')
    max_pos = numpy.argmax(corr)

    # plot(s1[0], samp_rate, a, b, corr)

    return corr, (max_pos - half_len) / samp_rate
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号