# Calculate and print the standard deviation of the residuals # Should be close to the data error if the inversion was able to fit the data residuals = tomo.residuals() print "Assumed error: %g" % (error) print "Standard deviation of residuals: %g" % (np.std(residuals)) mpl.figure(figsize=(14, 5)) mpl.subplot(1, 2, 1) mpl.axis('scaled') mpl.title('Vp model') mpl.squaremesh(model, prop='vp', cmap=mpl.cm.seismic) cb = mpl.colorbar() cb.set_label('Velocity') mpl.points(src_loc, '*y', label="Sources") mpl.points(rec_loc, '^r', label="Receivers") mpl.legend(loc='lower left', shadow=True, numpoints=1, prop={'size': 10}) mpl.m2km() mpl.subplot(1, 2, 2) mpl.axis('scaled') mpl.title('Tomography result') mpl.squaremesh(mesh, prop='vp', vmin=4000, vmax=10000, cmap=mpl.cm.seismic) cb = mpl.colorbar() cb.set_label('Velocity') mpl.m2km() mpl.figure() mpl.grid() mpl.title('Residuals (data with %.4f s error)' % (error)) mpl.hist(residuals, color='gray', bins=10) mpl.xlabel("seconds") mpl.show()
# Should be close to the data error if the inversion was able to fit the data residuals = tomo.residuals() print "Assumed error: %g" % (error) print "Standard deviation of residuals: %g" % (np.std(residuals)) mpl.figure(figsize=(14, 5)) mpl.subplot(1, 2, 1) mpl.axis('scaled') mpl.title('Vp model') mpl.squaremesh(model, prop='vp', cmap=mpl.cm.seismic) cb = mpl.colorbar() cb.set_label('Velocity') mpl.points(src_loc, '*y', label="Sources") mpl.points(rec_loc, '^r', label="Receivers") mpl.legend(loc='lower left', shadow=True, numpoints=1, prop={'size': 10}) mpl.m2km() mpl.subplot(1, 2, 2) mpl.axis('scaled') mpl.title('Tomography result') mpl.squaremesh(mesh, prop='vp', vmin=4000, vmax=10000, cmap=mpl.cm.seismic) cb = mpl.colorbar() cb.set_label('Velocity') mpl.m2km() mpl.figure() mpl.grid() mpl.title('Residuals (data with %.4f s error)' % (error)) mpl.hist(residuals, color='gray', bins=10) mpl.xlabel("seconds") mpl.show()