weakutil.py 文件源码

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

项目:weakmon 作者: rtmrtmrtmrtm 项目源码 文件源码
def rfft(x):
    if use_numpy_rfft:
        y = numpy.fft.rfft(x)
        return y
    else:
        assert (len(x) % 2) == 0

        y = scipy.fftpack.rfft(x)

        if type(y[0]) == numpy.float32:
            cty = numpy.complex64
        elif type(y[0]) == numpy.float64:
            cty = numpy.complex128
        else:
            assert False

        # y = [ Re0, Re1, Im1, Re2, Im2, ..., ReN ]
        y1 = y[1:-1].view(cty)
        y = numpy.concatenate((y[0:1], y1, y[-1:]))
        return y

# apply automatic gain control.
# causes each winlen window of samples
# to have average absolute value of 1.0.
# winlen is in units of samples.
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号