core.py 文件源码

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

项目:motif 作者: rabitt 项目源码 文件源码
def _postprocess_contours(self, index, times, freqs, salience):
        """Remove contours that are too short.

        Parameters
        ----------
        index : np.array
            array of contour numbers
        times : np.array
            array of contour times
        freqs : np.array
            array of contour frequencies
        salience : np.array
            array of contour salience values

        Returns
        -------
        index_pruned : np.array
            Pruned array of contour numbers
        times_pruned : np.array
            Pruned array of contour times
        freqs_pruned : np.array
            Pruned array of contour frequencies
        salience_pruned : np.array
            Pruned array of contour salience values

        """
        keep_index = np.ones(times.shape).astype(bool)
        for i in set(index):
            this_idx = (index == i)
            if np.ptp(times[this_idx]) <= self.min_contour_len:
                keep_index[this_idx] = False

        return (index[keep_index], times[keep_index],
                freqs[keep_index], salience[keep_index])
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号