Example #1
0
def update(chset):
    mlab.get_engine().scenes[0].children[-1].remove()
    new = numpy.array([estimate[chset['new']]])
    pnew = vis.plot_prism_mesh(new, style='surface', xy2ne=True)    
    neighbors = numpy.array([setden(e, chset['dens']) for e in [estimate[n] for n in chset['nn']]])
    pnn = vis.plot_prism_mesh(neighbors, style='wireframe', xy2ne=True)
    pnn.actor.property.color = neighborcolor
    pnn.actor.property.line_width = 1
    pos = 0
    scale = 800
    Z = numpy.reshape(data['value'] - chset['res'], dshape)
    ct = mlab.contour_surf(X, Y, Z, contours=10, colormap='jet')
    ct.contour.filled_contours = True
    ct.actor.actor.position = (0,0,pos)
    ct.actor.actor.scale = (1,1,scale)
Example #2
0
def init(changes, ns):
    for chset in changes[0:ns]:
        seed = numpy.array([estimate[chset['new']]])
        pnew = vis.plot_prism_mesh(seed, style='surface', xy2ne=True)
        mlab.get_engine().scenes[0].children[-1].children[0].children[0].children[0].scalar_lut_manager.data_range = [0,1000]
         
        neighbors = numpy.array([setden(e, chset['dens']) for e in [estimate[n] for n in chset['nn']]])
        pnn = vis.plot_prism_mesh(neighbors, style='wireframe', xy2ne=True)
        pnn.actor.property.color = neighborcolor
        pnn.actor.property.line_width = 1
    pos = 0
    scale = 800
    Z = numpy.reshape(data['value'] - changes[ns-1]['res'], dshape)
    ct = mlab.contour_surf(X, Y, Z, contours=10, colormap='jet')
    ct.contour.filled_contours = True
    ct.actor.actor.position = (0,0,pos)
    ct.actor.actor.scale = (1,1,scale)
Example #3
0
import cPickle as pickle
from enthought.mayavi import mlab
from fatiando import mesh, vis, utils

with open("mesh.pickle") as f:
    res = pickle.load(f)

x1, x2 = 0, 3000
y1, y2 = 0, 3000
z1, z2 = 0, 3000
extent = [x1, x2, y1, y2, -z2, -z1]

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

p = vis.plot_prism_mesh(res, style='surface')
mlab.get_engine().scenes[0].children[-1].children[0].children[0].children[0].scalar_lut_manager.lut_mode = "Greys"

scene = fig
scene.scene.camera.position = [5617.6246210610589, 9378.6744914189112, 1832.0425527256102]
scene.scene.camera.focal_point = [1435.8921050117997, 1598.1461572098237, -1715.9026272606379]
scene.scene.camera.view_angle = 30.0
scene.scene.camera.view_up = [-0.18883236854009863, -0.3216128720649955, 0.92785101019163696]
scene.scene.camera.clipping_range = [4531.9434654515926, 15755.396726380868]
scene.scene.camera.compute_view_plane_normal()
scene.scene.render()

mlab.show()
Example #4
0
# PLOT THE INVERSION RESULTS
################################################################################
log.info("Plotting")

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

#p = vis.plot_prism_mesh(seed_mesh, style='surface')
#p.actor.mapper.scalar_visibility = False
#p.actor.property.edge_visibility = False
#p.actor.property.color = (0,0,0)

p = vis.plot_prism_mesh(fatiando.mesh.vfilter(mesh,900,1001), style='surface')
#p.actor.mapper.scalar_visibility = False
#p.actor.property.edge_visibility = False
#p.actor.property.color = (0,0,0)

p = vis.plot_prism_mesh(mesh, style='surface', opacity=0.4)
#p.actor.mapper.scalar_visibility = False
#p.actor.property.color = (0,0,0)
p.actor.property.line_width = 5

#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 = ""
#a.axes.x_label, a.axes.y_label, a.axes.z_label = "", "", ""
#a.property.line_width = 3
Example #5
0
with open("res.pickle") as f:
	res = pickle.load(f)
with open("mesh.pickle") as f:
	mesh = fatiando.mesh.vfilter(pickle.load(f),0,999)
with open("seeds.pickle") as f:
    seeds = pickle.load(f)

scene = mlab.figure(size=(1200,800))
scene.scene.background = (1, 1, 1)
view.bbox(mlab)

engine = mlab.get_engine()

surfs = []

surfs.append(vis.plot_prism_mesh(res, style='surface', xy2ne=True))
engine.scenes[0].children[-1].children[0].children[0].children[0].scalar_lut_manager.data_range = [0,1000]

surfs.append(vis.plot_prism_mesh(mesh, style='surface', xy2ne=True))
engine.scenes[0].children[-1].children[0].children[0].children[0].scalar_lut_manager.lut_mode = "Greys"

surfs.append(vis.plot_prism_mesh(seeds, style='surface', xy2ne=True))
engine.scenes[0].children[-1].children[0].children[0].children[0].scalar_lut_manager.lut_mode = "Greys"
engine.scenes[0].children[-1].children[0].children[0].children[0].scalar_lut_manager.data_range = [0,1000]

o = mlab.outline(color=(0,0,0), extent=extent)
o.actor.property.line_width = 1

a = mlab.axes(surfs[0], nb_labels=7, extent=extent, ranges=ranges, color=(0,0,0))
a.label_text_property.color = (0,0,0)
a.title_text_property.color = (0,0,0)
Example #6
0
                   props={'value': 1200}))
prisms.append(
    geometry.prism(x1=1500,
                   x2=4500,
                   y1=2500,
                   y2=3000,
                   z1=100,
                   z2=500,
                   props={'value': 1500}))

prisms = numpy.array(prisms)

# Show the model before calculating to make sure it's right
fig = mlab.figure()
fig.scene.background = (1, 1, 1)
dataset = vis.plot_prism_mesh(prisms, style='surface', label='Density kg/cm^3')
axes = mlab.axes(dataset, nb_labels=5, extent=[0, 5000, 0, 5000, -1000, 0])
mlab.show()

# Pickle the model so that it can be shown next to the inversion result later
modelfile = open('model.pickle', 'w')
pickle.dump(prisms, modelfile)
modelfile.close()

# Calculate all the components of the gradient tensor
error = 2

pylab.figure(figsize=(16, 8))
pylab.suptitle(r'Synthetic FTG data with %g $E\"otv\"os$ noise' % (error),
               fontsize=16)
pylab.subplots_adjust(wspace=0.4, hspace=0.3)
Example #7
0
    'x2': 55000,
    'y1': 35000,
    'y2': 42000,
    'z1': 0,
    'z2': 6000,
    'value': 400
})
model = numpy.array(model)

extent = [0, 50000, 0, 100000, -10000, 0]
ranges = [0, 50, 0, 100, 10, 0]

# Show the model before calculating to make sure it's right
fig = mlab.figure()
fig.scene.background = (1, 1, 1)
plot = vis.plot_prism_mesh(model, style='surface', xy2ne=True)
axes = mlab.axes(plot,
                 nb_labels=5,
                 extent=extent,
                 ranges=ranges,
                 color=(0, 0, 0))
axes.label_text_property.color = (0, 0, 0)
axes.title_text_property.color = (0, 0, 0)
axes.axes.label_format = "%-#.0f"
mlab.outline(color=(0, 0, 0), extent=extent)
mlab.show()

# Now calculate all the components of the gradient tensor
error = 0.5
data = {}
data['gz'] = synthetic.from_prisms(model,
Example #8
0
    pnn.actor.property.line_width = 1
    pos = 0
    scale = 800
    Z = numpy.reshape(data['value'] - chset['res'], dshape)
    ct = mlab.contour_surf(X, Y, Z, contours=10, colormap='jet')
    ct.contour.filled_contours = True
    ct.actor.actor.position = (0,0,pos)
    ct.actor.actor.scale = (1,1,scale)

def chcolor():    
    mlab.get_engine().scenes[0].children[-3].children[0].children[0].children[0].scalar_lut_manager.data_range = [0,1000]

scene = mlab.figure(size=(700,700))
scene.scene.background = (1, 1, 1)

p = vis.plot_prism_mesh(model, style='wireframe', xy2ne=True)
#p.actor.property.color = (0.8,0.8,0.8)
p.actor.actor.visibility = False

#p = vis.plot_prism_mesh(mesh, style='surface', xy2ne=True)
#mlab.get_engine().scenes[0].children[-1].children[0].children[0].children[0].scalar_lut_manager.lut_mode = "Greys"
#mlab.get_engine().scenes[0].children[-1].children[0].children[0].children[0].scalar_lut_manager.data_range = [0,1000]

#p = vis.plot_prism_mesh(vfilter(mesh,1,2000), style='surface', xy2ne=True)
#mlab.get_engine().scenes[0].children[-1].children[0].children[0].children[0].scalar_lut_manager.data_range = [0,1000]

a = mlab.axes(p, nb_labels=0, extent=extent, ranges=ranges, color=(0,0,0))
a.label_text_property.color = (0,0,0)
a.title_text_property.color = (0,0,0)
a.axes.font_factor = 1.2
a.axes.label_format = ""
Example #9
0
prisms = []
prisms.append(geometry.prism(x1=600, x2=1200, y1=200, y2=4200, z1=100, z2=600,
                             props={'value':1300}))
prisms.append(geometry.prism(x1=3000, x2=4000, y1=1000, y2=2000, z1=200, z2=800,
                             props={'value':1000}))
prisms.append(geometry.prism(x1=2700, x2=3200, y1=3700, y2=4200, z1=0, z2=900,
                             props={'value':1200}))
prisms.append(geometry.prism(x1=1500, x2=4500, y1=2500, y2=3000, z1=100, z2=500,
                             props={'value':1500}))

prisms = numpy.array(prisms)

# Show the model before calculating to make sure it's right
fig = mlab.figure()
fig.scene.background = (1, 1, 1)
dataset = vis.plot_prism_mesh(prisms, style='surface', label='Density kg/cm^3')
axes = mlab.axes(dataset, nb_labels=5, extent=[0,5000,0,5000,-1000,0])
mlab.show()

# Pickle the model so that it can be shown next to the inversion result later
modelfile = open('model.pickle', 'w') 
pickle.dump(prisms, modelfile)
modelfile.close()

# Calculate all the components of the gradient tensor
error = 2

pylab.figure(figsize=(16,8))
pylab.suptitle(r'Synthetic FTG data with %g $E\"otv\"os$ noise' 
               % (error), fontsize=16)
pylab.subplots_adjust(wspace=0.4, hspace=0.3)
Example #10
0
with open("mesh.pickle") as f:
    res = pickle.load(f)
with open("data.pickle") as f:
    data = pickle.load(f)

x1, x2 = 0, 3000
y1, y2 = 0, 3000
z1, z2 = 0, 3000
extent = [x1, x2, y1, y2, -z2, -z1]

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

p = vis.plot_prism_mesh(mesh.vfilter(res, 900, 2001),
                        style='surface',
                        opacity=1)
mlab.get_engine().scenes[0].children[-1].children[0].children[0].children[
    0].scalar_lut_manager.data_range = [0, 2000]

#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 = ""
#a.axes.x_label, a.axes.y_label, a.axes.z_label = "", "", ""
#a.property.line_width = 1

mlab.outline(p, extent=extent, color=(0, 0, 0))

pos = 1000
field = 'gz'
Example #11
0
with open("seeds.pickle") as f:
    seeds = numpy.array([seed['cell'] for seed in pickle.load(f)])

def setview(scene):
    pass
    
x1, x2 = -1530000, -1410000
y1, y2 = -5390000, -5340000
z1, z2 = -1000, 10000.
extent = [y1, y2, x1, x2, -z2, -z1]
ranges = [0,50,0,120,10,-1]

scene = mlab.figure(size=(1000,700))
scene.scene.background = (1, 1, 1)

p = vis.plot_prism_mesh(body, style='surface', xy2ne=True)
mlab.get_engine().scenes[0].children[-1].children[0].children[0].children[0].scalar_lut_manager.data_range = [0,390]

p = vis.plot_prism_mesh(seeds, style='surface', xy2ne=True)
mlab.get_engine().scenes[0].children[-1].children[0].children[0].children[0].scalar_lut_manager.data_range = [0,390]

a = mlab.axes(p, nb_labels=5, extent=extent, ranges=ranges, color=(0,0,0))
a.label_text_property.color = (0,0,0)
a.title_text_property.color = (0,0,0)
a.axes.font_factor = 1
a.axes.label_format = "%.1f"
a.axes.x_label, a.axes.y_label, a.axes.z_label = "E (km)", "N (km)", "Z (km)"

mlab.outline(color=(0,0,0), extent=extent)

setview(scene)
Example #12
0
                        y1=y1,
                        y2=y2,
                        z1=z1,
                        z2=z2,
                        nx=50,
                        ny=50,
                        nz=15)
mesh.fill(numpy.zeros(pmesh.size), pmesh)

extent = view.extent
ranges = view.ranges

scene = mlab.figure(size=view.size)
scene.scene.background = (1, 1, 1)

p = vis.plot_prism_mesh(pmesh, style='surface', xy2ne=True)
p.actor.property.line_width = 2

mlab.outline(color=(0, 0, 0), extent=extent)

a = mlab.axes(p, nb_labels=5, extent=extent, ranges=ranges, color=(0, 0, 0))
a.label_text_property.color = (0, 0, 0)
a.title_text_property.color = (0, 0, 0)
a.property.line_width = 1
a.axes.label_format = "%-#.1f"
a.axes.x_label, a.axes.y_label, a.axes.z_label = "Y (km)", "X (km)", "Z (km)"

view.bbox(mlab)

view.set(scene)
mlab.show()
Example #13
0
        3963.8607698693286, 16944.971724745214
    ]
    scene.scene.camera.compute_view_plane_normal()
    scene.scene.render()


x1, x2 = 0, 5000
y1, y2 = 0, 3000
z1, z2 = 0, 3000
extent = [y1, y2, x1, x2, -z2, -z1]
ranges = [0, 3, 0, 5, 3, 0]

scene = mlab.figure(size=(1000, 700))
scene.scene.background = (1, 1, 1)

p = vis.plot_prism_mesh(model, style='surface', xy2ne=True)
mlab.get_engine().scenes[0].children[-1].children[0].children[0].children[
    0].scalar_lut_manager.data_range = [0, 1000]

p = vis.plot_prism_mesh(mesh, style='surface', xy2ne=True)

p = vis.plot_prism_mesh(seeds, style='surface', xy2ne=True)
mlab.get_engine().scenes[0].children[-1].children[0].children[0].children[
    0].scalar_lut_manager.data_range = [0, 1000]

a = mlab.axes(p, nb_labels=3, extent=extent, ranges=ranges, color=(0, 0, 0))
a.label_text_property.color = (0, 0, 0)
a.title_text_property.color = (0, 0, 0)
a.axes.font_factor = 1.2
a.axes.label_format = "%.1f"
a.axes.x_label, a.axes.y_label, a.axes.z_label = "E (km)", "N (km)", "Depth (km)"
Example #14
0
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)
plot = vis.plot_prism_mesh(seed_mesh)
axes = mlab.axes(plot,
                 nb_labels=5,
                 extent=[xmin, xmax, ymin, ymax, -zmax, -zmin])

mlab.show()

# Run the inversion
results = gplant.grow(data,
                      mesh,
                      seeds,
                      compactness=10**(5),
                      power=5,
                      norm=1,
                      threshold=5 * 10**(-5),
Example #15
0
import numpy
from enthought.mayavi import mlab
from fatiando import vis

f = open("mesh.pickle")
mesh = pickle.load(f)
f.close()

f = open("seeds.pickle")
seeds = pickle.load(f)
f.close()

f = open("model.pickle")
model = pickle.load(f)
f.close()

seed_mesh = numpy.array([seed['cell'] for seed in seeds])

fig = mlab.figure()
fig.scene.camera.yaw(230)
fig.scene.background = (1, 1, 1)
vis.plot_prism_mesh(model, style='wireframe', xy2ne=True)
plot = vis.plot_prism_mesh(mesh, xy2ne=True)
vis.plot_prism_mesh(seed_mesh, xy2ne=True)
axes = mlab.axes(plot, nb_labels=5, color=(0,0,0))
axes.label_text_property.color = (0,0,0)
axes.title_text_property.color = (0,0,0)
axes.axes.label_format = "%-#.0f"
mlab.outline(color=(0,0,0))

mlab.show()
Example #16
0
from enthought.mayavi import mlab
from fatiando import mesh, vis, utils

with open("mesh.pickle") as f:
    res = pickle.load(f)

x1, x2 = 0, 3000
y1, y2 = 0, 3000
z1, z2 = 0, 3000
extent = [x1, x2, y1, y2, -z2, -z1]

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

p = vis.plot_prism_mesh(res, style='surface')
mlab.get_engine().scenes[0].children[-1].children[0].children[0].children[
    0].scalar_lut_manager.lut_mode = "Greys"

scene = fig
scene.scene.camera.position = [
    5617.6246210610589, 9378.6744914189112, 1832.0425527256102
]
scene.scene.camera.focal_point = [
    1435.8921050117997, 1598.1461572098237, -1715.9026272606379
]
scene.scene.camera.view_angle = 30.0
scene.scene.camera.view_up = [
    -0.18883236854009863, -0.3216128720649955, 0.92785101019163696
]
scene.scene.camera.clipping_range = [4531.9434654515926, 15755.396726380868]
Example #17
0
import numpy
from enthought.mayavi import mlab
mlab.options.backend = 'envisage'

from fatiando import vis
import fatiando.mesh

f = open("mesh.pickle")
mesh = pickle.load(f)
f.close()
f = open("seeds.pickle")
seeds = pickle.load(f)
f.close()

seed_mesh = numpy.array([seed['cell'] for seed in seeds])
corpo = fatiando.mesh.vfilter(mesh, 1, 1000)

# Plot the resulting model
fig = mlab.figure()
fig.scene.background = (1, 1, 1)
vis.plot_prism_mesh(seed_mesh, style='surface', xy2ne=True)
plot = vis.plot_prism_mesh(corpo, style='surface', xy2ne=True)
plot = vis.plot_prism_mesh(mesh, style='surface', opacity=0.2, xy2ne=True)
axes = mlab.axes(plot, nb_labels=5, color=(0,0,0))
axes.label_text_property.color = (0,0,0)
axes.title_text_property.color = (0,0,0)
axes.axes.label_format = "%-.2f"
mlab.outline(color=(0,0,0))
mlab.show()
Example #18
0
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 = ""
a.axes.x_label, a.axes.y_label, a.axes.z_label = "", "", ""
a.property.line_width = 1
    
mlab.show()
Example #19
0
import pickle
import numpy
from enthought.mayavi import mlab
from fatiando import vis

f = open("mesh.pickle")
mesh = pickle.load(f)
f.close()

f = open("seeds.pickle")
seeds = pickle.load(f)
f.close()

seed_mesh = numpy.array([seed['cell'] for seed in seeds])

fig = mlab.figure()
fig.scene.camera.yaw(230)
fig.scene.background = (1, 1, 1)
vis.plot_prism_mesh(mesh, opacity=0.2)
plot = vis.plot_prism_mesh(mesh)
vis.plot_prism_mesh(seed_mesh)
axes = mlab.axes(plot, nb_labels=5)

mlab.show()
Example #20
0
                      power=3,
                      threshold=10**(-3),
                      norm=2,
                      neighbor_type='reduced',
                      jacobian_file=None,
                      distance_type='radial')

# Unpack the results and calculate the adjusted data
estimate, residuals, misfits, goals = results
fatiando.mesh.fill(estimate, mesh)
adjusted = gplant.adjustment(data, residuals)

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

# Plot the adjusted model plus the skeleton of the synthetic model
fig = mlab.figure()
fig.scene.background = (1, 1, 1)
plot = vis.plot_prism_mesh(seed_mesh, style='surface', label='Density')
plot = vis.plot_prism_mesh(mesh, style='surface', label='Density')
plot = vis.plot_prism_mesh(mesh, style='surface', label='Density')
axes = mlab.axes(plot, nb_labels=5, extent=extent, color=(0, 0, 0))
axes.label_text_property.color = (0, 0, 0)
axes.title_text_property.color = (0, 0, 0)
axes.axes.label_format = "%-#.0f"
mlab.outline(color=(0, 0, 0), extent=extent)
Y, X, Z = utils.extract_matrices(data['gzz'])
mlab.surf(X, Y, Z)
mlab.show()
Example #21
0
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)
plot = vis.plot_prism_mesh(seed_mesh)
axes = mlab.axes(plot, nb_labels=5, extent=[xmin,xmax,ymin,ymax,-zmax,-zmin])

mlab.show()

# Run the inversion
results = gplant.grow(data, mesh, seeds, compactness=10**(5), power=5, norm=1,
                      threshold=5*10**(-5), jacobian_file=None,
                      distance_type='radial')

estimate, residuals, misfits, goals = results

adjusted = gplant.adjustment(data, residuals)

fatiando.mesh.fill(estimate, mesh, fillNone=False)
Example #22
0
model.append({'x1':300, 'x2':2500, 'y1':1800, 'y2':2700, 'z1':500, 'z2':1000,
              'value':-1000})
model.append({'x1':4000, 'x2':4500, 'y1':500, 'y2':1500, 'z1':300, 'z2':1000,
              'value':-1000})
model.append({'x1':1800, 'x2':3700, 'y1':500, 'y2':1500, 'z1':800, 'z2':1300,
              'value':-1000})
model.append({'x1':500, 'x2':4500, 'y1':4000, 'y2':4500, 'z1':500, 'z2':1000,
              'value':-1000})
model = numpy.array(model)

extent = [0,5000,0,5000,-1500,0]

# Show the model before calculating to make sure it's right
fig = mlab.figure()
fig.scene.background = (1, 1, 1)
plot = vis.plot_prism_mesh(model, style='surface', xy2ne=True)
axes = mlab.axes(plot, nb_labels=5, extent=extent, color=(0,0,0))
axes.label_text_property.color = (0,0,0)
axes.title_text_property.color = (0,0,0)
axes.axes.label_format = "%-#.0f"
mlab.outline(color=(0,0,0), extent=extent)
mlab.show()

# Now calculate all the components of the gradient tensor
fields = ['gyy', 'gyz', 'gzz']
error = 0.5
data = {}
for i, field in enumerate(fields):
    data[field] = synthetic.from_prisms(model, x1=0, x2=5000, y1=0, y2=5000,
                                        nx=25, ny=25, height=150, field=field)
    data[field]['value'], error = utils.contaminate(data[field]['value'],
Example #23
0
#~ # Generate a prism mesh
mesh = fatiando.mesh.prism_mesh(x1=x1, x2=x2, y1=y1, y2=y2, z1=z1, z2=z2,
                                nx=75, ny=45, nz=45)
 
# Set the seeds and save them for later use
log.info("Setting seeds in mesh:")
seeds = []
seeds.append(gplant.get_seed((1100, 1500, 1300), 500, mesh))
seeds.append(gplant.get_seed((3900, 1500, 2100), 1000, mesh))

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

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')
mlab.outline(color=(0,0,0), extent=extent)
mlab.show()
 
# Run the inversion
results = gplant.grow(data, mesh, seeds, compactness=10**(4), power=3,
                      threshold=10**(-4), norm=2, neighbor_type='reduced',
                      jacobian_file=None, distance_type='cell')

# Unpack the results and calculate the adjusted data
estimate, residuals, misfits, goals = results
fatiando.mesh.fill(estimate, mesh)
adjusted = gplant.adjustment(data, residuals)
with open("adj.pickle", 'w') as f:
    pickle.dump(adjusted, f)
Example #24
0

def setview(scene):
    pass


x1, x2 = -1530000, -1410000
y1, y2 = -5390000, -5340000
z1, z2 = -1000, 10000.
extent = [y1, y2, x1, x2, -z2, -z1]
ranges = [0, 50, 0, 120, 10, -1]

scene = mlab.figure(size=(1000, 700))
scene.scene.background = (1, 1, 1)

p = vis.plot_prism_mesh(body, style='surface', xy2ne=True)
mlab.get_engine().scenes[0].children[-1].children[0].children[0].children[
    0].scalar_lut_manager.data_range = [0, 390]

p = vis.plot_prism_mesh(seeds, style='surface', xy2ne=True)
mlab.get_engine().scenes[0].children[-1].children[0].children[0].children[
    0].scalar_lut_manager.data_range = [0, 390]

a = mlab.axes(p, nb_labels=5, extent=extent, ranges=ranges, color=(0, 0, 0))
a.label_text_property.color = (0, 0, 0)
a.title_text_property.color = (0, 0, 0)
a.axes.font_factor = 1
a.axes.label_format = "%.1f"
a.axes.x_label, a.axes.y_label, a.axes.z_label = "E (km)", "N (km)", "Z (km)"

mlab.outline(color=(0, 0, 0), extent=extent)
Example #25
0
    scene.scene.camera.view_angle = 30.0
    scene.scene.camera.view_up = [0.42170409069839254, 0.17430913833059022, 0.88982132149251703]
    scene.scene.camera.clipping_range = [3963.8607698693286, 16944.971724745214]
    scene.scene.camera.compute_view_plane_normal()
    scene.scene.render()
    
x1, x2 = 0, 5000
y1, y2 = 0, 3000
z1, z2 = 0, 3000
extent = [y1, y2, x1, x2, -z2, -z1]
ranges = [0,3,0,5,3,0]

scene = mlab.figure(size=(1000,700))
scene.scene.background = (1, 1, 1)

p = vis.plot_prism_mesh(model, style='surface', xy2ne=True)
mlab.get_engine().scenes[0].children[-1].children[0].children[0].children[0].scalar_lut_manager.data_range = [0,1000]

p = vis.plot_prism_mesh(mesh, style='surface', xy2ne=True)

p = vis.plot_prism_mesh(seeds, style='surface', xy2ne=True)
mlab.get_engine().scenes[0].children[-1].children[0].children[0].children[0].scalar_lut_manager.data_range = [0,1000]

a = mlab.axes(p, nb_labels=3, extent=extent, ranges=ranges, color=(0,0,0))
a.label_text_property.color = (0,0,0)
a.title_text_property.color = (0,0,0)
a.axes.font_factor = 1.2
a.axes.label_format = "%.1f"
a.axes.x_label, a.axes.y_label, a.axes.z_label = "E (km)", "N (km)", "Depth (km)"

mlab.outline(color=(0,0,0), extent=extent)
Example #26
0
import view

with open("res.pickle") as f:
	res = pickle.load(f)
with open("seeds.pickle") as f:
	seeds = pickle.load(f)
with open("model.pickle") as f:
	model = pickle.load(f)

extent = view.extent
ranges = view.ranges

scene = mlab.figure(size=view.size)
scene.scene.background = (1, 1, 1)

p = vis.plot_prism_mesh(res, style='surface', xy2ne=True)
p.actor.property.line_width = 2
mlab.get_engine().scenes[0].children[-1].children[0].children[0].children[0].scalar_lut_manager.data_range = [0,1200]

p = vis.plot_prism_mesh(seeds, style='surface', xy2ne=True)
p.actor.property.line_width = 2
mlab.get_engine().scenes[0].children[-1].children[0].children[0].children[0].scalar_lut_manager.data_range = [0,1200]

p = vis.plot_prism_mesh(model, style='surface', xy2ne=True)
p.actor.property.line_width = 2

p = vis.plot_prism_mesh(mesh.vfilter(model,1100,1201), style='wireframe', xy2ne=True)
p.actor.property.color = (0,0,0)
p.actor.property.line_width = 3

mlab.outline(color=(0,0,0), extent=extent)
Example #27
0
x1, x2 = 0, 5000
y1, y2 = 0, 5000
z1, z2 = 0, 1500
pmesh = mesh.prism_mesh(x1=x1, x2=x2, y1=y1, y2=y2, z1=z1, z2=z2,
                                nx=50, ny=50, nz=15)
mesh.fill(numpy.zeros(pmesh.size), pmesh)


extent = view.extent
ranges = view.ranges

scene = mlab.figure(size=view.size)
scene.scene.background = (1, 1, 1)

p = vis.plot_prism_mesh(pmesh, style='surface', xy2ne=True)
p.actor.property.line_width = 2

mlab.outline(color=(0,0,0), extent=extent)

a = mlab.axes(p, nb_labels=5, extent=extent, ranges=ranges, color=(0,0,0))
a.label_text_property.color = (0,0,0)
a.title_text_property.color = (0,0,0)
a.property.line_width = 1
a.axes.label_format = "%-#.1f"
a.axes.x_label, a.axes.y_label, a.axes.z_label = "Y (km)", "X (km)", "Z (km)"

view.bbox(mlab)

view.set(scene)
mlab.show()
Example #28
0
from enthought.mayavi import mlab
from fatiando import mesh, vis, utils

with open("mesh.pickle") as f:
    res = pickle.load(f)

x1, x2 = 0, 3000
y1, y2 = 0, 3000
z1, z2 = 0, 3000
extent = [x1, x2, y1, y2, -z2, -z1]

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

p = vis.plot_prism_mesh(mesh.vfilter(res,900,2001), style='surface', opacity=1)
mlab.get_engine().scenes[0].children[-1].children[0].children[0].children[0].scalar_lut_manager.data_range = [0,2000]

#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 = ""
#a.axes.x_label, a.axes.y_label, a.axes.z_label = "", "", ""
#a.property.line_width = 1

mlab.outline(p, extent=extent, color=(0,0,0))

scene = fig
scene.scene.camera.position = [5617.6246210610589, 9378.6744914189112, 1832.0425527256102]
scene.scene.camera.focal_point = [1435.8921050117997, 1598.1461572098237, -1715.9026272606379]
scene.scene.camera.view_angle = 30.0
Example #29
0
ys = []
for p, dens in seedpoints:
    xs.append(p[0])
    ys.append(p[1])
pylab.plot(xs, ys, '*k', markersize=9, label='Seeds')
pylab.xlabel('X [m]')
pylab.ylabel('Y [m]')
pylab.legend(shadow=True, loc='lower right')
pylab.savefig('seeds_raw.pdf')

#pylab.show()

# Show the seeds first to confirm that they are right
fig = mlab.figure()
fig.scene.background = (1, 1, 1)
vis.plot_prism_mesh(synthetic, style='wireframe')
plot = vis.plot_prism_mesh(seed_mesh, style='surface')
axes = mlab.axes(plot, nb_labels=5, extent=[x1, x2, y1, y2, -z2, -z1])
mlab.show()

# Run the inversion
results = gplant.grow(data, mesh, seeds, compactness=10**(15), power=5,
                      threshold=5*10**(-4), norm=2, neighbor_type='reduced',
                      jacobian_file=None, distance_type='radial')

estimate, residuals, misfits, goals = results

adjusted = gplant.adjustment(data, residuals)

fatiando.mesh.fill(estimate, mesh)