plotting.py 文件源码

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

项目:devito 作者: opesci 项目源码 文件源码
def plot_perturbation(model, model1, colorbar=True):
    """
    Plot a two-dimensional velocity difference from two seismic :class:`Model`
    objects.

    :param model: :class:`Model` object of first velocity model.
    :param model1: :class:`Model` object of the second velocity model.
    :param source: Coordinates of the source point.
    :param receiver: Coordinates of the receiver points.
    """
    domain_size = 1.e-3 * np.array(model.domain_size)
    extent = [model.origin[0], model.origin[0] + domain_size[0],
              model.origin[1] + domain_size[1], model.origin[1]]
    dv = np.transpose(model.vp) - np.transpose(model1.vp)

    plot = plt.imshow(dv, animated=True, cmap=cm.jet,
                      vmin=min(dv.reshape(-1)), vmax=max(dv.reshape(-1)),
                      extent=extent)
    plt.xlabel('X position (km)')
    plt.ylabel('Depth (km)')

    # 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)
        cbar = plt.colorbar(plot, cax=cax)
        cbar.set_label('Velocity perturbation (km/s)')
    plt.show()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号