def run(title): if title == 'Migration': result = gravmag.imaging.migrate(xp, yp, zp, gz, bounds[-2], bounds[-1], meshshape, power=0.5) elif title == 'Generalized Inverse': result = gravmag.imaging.geninv(xp, yp, zp, gz, meshshape[1:], bounds[-2], bounds[-1], meshshape[0]) elif title == 'Sandwich': result = gravmag.imaging.sandwich(xp, yp, zp, gz, meshshape[1:], bounds[-2], bounds[-1], meshshape[0], power=0.5) # Plot the results myv.figure() myv.polyprisms(prisms, 'density', style='wireframe', linewidth=2) myv.prisms(result, 'density', edges=False) axes = myv.axes(myv.outline(), ranges=[b*0.001 for b in bounds], fmt='%.0f') myv.wall_bottom(axes.axes.bounds) myv.wall_north(axes.axes.bounds) myv.title(title) myv.show()
area = bounds[:4] axis = mpl.figure().gca() mpl.axis('scaled') model = [ mesher.PolygonalPrism( mpl.draw_polygon(area, axis, xy2ne=True), # Use only induced magnetization 0, 2000, {'magnetization':2})] # Calculate the effect shape = (100, 100) xp, yp, zp = gridder.regular(area, shape, z=-500) tf = polyprism.tf(xp, yp, zp, model, inc, dec) # and plot it mpl.figure() mpl.axis('scaled') mpl.title("Total field anomalyproduced by prism model (nT)") mpl.contourf(yp, xp, tf, shape, 20) mpl.colorbar() for p in model: mpl.polygon(p, '.-k', xy2ne=True) mpl.set_area(area) mpl.m2km() mpl.show() # Show the prisms myv.figure() myv.polyprisms(model, 'magnetization') myv.axes(myv.outline(bounds), ranges=[i*0.001 for i in bounds]) myv.wall_north(bounds) myv.wall_bottom(bounds) myv.show()
""" Meshing: Make and plot a 3D prism mesh """ from fatiando import mesher from fatiando.vis import myv mesh = mesher.PrismMesh(bounds=(-2, 2, -3, 3, 0, 1), shape=(4, 4, 4)) myv.figure() plot = myv.prisms(mesh) axes = myv.axes(plot) myv.show()