spectrum.py 文件源码

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

项目:pactools 作者: pactools 项目源码 文件源码
def plot(self, fig=None, ax=None):
        if fig is None:
            fig = plt.figure()
        if ax is None:
            ax = fig.gca()

        fmax = self.fs / 2.0
        bicoherence = np.copy(self.bicoherence)
        n_freq = bicoherence.shape[0]
        np.flipud(bicoherence)[np.triu_indices(n_freq, 1)] = 0
        bicoherence[np.triu_indices(n_freq, 1)] = 0
        bicoherence = bicoherence[:, :n_freq // 2 + 1]

        vmin, vmax = compute_vmin_vmax(bicoherence, tick=1e-15, percentile=1)
        ax.imshow(bicoherence, cmap=plt.cm.viridis, aspect='auto', vmin=vmin,
                  vmax=vmax, origin='lower', extent=(0, fmax // 2, 0, fmax),
                  interpolation='none')
        ax.set_title('Bicoherence (%s)' % self.method)
        ax.set_xlabel('Frequency (Hz)')
        ax.set_ylabel('Frequency (Hz)')
        # add_colorbar(fig, cax, vmin, vmax, unit='', ax=ax)
        return ax
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号