Beispiel #1
0
from os import path
from matplotlib import pyplot
import numpy
from fatiando.mesher.dd import SquareMesh
from fatiando.seismic import traveltime
from fatiando import vis, logger, utils, inversion
import cPickle as pickle

params = __import__('exercicio1_entrada')

imgfile = params.imagem
area = (0, 5, 0, 5)
shape = params.tamanho
model = SquareMesh(area, shape)
model.img2prop(imgfile, params.vmin, params.vmax, 'vp')

src_loc = utils.random_points(area, params.epicentros)
rec_loc = utils.circular_points(area, params.sismometros, random=True)
srcs, recs = utils.connect_points(src_loc, rec_loc)
tts, error = utils.contaminate(traveltime.straight_ray_2d(
    model, 'vp', srcs, recs),
                               params.ruido,
                               percent=True,
                               return_stddev=True)

with open(params.dados, 'w') as f:
    data = [model, src_loc, rec_loc, tts, error]
    pickle.dump(data, f)

pyplot.figure(figsize=(7, 5))
pyplot.axis('scaled')
Beispiel #2
0
from matplotlib import pyplot
import numpy
from fatiando.mesher.dd import SquareMesh
from fatiando.seismic import traveltime, srtomo
from fatiando import vis, logger, utils, inversion
import cPickle as pickle

params = __import__('exercicio4_entrada')
mu = params.suavidade
area = (0, 5, 0, 5)
with open(params.dados) as f:
    model, src_loc, rec_loc, tts, error = pickle.load(f)
shape = model.shape
vmin, vmax = model.props['vp'].min(), model.props['vp'].max()
srcs, recs = utils.connect_points(src_loc, rec_loc)
mesh = SquareMesh(area, shape)
solver = inversion.linear.overdet(mesh.size)
results = srtomo.run(tts, srcs, recs, mesh, solver, smooth=mu)
estimate, residuals = results

pyplot.figure(figsize=(14, 5))
pyplot.subplot(1, 2, 1)
pyplot.axis('scaled')
pyplot.title('Tomografia (Suavidade)')
vis.map.squaremesh(mesh, estimate, vmin=1./vmax, vmax=1./vmin,
    cmap=pyplot.cm.seismic_r)
cb = pyplot.colorbar()
cb.set_label('Vagarosidade')
pyplot.subplot(1, 2, 2)
pyplot.grid()
pyplot.title('Residuos (erro %g s)' % (error))
from os import path
from matplotlib import pyplot
import numpy
from fatiando.mesher.dd import SquareMesh
from fatiando.seismic import traveltime
from fatiando import vis, logger, utils, inversion
import cPickle as pickle

params = __import__('exercicio1_entrada')

imgfile = params.imagem
area = (0, 5, 0, 5)
shape = params.tamanho
model = SquareMesh(area, shape)
model.img2prop(imgfile, params.vmin, params.vmax, 'vp')

src_loc = utils.random_points(area, params.epicentros)
rec_loc = utils.circular_points(area, params.sismometros, random=True)
srcs, recs = utils.connect_points(src_loc, rec_loc)
tts, error = utils.contaminate(
    traveltime.straight_ray_2d(model, 'vp', srcs, recs), params.ruido, percent=True,
    return_stddev=True)

with open(params.dados, 'w') as f:
    data = [model, src_loc, rec_loc, tts, error]
    pickle.dump(data, f)

pyplot.figure(figsize=(7, 5))
pyplot.axis('scaled')
pyplot.title('Modelo de velocidades')
vis.map.squaremesh(model, model.props['vp'], cmap=pyplot.cm.seismic)