par.py 文件源码

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

项目:pyssp 作者: shunsukeaihara 项目源码 文件源码
def calc_par(self, frame):
        power = sp.absolute(sp.fft(frame * self._window)) ** 2
        avg_pow = power[:int(self._winsize / 2)].sum() / (self._winsize / 2)
        smax = -np.inf
        lenmax = 0
        for i in range(2, int(self._winsize / 10)):
            # searching f0 with maximizing estimated power of periodic component
            idx = list(range(i, int(self._winsize / 2), i + 1))
            score = power[:int(self._winsize / 2)][idx].sum() - (len(idx) * avg_pow)
            if score > smax:
                smax = score
                lenmax = len(idx)
        pp = (smax / (1.0 - self._eta * lenmax)) * self._eta
        pa = avg_pow - pp
        return calc_hypotes(pa, pp, beta=self._beta) / calc_nullhypotes(pa, pp, alpha=self._alpha)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号