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()
Exemple #3
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()
    results = pickle.load(f)
    
modelfile = __import__(sys.argv[2].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]
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
        -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]
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],