plotting.py 文件源码

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

项目:devito 作者: opesci 项目源码 文件源码
def plot_shotrecord(rec, model, t0, tn, colorbar=True):
    """
    Plot a shot record (receiver values over time).

    :param rec: Receiver data with shape (time, points)
    :param model: :class:`Model` object that holds the velocity model.
    :param t0: Start of time dimension to plot
    :param tn: End of time dimension to plot
    """
    scale = np.max(rec) / 10.
    extent = [model.origin[0], model.origin[0] + 1e-3*model.domain_size[0],
              1e-3*tn, t0]

    plot = plt.imshow(rec, vmin=-scale, vmax=scale, cmap=cm.gray, extent=extent)
    plt.xlabel('X position (km)')
    plt.ylabel('Time (s)')

    # Create aligned colorbar on the right
    if colorbar:
        ax = plt.gca()
        divider = make_axes_locatable(ax)
        cax = divider.append_axes("right", size="5%", pad=0.05)
        plt.colorbar(plot, cax=cax)
    plt.show()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号