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()
Example #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()
Example #4
0
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()
Example #5
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 = (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_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()
Example #7
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()
    s.scene.camera.compute_view_plane_normal()
    s.scene.render()

extent = [0, 1000, 0, 1000, 0, 1000]
density_model = vfilter(1, 2000, 'density', results['mesh'])
seeds = [results['mesh'][s] for s in results['seeds']]
fmt = 'png'

f = vis.mayavi_figure(size=(900,900))
p = vis.prisms3D(model, extract('density', model), style='wireframe')
p.actor.mapper.scalar_visibility = False
p.actor.property.color = (0,0,0)
p.actor.property.line_width = 5
p = vis.prisms3D(seeds, extract('density', seeds), vmin=0, vmax=2000,
    cmap='gist_yarg')
vis.add_outline3d(extent)
#a = vis.add_axes3d(vis.add_outline3d(extent), ranges=[i*0.001 for i in extent],
    #fmt='%.1f', nlabels=3)
#a.axes.x_label, a.axes.y_label, a.axes.z_label = '', '', ''
#a.axes.font_factor = 2
vis.wall_north(extent)
vis.wall_bottom(extent)
setview(f)
vis.mlab.savefig('.'.join([name + '-seeds', fmt]))

f = vis.mayavi_figure(size=(900,900))
p = vis.prisms3D(model, extract('density', model), style='wireframe')
p.actor.mapper.scalar_visibility = False
p.actor.property.color = (0,0,0)
p.actor.property.line_width = 5
p = vis.prisms3D(density_model, extract('density', density_model), vmin=0,
from fatiando import vis
from fatiando.mesher.volume import extract

modelfile = __import__(sys.argv[1].split(".")[0])
model = modelfile.model


def setview(s):
    s.scene.camera.position = [-2263.7301544182874, 488.95715870190594, 318.19750997028473]
    s.scene.camera.focal_point = [490.77486582744939, 489.04595996051546, 562.78867616870843]
    s.scene.camera.view_angle = 30.0
    s.scene.camera.view_up = [0.088448540522960639, -0.0026066904949591562, -0.99607733677863675]
    s.scene.camera.clipping_range = [1662.1503239591332, 4168.9269870750722]
    s.scene.camera.compute_view_plane_normal()
    s.scene.render()


extent = [0, 1000, 0, 1000, 0, 1000]
fmt = "pdf"

f = vis.mayavi_figure(size=(900, 900))
p = vis.prisms3D(model, extract("density", model), style="wireframe")
p.actor.actor.visibility = False
a = vis.add_axes3d(vis.add_outline3d(extent), ranges=[i * 0.001 for i in extent], fmt="%.1f", nlabels=3)
# a.axes.x_label, a.axes.y_label, a.axes.z_label = '', '', ''
a.axes.font_factor = 2
setview(f)
vis.mlab.savefig(".".join(["axis", fmt]))

# vis.mlab.show()
        -2263.7301544182874, 488.95715870190594, 318.19750997028473
    ]
    s.scene.camera.focal_point = [
        490.77486582744939, 489.04595996051546, 562.78867616870843
    ]
    s.scene.camera.view_angle = 30.0
    s.scene.camera.view_up = [
        0.088448540522960639, -0.0026066904949591562, -0.99607733677863675
    ]
    s.scene.camera.clipping_range = [1662.1503239591332, 4168.9269870750722]
    s.scene.camera.compute_view_plane_normal()
    s.scene.render()


extent = [0, 1000, 0, 1000, 0, 1000]
fmt = 'pdf'

f = vis.mayavi_figure(size=(900, 900))
p = vis.prisms3D(model, extract('density', model), style='wireframe')
p.actor.actor.visibility = False
a = vis.add_axes3d(vis.add_outline3d(extent),
                   ranges=[i * 0.001 for i in extent],
                   fmt='%.1f',
                   nlabels=3)
#a.axes.x_label, a.axes.y_label, a.axes.z_label = '', '', ''
a.axes.font_factor = 2
setview(f)
vis.mlab.savefig('.'.join(["axis", fmt]))

#vis.mlab.show()
extent = [0, 1000, 0, 1000, 0, 1000]
density_model = vfilter(1, 2000, 'density', results['mesh'])
seeds = [results['mesh'][s] for s in results['seeds']]
fmt = 'png'

f = vis.mayavi_figure(size=(900, 900))
p = vis.prisms3D(model, extract('density', model), style='wireframe')
p.actor.mapper.scalar_visibility = False
p.actor.property.color = (0, 0, 0)
p.actor.property.line_width = 5
p = vis.prisms3D(seeds,
                 extract('density', seeds),
                 vmin=0,
                 vmax=2000,
                 cmap='gist_yarg')
vis.add_outline3d(extent)
#a = vis.add_axes3d(vis.add_outline3d(extent), ranges=[i*0.001 for i in extent],
#fmt='%.1f', nlabels=3)
#a.axes.x_label, a.axes.y_label, a.axes.z_label = '', '', ''
#a.axes.font_factor = 2
vis.wall_north(extent)
vis.wall_bottom(extent)
setview(f)
vis.mlab.savefig('.'.join([name + '-seeds', fmt]))

f = vis.mayavi_figure(size=(900, 900))
p = vis.prisms3D(model, extract('density', model), style='wireframe')
p.actor.mapper.scalar_visibility = False
p.actor.property.color = (0, 0, 0)
p.actor.property.line_width = 5
p = vis.prisms3D(density_model,
Example #13
0
with open(sys.argv[1]) as f:
    model = pickle.load(f)

def setview(s):
    s.scene.camera.position = [-2263.7301544182874, 488.95715870190594, 318.19750997028473]
    s.scene.camera.focal_point = [490.77486582744939, 489.04595996051546, 562.78867616870843]
    s.scene.camera.view_angle = 30.0
    s.scene.camera.view_up = [0.088448540522960639, -0.0026066904949591562, -0.99607733677863675]
    s.scene.camera.clipping_range = [1662.1503239591332, 4168.9269870750722]
    s.scene.camera.compute_view_plane_normal()
    s.scene.render()

extent = [0, 1000, 0, 1000, 0, 1000]
fmt = 'png'

f = vis.mayavi_figure(size=(900,900))
p = vis.prisms3D(model, extract('density', model), vmin=0, vmax=2000,
    cmap='gist_yarg')
a = vis.add_axes3d(vis.add_outline3d(extent), ranges=[i*0.001 for i in extent],
    fmt='%.1f', nlabels=3)
a.axes.x_label, a.axes.y_label, a.axes.z_label = '', '', ''
a.axes.font_factor = 2
vis.wall_north(extent)
vis.wall_bottom(extent)
setview(f)
vis.mlab.savefig('.'.join(['model', fmt]))


vis.mlab.show()