def plot_data():
    data = numpy.loadtxt('data.txt', unpack=True)
    predicted = numpy.loadtxt('predicted.txt', unpack=True, usecols=[3, 4, 5])
    xs, ys = numpy.loadtxt('seeds.txt', unpack=True, usecols=[0, 1])
    x, y, z = data[0:3]
    tensor = data[-3:]
    shape = (60, 100)
    for comp, pred in zip(tensor, predicted):
        pyplot.figure(figsize=(4, 4))
        pyplot.subplots_adjust(bottom=0.2)
        pyplot.axis('scaled')
        levels = vis.contourf(y * 0.001,
                              x * 0.001,
                              comp,
                              shape,
                              8,
                              interpolate=True)
        pyplot.colorbar()
        vis.contour(y * 0.001,
                    x * 0.001,
                    pred,
                    shape,
                    levels,
                    interpolate=True)
        pyplot.plot(ys * 0.001, xs * 0.001, '.w')
        pyplot.xlabel('Horizontal coordinate y (km)')
        pyplot.ylabel('Horizontal coordinate x (km)')
    pyplot.show()
def plot_result():
    data = numpy.loadtxt("data.txt", unpack=True)
    x, y, z, topo = data[0:4]
    tensor = data[-3:]

    # Load the inversion results
    with open(sys.argv[1]) as f:
        results = pickle.load(f)
    predicted = results["predicted"]

    shape = (60, 100)
    for true, pred in zip(tensor, predicted):
        pyplot.figure()
        pyplot.axis("scaled")
        levels = vis.contourf(y * 0.001, x * 0.001, true, shape, 12, interpolate=True)
        pyplot.colorbar()
        vis.contour(y * 0.001, x * 0.001, pred, shape, levels, color="k", interpolate=True)
        pyplot.xlabel("Horizontal coordinate y (km)")
        pyplot.ylabel("Horizontal coordinate x (km)")
    pyplot.show()

    extent = [x.min(), x.max(), y.min(), y.max(), -topo.max(), -400]
    # density_model = vfilter(900, 1200, 'density', results['mesh'])
    seeds = [results["mesh"][s] for s in results["seeds"]]

    vis.mayavi_figure()
    vis.prisms3D(seeds, extract("density", seeds), vmin=0)
    # vis.prisms3D(density_model, extract('density', density_model), vmin=0)
    vis.prisms3D(results["mesh"], results["mesh"].props["density"], vmin=0)
    vis.add_axes3d(vis.add_outline3d(extent), ranges=[i * 0.001 for i in extent], fmt="%.1f", nlabels=6)
    vis.wall_bottom(extent)
    vis.wall_north(extent)
    vis.mlab.show()
Exemple #3
0
def plot_synth():
    # Load synthetic data
    data = numpy.loadtxt('data.txt', unpack=True)
    x, y, z = data[0:3]
    tensor = data[-3:]
    with open('model.pickle') as f:
        model = pickle.load(f)
    for comp in tensor:
        shape = (51, 51)
        pyplot.figure(figsize=(5, 4))
        pyplot.axis('scaled')
        levels = vis.contourf(y * 0.001, x * 0.001, comp, shape, 8)
        vis.contour(y * 0.001, x * 0.001, comp, shape, levels)
        pyplot.xlabel('Horizontal coordinate y (km)')
        pyplot.ylabel('Horizontal coordinate x (km)')
    pyplot.show()

    extent = [0, 5000, 0, 5000, 0, 1500]
    vis.mayavi_figure()
    vis.prisms3D(model, extract('density', model))
    vis.add_axes3d(vis.add_outline3d(extent),
                   ranges=[i * 0.001 for i in extent],
                   fmt='%.1f',
                   nlabels=6)
    vis.wall_bottom(extent)
    vis.wall_north(extent)
    vis.mlab.show()
def plot_synth():
    # Load synthetic data
    data = numpy.loadtxt('data.txt', unpack=True)
    x, y, z = data[0:3]
    tensor = data[3:]
    with open('model.pickle') as f:
        model = pickle.load(f)
    for comp in tensor:
        shape = (26, 26)
        pyplot.figure(figsize=(5,4))
        pyplot.axis('scaled')
        levels = vis.contourf(y*0.001, x*0.001, comp, shape, 8)
        vis.contour(y*0.001, x*0.001, comp, shape, levels)
        pyplot.xlabel('Horizontal coordinate y (km)')
        pyplot.ylabel('Horizontal coordinate x (km)')
    pyplot.show()
    
    extent = [0, 5000, 0, 5000, 0, 1000]    
    vis.mayavi_figure()
    vis.prisms3D(model, extract('density', model))
    vis.add_axes3d(vis.add_outline3d(extent), ranges=[i*0.001 for i in extent],
        fmt='%.1f', nlabels=6)
    vis.wall_bottom(extent)
    vis.wall_north(extent)
    vis.mlab.show()
def plot_result():
    data = numpy.loadtxt('data.txt', unpack=True)
    x, y, z, topo = data[0:4]
    tensor = data[-3:]

    # Load the inversion results
    with open(sys.argv[1]) as f:
        results = pickle.load(f)
    predicted = results['predicted']

    shape = (60, 100)
    for true, pred in zip(tensor, predicted):
        pyplot.figure()
        pyplot.axis('scaled')
        levels = vis.contourf(y * 0.001,
                              x * 0.001,
                              true,
                              shape,
                              12,
                              interpolate=True)
        pyplot.colorbar()
        vis.contour(y * 0.001,
                    x * 0.001,
                    pred,
                    shape,
                    levels,
                    color='k',
                    interpolate=True)
        pyplot.xlabel('Horizontal coordinate y (km)')
        pyplot.ylabel('Horizontal coordinate x (km)')
    pyplot.show()

    extent = [x.min(), x.max(), y.min(), y.max(), -topo.max(), -400]
    #density_model = vfilter(900, 1200, 'density', results['mesh'])
    seeds = [results['mesh'][s] for s in results['seeds']]

    vis.mayavi_figure()
    vis.prisms3D(seeds, extract('density', seeds), vmin=0)
    #vis.prisms3D(density_model, extract('density', density_model), vmin=0)
    vis.prisms3D(results['mesh'], results['mesh'].props['density'], vmin=0)
    vis.add_axes3d(vis.add_outline3d(extent),
                   ranges=[i * 0.001 for i in extent],
                   fmt='%.1f',
                   nlabels=6)
    vis.wall_bottom(extent)
    vis.wall_north(extent)
    vis.mlab.show()
def plot_result():
    # Load synthetic data
    data = numpy.loadtxt('data.txt', unpack=True)
    x, y, z = data[0:3]
    tensor = data[3:]
    with open('model.pickle') as f:
        model = pickle.load(f)

    # Load the inversion results
    with open(sys.argv[1]) as f:
        results = pickle.load(f)
    predicted = results['predicted']

    shape = (26, 26)
    names = ['gxx', 'gxy', 'gxz', 'gyy', 'gyz', 'gzz']
    i = 0
    for true, pred in zip(tensor, predicted):
        pyplot.figure(figsize=(3.33, 4))
        pyplot.axis('scaled')
        levels = vis.contourf(y * 0.001, x * 0.001, true, shape, 8)
        cb = pyplot.colorbar(orientation='horizontal', shrink=0.95)
        cb.set_ticks([l for j, l in enumerate(levels) if j % 2 != 0])
        vis.contour(y * 0.001, x * 0.001, pred, shape, levels, color='k')
        pyplot.xlabel('Horizontal coordinate y (km)')
        pyplot.ylabel('Horizontal coordinate x (km)')
        pyplot.savefig('.'.join([names[i], 'pdf']))
        i += 1
    pyplot.show()

    extent = [0, 5000, 0, 5000, 0, 1000]
    density_model = vfilter(-2000, -1, 'density', results['mesh'])
    density_model.extend(vfilter(1, 2000, 'density', results['mesh']))
    seeds = [results['mesh'][s] for s in results['seeds']]

    vis.mayavi_figure()
    vis.prisms3D(model, extract('density', model), style='wireframe')
    vis.prisms3D(seeds, extract('density', seeds))
    vis.prisms3D(density_model, extract('density', density_model))
    vis.add_axes3d(vis.add_outline3d(extent),
                   ranges=[i * 0.001 for i in extent],
                   fmt='%.1f',
                   nlabels=3)
    vis.wall_bottom(extent)
    vis.wall_north(extent)
    vis.mlab.show()
def plot_data():
    data = numpy.loadtxt("data.txt", unpack=True)
    predicted = numpy.loadtxt("predicted.txt", unpack=True, usecols=[3, 4, 5])
    xs, ys = numpy.loadtxt("seeds.txt", unpack=True, usecols=[0, 1])
    x, y, z = data[0:3]
    tensor = data[-3:]
    shape = (60, 100)
    for comp, pred in zip(tensor, predicted):
        pyplot.figure(figsize=(4, 4))
        pyplot.subplots_adjust(bottom=0.2)
        pyplot.axis("scaled")
        levels = vis.contourf(y * 0.001, x * 0.001, comp, shape, 8, interpolate=True)
        pyplot.colorbar()
        vis.contour(y * 0.001, x * 0.001, pred, shape, levels, interpolate=True)
        pyplot.plot(ys * 0.001, xs * 0.001, ".w")
        pyplot.xlabel("Horizontal coordinate y (km)")
        pyplot.ylabel("Horizontal coordinate x (km)")
    pyplot.show()
def plot_result():
    # Load synthetic data
    data = numpy.loadtxt('data.txt', unpack=True)
    x, y, z = data[0:3]
    tensor = data[3:]
    with open('model.pickle') as f:
        model = pickle.load(f)

    # Load the inversion results
    with open(sys.argv[1]) as f:
        results = pickle.load(f)
    predicted = results['predicted']

    shape = (26, 26)
    names = ['gxx', 'gxy', 'gxz', 'gyy', 'gyz', 'gzz']
    i = 0
    for true, pred in zip(tensor, predicted):
        pyplot.figure(figsize=(3.33,4))
        pyplot.axis('scaled')
        levels = vis.contourf(y*0.001, x*0.001, true, shape, 8)
        cb = pyplot.colorbar(orientation='horizontal', shrink=0.95)
        cb.set_ticks([l for j, l in enumerate(levels) if j%2 != 0])
        vis.contour(y*0.001, x*0.001, pred, shape, levels, color='k')
        pyplot.xlabel('Horizontal coordinate y (km)')
        pyplot.ylabel('Horizontal coordinate x (km)')
        pyplot.savefig('.'.join([names[i], 'pdf']))
        i += 1
    pyplot.show()

    extent = [0, 5000, 0, 5000, 0, 1000]
    density_model = vfilter(-2000, -1, 'density', results['mesh'])
    density_model.extend(vfilter(1, 2000, 'density', results['mesh']))
    seeds = [results['mesh'][s] for s in results['seeds']]

    vis.mayavi_figure()
    vis.prisms3D(model, extract('density', model), style='wireframe')
    vis.prisms3D(seeds, extract('density', seeds))
    vis.prisms3D(density_model, extract('density', density_model))
    vis.add_axes3d(vis.add_outline3d(extent), ranges=[i*0.001 for i in extent],
        fmt='%.1f', nlabels=3)
    vis.wall_bottom(extent)
    vis.wall_north(extent)
    vis.mlab.show()
Exemple #9
0
def plot_result():
    # Load synthetic data
    data = numpy.loadtxt('data.txt', unpack=True)
    x, y, z = data[0:3]
    tensor = data[-3:]
    with open('model.pickle') as f:
        model = pickle.load(f)

    # Load the inversion results
    with open(sys.argv[1]) as f:
        results = pickle.load(f)
    predicted = results['predicted']

    shape = (51, 51)
    for true, pred in zip(tensor, predicted):
        pyplot.figure(figsize=(5, 4))
        pyplot.axis('scaled')
        levels = vis.contourf(y * 0.001, x * 0.001, true, shape, 8)
        pyplot.colorbar()
        vis.contour(y * 0.001, x * 0.001, pred, shape, levels, color='k')
        pyplot.xlabel('Horizontal coordinate y (km)')
        pyplot.ylabel('Horizontal coordinate x (km)')
    pyplot.show()

    extent = [0, 5000, 0, 5000, 0, 1500]
    density_model = vfilter(1100, 1200, 'density', results['mesh'])
    seeds = [results['mesh'][s] for s in results['seeds']]

    vis.mayavi_figure()
    vis.prisms3D(model, extract('density', model), style='wireframe')
    vis.prisms3D(seeds, extract('density', seeds), vmin=0)
    vis.prisms3D(density_model, extract('density', density_model), vmin=0)
    vis.add_axes3d(vis.add_outline3d(extent),
                   ranges=[i * 0.001 for i in extent],
                   fmt='%.1f',
                   nlabels=6)
    vis.wall_bottom(extent)
    vis.wall_north(extent)
    vis.mlab.show()
def plot_result():
    # Load synthetic data
    data = numpy.loadtxt('data.txt', unpack=True)
    x, y, z = data[0:3]
    tensor = data[-3:]
    with open('model.pickle') as f:
        model = pickle.load(f)

    # Load the inversion results
    with open(sys.argv[1]) as f:
        results = pickle.load(f)
    predicted = results['predicted']

    shape = (51, 51)
    for true, pred in zip(tensor, predicted):
        pyplot.figure(figsize=(5,4))
        pyplot.axis('scaled')
        levels = vis.contourf(y*0.001, x*0.001, true, shape, 8)
        pyplot.colorbar()
        vis.contour(y*0.001, x*0.001, pred, shape, levels, color='k')
        pyplot.xlabel('Horizontal coordinate y (km)')
        pyplot.ylabel('Horizontal coordinate x (km)')
    pyplot.show()

    extent = [0, 5000, 0, 5000, 0, 1500]
    density_model = vfilter(1100, 1200, 'density', results['mesh'])
    seeds = [results['mesh'][s] for s in results['seeds']]

    vis.mayavi_figure()
    vis.prisms3D(model, extract('density', model), style='wireframe')
    vis.prisms3D(seeds, extract('density', seeds), vmin=0)
    vis.prisms3D(density_model, extract('density', density_model), vmin=0)
    vis.add_axes3d(vis.add_outline3d(extent), ranges=[i*0.001 for i in extent],
        fmt='%.1f', nlabels=6)
    vis.wall_bottom(extent)
    vis.wall_north(extent)
    vis.mlab.show()
Exemple #11
0
import cPickle as pickle
import numpy
from fatiando import vis
from fatiando.mesher.volume import extract, vfilter
pyplot = vis.pyplot

# Load the inversion results
name = sys.argv[1].split('.')[0]
with open(sys.argv[1]) as f:
    results = pickle.load(f)
predicted = results['predicted']

# Load synthetic data
data = numpy.loadtxt(sys.argv[2], unpack=True)
x, y, z = data[0:3]
tensor = data[3:]

fdir = 'figs'

shape = (51, 51)
pyplot.figure(figsize=(3.33,4))
pyplot.axis('scaled')
levels = vis.contourf(y*0.001, x*0.001, tensor[-1], shape, 6)
pyplot.colorbar(orientation='horizontal', shrink=0.8)
vis.contour(y*0.001, x*0.001, predicted[-1], shape, levels, color='k',
    style='dashed', linewidth=1.0)
pyplot.xlabel('Horizontal coordinate y (km)')
pyplot.ylabel('Horizontal coordinate x (km)')
pyplot.savefig('.'.join([name, 'pdf']))
#pyplot.show()
Exemple #12
0
posmodel = fatiando.mesh.vfilter(model, 1, 2000)
posdata = {}
for i, field in enumerate(fields):
    posdata[field] = synthetic.from_prisms(posmodel, x1=0, x2=5000, y1=0, y2=5000,
                                        nx=25, ny=25, height=150, field=field)
    posdata[field]['error'] = numpy.zeros(len(posdata[field]['value']))
    io.dump('%s_pos.txt' % (field), posdata[field])

# Plot the ajustment
pylab.figure(figsize=(16,8))
pylab.suptitle("Adjustment", fontsize=14)
for i, field in enumerate(fields):
    pylab.subplot(2, 3, i + 1)
    pylab.title(field)
    pylab.axis('scaled')
    levels = vis.contour(data[field], levels=5, color='b', label='Data',
                         xkey='y', ykey='x', nx=31, ny=31)
    vis.contour(adjusted[field], levels=levels, color='r', label='Adjusted',
                         xkey='y', ykey='x', nx=31, ny=31)
    pylab.legend(loc='lower right', prop={'size':9}, shadow=True)
    pylab.xlabel("Easting [m]")
    pylab.ylabel("Northing [m]")
    
for i, field in enumerate(fields):
    pylab.subplot(2, 3, i + 4)
    pylab.title(field)
    pylab.axis('scaled')
    levels = vis.contour(posdata[field], levels=5, color='b', label='Data',
                         xkey='y', ykey='x', nx=31, ny=31)
    vis.contour(adjusted[field], levels=levels, color='r', label='Adjusted',
                         xkey='y', ykey='x', nx=31, ny=31)
    pylab.legend(loc='lower right', prop={'size':9}, shadow=True)
Exemple #13
0
                                   y2=extent[1],
                                   nx=50,
                                   ny=25,
                                   height=0,
                                   field='gz')
data['gz']['value'], error = utils.contaminate(data['gz']['value'],
                                               stddev=error,
                                               percent=False,
                                               return_stddev=True)
data['gz']['error'] = error * numpy.ones(len(data['gz']['value']))
io.dump('gz.txt', data['gz'])

# Plot the data
pylab.figure()
pylab.axis('scaled')
vis.contour(data['gz'], 8, xkey='y', ykey='x', nx=31, ny=61)
#cb = pylab.colorbar()
#cb.set_label('mGal')
pylab.xlabel("Easting (m)")
pylab.ylabel("Northing (m)")
pylab.savefig("data_raw.pdf")
pylab.show()

# RUN THE INVERSION
################################################################################
# Generate a model space mesh
x1, x2 = extent[2], extent[3]
y1, y2 = extent[0], extent[1]
z1, z2 = extent[5] + 0.1, -1 * extent[4]
mesh = fatiando.mesh.prism_mesh(x1=x1,
                                x2=x2,
Exemple #14
0
#vis.residuals_histogram(residuals)
#pylab.xlabel('Eotvos')
#ax = pylab.subplot(2,1,2)
#pylab.title("Goal function and RMS")
#pylab.plot(goals, '.-b', label="Goal Function")
#pylab.plot(misfits, '.-r', label="Misfit")
#pylab.xlabel("Iteration")
#pylab.legend(loc='upper left', prop={'size':9}, shadow=True)
#ax.set_yscale('log')
#ax.grid()
#pylab.savefig('residuals.pdf')

# Plot the ajustment
pylab.figure()
pylab.axis('scaled')
levels = vis.contour(data, levels=5, color='b', label='Data',
                        xkey='y', ykey='x', nx=31, ny=61)
vis.contour(adjusted, levels=levels, color='r', label='Predicted',
                        xkey='y', ykey='x', nx=31, ny=61)
pylab.legend(loc='lower right', prop={'size':9}, shadow=True)
pylab.xlabel("Easting (km)")
pylab.ylabel("Northing (km)")
#pylab.savefig("adjustment_raw.pdf")

pylab.show()

# Plot the adjusted model plus the skeleton of the synthetic model
fig = mlab.figure()
fig.scene.background = (1, 1, 1)
vis.plot_prism_mesh(model, style='wireframe', xy2ne=True)
vis.plot_prism_mesh(seed_mesh, style='surface', xy2ne=True)
plot = vis.plot_prism_mesh(corpo, style='surface', xy2ne=True)
Exemple #15
0
adjusted = gplant.adjustment(data, residuals)
with open("adj.pickle", 'w') as f:
    pickle.dump(adjusted, f)
with open('mesh.pickle', 'w') as f:
    pickle.dump(mesh, f)
with open("seeds.pickle", 'w') as f:
    pickle.dump(seed_mesh, f)

# PLOT THE INVERSION RESULTS
################################################################################
log.info("Plotting")

field = 'gz'
pylab.figure()
pylab.axis('scaled')
levels = vis.contour(data[field], levels=8, color='b')
vis.contour(adjusted[field], levels=levels, color='r')
pylab.show()

# Plot the adjusted model plus the skeleton of the synthetic model
fig = mlab.figure()
fig.scene.background = (1, 1, 1)

p = vis.plot_prism_mesh(seed_mesh, style='surface')
p = vis.plot_prism_mesh(model, style='wireframe')
p = vis.plot_prism_mesh(fatiando.mesh.vfilter(mesh,1,2000), style='surface', opacity=0.4)

a = mlab.axes(p, nb_labels=0, extent=extent, color=(0,0,0))
a.label_text_property.color = (0,0,0)
a.title_text_property.color = (0,0,0)
a.axes.label_format = ""
Exemple #16
0
sdens.append(-400)
spoints.append((11920, 16070, -950))
sdens.append(-400)
spoints.append((11670, 15225, -900))
sdens.append(-400)

seeds = [gplant.get_seed(p, dens, mesh) for p, dens in zip(spoints, sdens)]

# Make a mesh for the seeds to plot them
seed_mesh = numpy.array([seed['cell'] for seed in seeds])

# Show the seeds before starting
pylab.figure()
pylab.axis('scaled')
l = vis.contourf(data['gzz'], 10, nx=40, ny=60)
vis.contour(data['gzz'], l, nx=40, ny=60)
for p in spoints:
    pylab.plot(p[0], p[1], '*k', markersize=9)
labels = pylab.gca().get_xticklabels()
for label in labels:
    label.set_rotation(30)
pylab.savefig('seeds.pdf')
pylab.xlabel('Northing [m]')
pylab.ylabel('Easting [m]')

pylab.show()

fig = mlab.figure()
fig.scene.background = (1, 1, 1)
fig.scene.camera.yaw(230)
plot = vis.plot_prism_mesh(mesh, opacity=0.4)
Exemple #17
0
    pylab.title(field)
    pylab.axis('scaled')
    #pylab.plot(data['x'], data['y'], '.k')
    vis.contourf(data, levels, nx=nx, ny=ny)
    vis.contourf(data, levels, nx=nx, ny=ny)
    cb = pylab.colorbar()
    cb.set_label(r'$E\"otv\"os$', fontsize=14)
    labels = ax.get_xticklabels()
    for label in labels:
        label.set_rotation(angle)
    pylab.xlabel('Northing [m]')
    pylab.ylabel('Easting [m]')

pylab.savefig("ftg_data_raw.pdf")

datatopo = io.load_topo('topo.txt')

pylab.figure(figsize=(8,10))
pylab.title("Topography [m]")
pylab.axis('scaled')
levelslist = vis.contourf(datatopo, levels, vkey='h', nx=nx, ny=ny)
vis.contour(datatopo, levelslist, vkey='h', nx=nx, ny=ny)
labels = pylab.gca().get_xticklabels()
for label in labels:
    label.set_rotation(angle)
pylab.xlabel('Northing [m]')
pylab.ylabel('Easting [m]')

pylab.savefig("topo_raw.pdf")

pylab.show()
Exemple #18
0
sdens.append(-400)
spoints.append((11920, 16070, -950))
sdens.append(-400)
spoints.append((11670, 15225, -900))
sdens.append(-400)

seeds = [gplant.get_seed(p, dens, mesh) for p, dens in zip(spoints, sdens)]

# Make a mesh for the seeds to plot them
seed_mesh = numpy.array([seed['cell'] for seed in seeds])

# Show the seeds before starting
pylab.figure()
pylab.axis('scaled')
l = vis.contourf(data['gzz'], 10, nx=40, ny=60)
vis.contour(data['gzz'], l, nx=40, ny=60)
for p in spoints:
    pylab.plot(p[0], p[1], '*k', markersize=9)
labels = pylab.gca().get_xticklabels()
for label in labels:
    label.set_rotation(30)
pylab.savefig('seeds.pdf')
pylab.xlabel('Northing [m]')
pylab.ylabel('Easting [m]')

pylab.show()

fig = mlab.figure()
fig.scene.background = (1, 1, 1)
fig.scene.camera.yaw(230)
plot = vis.plot_prism_mesh(mesh, opacity=0.4)
Exemple #19
0
                                           height=150,
                                           field=field)
    posdata[field]['error'] = numpy.zeros(len(posdata[field]['value']))
    io.dump('%s_pos.txt' % (field), posdata[field])

# Plot the ajustment
pylab.figure(figsize=(16, 8))
pylab.suptitle("Adjustment", fontsize=14)
for i, field in enumerate(fields):
    pylab.subplot(2, 3, i + 1)
    pylab.title(field)
    pylab.axis('scaled')
    levels = vis.contour(data[field],
                         levels=5,
                         color='b',
                         label='Data',
                         xkey='y',
                         ykey='x',
                         nx=31,
                         ny=31)
    vis.contour(adjusted[field],
                levels=levels,
                color='r',
                label='Adjusted',
                xkey='y',
                ykey='x',
                nx=31,
                ny=31)
    pylab.legend(loc='lower right', prop={'size': 9}, shadow=True)
    pylab.xlabel("Easting [m]")
    pylab.ylabel("Northing [m]")
Exemple #20
0
    pylab.title(field)
    pylab.axis('scaled')
    #pylab.plot(data['x'], data['y'], '.k')
    vis.contourf(data, levels, nx=nx, ny=ny)
    vis.contourf(data, levels, nx=nx, ny=ny)
    cb = pylab.colorbar()
    cb.set_label(r'$E\"otv\"os$', fontsize=14)
    labels = ax.get_xticklabels()
    for label in labels:
        label.set_rotation(angle)
    pylab.xlabel('Northing [m]')
    pylab.ylabel('Easting [m]')

pylab.savefig("ftg_data_raw.pdf")

datatopo = io.load_topo('topo.txt')

pylab.figure(figsize=(8, 10))
pylab.title("Topography [m]")
pylab.axis('scaled')
levelslist = vis.contourf(datatopo, levels, vkey='h', nx=nx, ny=ny)
vis.contour(datatopo, levelslist, vkey='h', nx=nx, ny=ny)
labels = pylab.gca().get_xticklabels()
for label in labels:
    label.set_rotation(angle)
pylab.xlabel('Northing [m]')
pylab.ylabel('Easting [m]')

pylab.savefig("topo_raw.pdf")

pylab.show()
Exemple #21
0
    data[field]['y'] = tmp
    tmp =  posdata[field]['x']*0.001
    posdata[field]['x'] = posdata[field]['y']*0.001
    posdata[field]['y'] = tmp
    tmp =  adjusted[field]['x']*0.001
    adjusted[field]['x'] = adjusted[field]['y']*0.001
    adjusted[field]['y'] = tmp

# Get the adjustment and plot it
pylab.figure(figsize=(16,8))
pylab.subplots_adjust(hspace=0.3)
for i, field in enumerate(fields):
    pylab.subplot(2, 3, i + 1)
    pylab.title(field)
    pylab.axis('scaled')
    levels = vis.contour(data[field], levels=5, color='k', label='Data')
    for c in pylab.gca().collections:
        c.set_linestyle('dashed')
        c.set_linewidth(1.5)
    vis.contour(adjusted[field], levels=levels, color='r', label='Adjusted', clabel=False)
    for c in pylab.gca().collections[len(levels):]:
        c.set_linestyle('solid')
        c.set_linewidth(1.5)
    pylab.xlabel("Easting (km)")
    pylab.ylabel("Northing (km)")
for i, field in enumerate(fields):
    pylab.subplot(2, 3, i + 4)
    pylab.title(field)
    pylab.axis('scaled')
    levels = vis.contour(posdata[field], levels=5, color='k', label='Data')
    for c in pylab.gca().collections:
Exemple #22
0
with open("data.pickle") as f:
    data = pickle.load(f)['gz']
with open("adj.pickle") as f:
    adj = pickle.load(f)['gz']

def xy2ne(g):
    g['x'], g['y'] = g['y'], g['x']
    return g

xy2ne(data)
xy2ne(adj)
    
pylab.figure()
pylab.axis('scaled')
levels = vis.contour(data, levels=8, color='b', label="Observed")
vis.contour(adj, levels=levels, color='r', label="Predicted")
pylab.xlabel("E (km)")
pylab.ylabel("N (km)")

pylab.figure()
pylab.axis('scaled')
levels = vis.contourf(data, levels=8)
vis.contour(data, levels=levels, color='k')
pylab.xlabel("E (km)")
pylab.ylabel("N (km)")

pylab.figure()
pylab.axis('scaled')
levels = vis.contourf(adj, levels=8)
vis.contour(adj, levels=levels, color='k')
Exemple #23
0
    pickle.dump(changes, f)
with open("adj.pickle", 'w') as f:
    pickle.dump(adjusted, f)
with open('mesh.pickle', 'w') as f:
    pickle.dump(mesh, f)
with open("seeds.pickle", 'w') as f:
    pickle.dump(seed_mesh, f)

# PLOT THE INVERSION RESULTS
################################################################################
log.info("Plotting")

field = 'gz'
pylab.figure()
pylab.axis('scaled')
levels = vis.contour(data[field], levels=8, color='b')
vis.contour(adjusted[field], levels=levels, color='r')
pylab.show()

# Plot the adjusted model plus the skeleton of the synthetic model
fig = mlab.figure()
fig.scene.background = (1, 1, 1)

p = vis.plot_prism_mesh(seed_mesh, style='surface')
p = vis.plot_prism_mesh(model, style='wireframe')
p = vis.plot_prism_mesh(fatiando.mesh.vfilter(mesh,1,2000), style='surface', opacity=0.4)

a = mlab.axes(p, nb_labels=0, extent=extent, color=(0,0,0))
a.label_text_property.color = (0,0,0)
a.title_text_property.color = (0,0,0)
a.axes.label_format = ""
Exemple #24
0
pylab.suptitle(r'Adjustment [$E\"otv\"os$]', fontsize=16)
pylab.subplots_adjust(hspace=0.3)

nx, ny = 33, 33

for i, field in enumerate(['gxx', 'gxy', 'gxz', 'gyy', 'gyz', 'gzz']):

    if field in data:

        pylab.subplot(2, 3, i + 1)
        #pylab.figure()
        pylab.title(field)
        pylab.axis('scaled')
        levels = vis.contour(adjusted[field],
                             levels=5,
                             color='r',
                             label='Adjusted',
                             clabel=False)
        for c in pylab.gca().collections:
            c.set_linestyle('solid')
            c.set_linewidth(1.5)
        vis.contour(data[field], levels=levels, color='k', label='Data')
        for c in pylab.gca().collections[len(levels):]:
            c.set_linestyle('dashed')
            c.set_linewidth(1.5)
        pylab.xlabel('Easting (km)')
        pylab.ylabel('Northing (km)')
        #pylab.savefig("adjustment_%s.pdf" % (field))

pylab.legend(loc='lower left', prop={'size': 9}, shadow=True)
#pylab.savefig("comparison_raw.pdf")
Exemple #25
0
ax.grid()

pylab.savefig('residuals_raw.pdf')

# Get the adjustment and plot it
pylab.figure(figsize=(16,8))
pylab.suptitle(r'Adjustment [$E\"otv\"os$]', fontsize=16)

for i, field in enumerate(['gxx', 'gxy', 'gxz', 'gyy', 'gyz', 'gzz']):
    
    if field in data:
        
        pylab.subplot(2, 3, i + 1)    
        pylab.title(field)    
        pylab.axis('scaled')    
        levels = vis.contour(data[field], levels=5, color='b', label='Data')
        vis.contour(adjusted[field], levels=levels, color='r', label='Adjusted')
        #pylab.legend(loc='lower left', prop={'size':9}, shadow=True)
        pylab.xlabel('X [m]')
        pylab.ylabel('Y [m]')

pylab.savefig("adjustment_raw.pdf")

pylab.show()

# Plot the adjusted model plus the skeleton of the synthetic model
fig = mlab.figure()
fig.scene.background = (1, 1, 1)
vis.plot_prism_mesh(synthetic, style='wireframe')
vis.plot_prism_mesh(seed_mesh, style='surface')
plot = vis.plot_prism_mesh(mesh, style='surface')