print "mean:", residuals.mean() print "stddev:", residuals.std() # Plot the layer and the fit mpl.figure(figsize=(14, 4)) mpl.subplot(1, 3, 1) mpl.axis('scaled') mpl.title('Layer (kg.m^-3)') mpl.pcolor(layer.y, layer.x, layer.props['density'], layer.shape) mpl.colorbar() mpl.m2km() mpl.subplot(1, 3, 2) mpl.axis('scaled') mpl.title('Fit (mGal)') levels = mpl.contour(y, x, gz, shape, 15, color='r') mpl.contour(y, x, solver.predicted(), shape, levels, color='k') mpl.m2km() mpl.subplot(1, 3, 3) mpl.title('Residuals (mGal)') mpl.hist(residuals, bins=10) mpl.show() # Now I can forward model the layer at a greater height and check against the # true solution of the prism gz_true = prism.gz(x, y, z - 500, model) gz_up = sphere.gz(x, y, z - 500, layer) mpl.figure() mpl.axis('scaled') mpl.title('True (red) | Layer (black)') levels = mpl.contour(y, x, gz_true, shape, 12, color='r')