Example #1
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()
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()
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,
    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
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,
                 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],