model = [
    mesher.Prism(-4000, -1000, -4000, -2000, 2000, 5000, {'density': 800}),
    mesher.Prism(-1000, 1000, -1000, 1000, 1000, 6000, {'density': -800}),
    mesher.Prism(2000, 4000, 3000, 4000, 0, 4000, {'density': 600})
]
shape = (25, 25)
xp, yp, zp = gridder.regular((-5000, 5000, -5000, 5000), shape, z=-10)
gz = utils.contaminate(prism.gz(xp, yp, zp, model), 0.1)

# Plot the data
mpl.figure()
mpl.axis('scaled')
mpl.contourf(yp, xp, gz, shape, 30)
mpl.colorbar()
mpl.xlabel('East (km)')
mpl.ylabel('North (km)')
mpl.m2km()
mpl.show()

# Run the Generalized Inverse
mesh = imaging.geninv(xp, yp, zp, gz, shape, 0, 10000, 25)

# Plot the results
myv.figure()
myv.prisms(model, 'density', style='wireframe')
myv.prisms(mesh, 'density', edges=False, linewidth=5)
axes = myv.axes(myv.outline())
myv.wall_bottom(axes.axes.bounds)
myv.wall_north(axes.axes.bounds)
myv.show()
model = [
    mesher.Prism(-4000, -1000, -4000, -2000, 2000, 5000, {'density': 800}),
    mesher.Prism(-1000, 1000, -1000, 1000, 1000, 6000, {'density': -800}),
    mesher.Prism(2000, 4000, 3000, 4000, 0, 4000, {'density': 600})]
shape = (25, 25)
xp, yp, zp = gridder.regular((-5000, 5000, -5000, 5000), shape, z=-10)
gz = utils.contaminate(prism.gz(xp, yp, zp, model), 0.1)

# Plot the data
mpl.figure()
mpl.axis('scaled')
mpl.contourf(yp, xp, gz, shape, 30)
mpl.colorbar()
mpl.xlabel('East (km)')
mpl.ylabel('North (km)')
mpl.m2km()
mpl.show()

# Run the Generalized Inverse
mesh = imaging.geninv(xp, yp, zp, gz, shape,
                      0, 10000, 25)

# Plot the results
myv.figure()
myv.prisms(model, 'density', style='wireframe')
myv.prisms(mesh, 'density', edges=False, linewidth=5)
axes = myv.axes(myv.outline())
myv.wall_bottom(axes.axes.bounds)
myv.wall_north(axes.axes.bounds)
myv.show()
Beispiel #3
0
"""
from __future__ import division
from fatiando import gridder, mesher
from fatiando.gravmag import prism, imaging
from fatiando.vis.mpl import square
import matplotlib.pyplot as plt
import numpy as np

# Make some synthetic gravity data from a simple prism model
model = [mesher.Prism(-1000, 1000, -3000, 3000, 0, 2000, {'density': 800})]
shape = (25, 25)
xp, yp, zp = gridder.regular((-5000, 5000, -5000, 5000), shape, z=-10)
data = prism.gz(xp, yp, zp, model)

# Run the Generalized Inverse
mesh = imaging.geninv(xp, yp, zp, data, shape, zmin=0, zmax=5000, nlayers=25)

# Plot the results
fig = plt.figure()

X, Y = xp.reshape(shape)/1000, yp.reshape(shape)/1000
image = mesh.props['density'].reshape(mesh.shape)

# First plot the original gravity data
ax = plt.subplot(2, 2, 1)
ax.set_title('Gravity data (mGal)')
ax.set_aspect('equal')
scale = np.abs([data.min(), data.max()]).max()
tmp = ax.contourf(Y, X, data.reshape(shape), 30, cmap="RdBu_r", vmin=-scale,
                  vmax=scale)
plt.colorbar(tmp, ax=ax, pad=0)
Beispiel #4
0
"""
from __future__ import division
from fatiando import gridder, mesher
from fatiando.gravmag import prism, imaging
from fatiando.vis.mpl import square
import matplotlib.pyplot as plt
import numpy as np

# Make some synthetic gravity data from a simple prism model
model = [mesher.Prism(-1000, 1000, -3000, 3000, 0, 2000, {'density': 800})]
shape = (25, 25)
xp, yp, zp = gridder.regular((-5000, 5000, -5000, 5000), shape, z=-10)
data = prism.gz(xp, yp, zp, model)

# Run the Generalized Inverse
mesh = imaging.geninv(xp, yp, zp, data, shape, zmin=0, zmax=5000, nlayers=25)

# Plot the results
fig = plt.figure()

X, Y = xp.reshape(shape) / 1000, yp.reshape(shape) / 1000
image = mesh.props['density'].reshape(mesh.shape)

# First plot the original gravity data
ax = plt.subplot(2, 2, 1)
ax.set_title('Gravity data (mGal)')
ax.set_aspect('equal')
scale = np.abs([data.min(), data.max()]).max()
tmp = ax.contourf(Y,
                  X,
                  data.reshape(shape),