当前位置: 首页>>代码示例>>Python>>正文


Python pylab.pause方法代码示例

本文整理汇总了Python中matplotlib.pylab.pause方法的典型用法代码示例。如果您正苦于以下问题:Python pylab.pause方法的具体用法?Python pylab.pause怎么用?Python pylab.pause使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在matplotlib.pylab的用法示例。


在下文中一共展示了pylab.pause方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _show_video

# 需要导入模块: from matplotlib import pylab [as 别名]
# 或者: from matplotlib.pylab import pause [as 别名]
def _show_video(video, fps=10):
    # Import matplotlib/pylab only if needed
    import matplotlib
    matplotlib.use('TkAgg')
    import matplotlib.pylab as pl
    pl.style.use('ggplot')
    pl.axis('off')

    if fps < 0:
        fps = 25
    video /= 255.  # Pylab works in [0, 1] range
    img = None
    pause_length = 1. / fps
    try:
        for f in range(video.shape[0]):
            im = video[f, :, :, :]
            if img is None:
                img = pl.imshow(im)
            else:
                img.set_data(im)
            pl.pause(pause_length)
            pl.draw()
    except:
        pass 
开发者ID:victorcampos7,项目名称:tensorflow-ffmpeg,代码行数:26,代码来源:usage_example.py

示例2: test_fields_E

# 需要导入模块: from matplotlib import pylab [as 别名]
# 或者: from matplotlib.pylab import pause [as 别名]
def test_fields_E(self):

        F = fdtd(self.eps_r, dL=self.dL, npml=self.pml)

        fig, ax = plt.subplots(figsize=(10, 10))
        im = ax.pcolormesh(np.zeros((self.Nx, self.Ny)), cmap='RdBu')

        for t_index in range(self.steps):

            fields = F.forward(Jz=self.gaussian(t_index))

            if t_index % self.skip_rate == 0:

                max_E = np.abs(fields['Ez']).max()
                im.set_array(fields['Ez'][:, :, 0].ravel())
                im.set_clim([-1, 1])
                plt.pause(0.001)
                ax.set_title('time = {}'.format(t_index)) 
开发者ID:fancompute,项目名称:ceviche,代码行数:20,代码来源:test_fields_fdtd.py

示例3: test_fields_H

# 需要导入模块: from matplotlib import pylab [as 别名]
# 或者: from matplotlib.pylab import pause [as 别名]
def test_fields_H(self):

        F = fdtd(self.eps_r, dL=self.dL, npml=self.pml)

        fig, ax = plt.subplots(figsize=(10, 10))
        im = ax.pcolormesh(np.zeros((self.Nx, self.Ny)), cmap='RdBu')

        for t_index in range(self.steps):

            fields = F.forward(Jx=self.gaussian(t_index))

            if t_index % self.skip_rate == 0:

                max_E = np.abs(fields['Hz']).max()
                im.set_array(fields['Hz'][:, :, 0].ravel())
                im.set_clim([-1, 1])
                plt.pause(0.001)
                ax.set_title('time = {}'.format(t_index)) 
开发者ID:fancompute,项目名称:ceviche,代码行数:20,代码来源:test_fields_fdtd.py

示例4: show

# 需要导入模块: from matplotlib import pylab [as 别名]
# 或者: from matplotlib.pylab import pause [as 别名]
def show():
    args = get_args()

    # Load model
    nn.load_parameters(args.model_load_path)
    params = nn.get_parameters()

    # Show heatmap
    for name, param in params.items():
        # SSL only on convolution weights
        if "conv/W" not in name:
            continue
        print(name)
        n, m, k0, k1 = param.d.shape
        w_matrix = param.d.reshape((n, m * k0 * k1))
        # Filter x Channel heatmap

        fig, ax = plt.subplots()
        ax.set_title("{} with shape {} \n Filter x (Channel x Heigh x Width)".format(
            name, (n, m, k0, k1)))
        heatmap = ax.pcolor(w_matrix)
        fig.colorbar(heatmap)

        plt.pause(0.5)
        raw_input("Press Key")
        plt.close() 
开发者ID:sony,项目名称:nnabla-examples,代码行数:28,代码来源:show_leaned_filters.py


注:本文中的matplotlib.pylab.pause方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。