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()
评论列表
文章目录