Пример #1
0
pyplot.figure()
ax = pyplot.subplot(1, 1, 1)
pyplot.axis('scaled')
pyplot.suptitle("Escolha a estimativa inicial")
vis.map.contourf(xs, ys, goals, shape, 50)
vis.map.points(rec_points, '^r')
vis.map.points(src, '*y')
initial = ui.picker.points(area, ax, marker='*', color='k')
if len(initial) > 1:
    log.error("Don't be greedy! Pick only one initial estimate")
    sys.exit()
initial = initial[0]

nsolver = inversion.gradient.newton(initial)
newton = [initial]
iterator = epicenter.flat_earth(ttr, recs, vp, vs, nsolver, iterate=True)
for e, r in iterator:
    newton.append(e)
newton_predicted = ttr - r

sdsolver = inversion.gradient.steepest(initial)
steepest = [initial]
iterator = epicenter.flat_earth(ttr, recs, vp, vs, sdsolver, iterate=True)
for e, r in iterator:
    steepest.append(e)
steepest_predicted = ttr - r

pyplot.figure()
pyplot.axis('scaled')
vis.map.contourf(xs, ys, goals, shape, 50)
vis.map.points(recs, '^r')
Пример #2
0
pyplot.figure()
ax = pyplot.subplot(1, 1, 1)
pyplot.axis('scaled')
pyplot.suptitle("Escolha a estimativa inicial")
vis.map.contourf(xs, ys, goals, shape, 30)
vis.map.points(recs, '^r')
vis.map.points([[xref, yref]], '*w', label="Referencia")
vis.map.points(src, '*y')
inicial = ui.picker.points(area, ax, marker='*', color='k')[0]

solver = inversion.gradient.newton(initial=inicial)
result = epicenter.flat_earth(ttr,
                              recs,
                              vp,
                              vs,
                              solver,
                              equality=equality,
                              ref=ref)
estimate, residuals = result
predicted = ttr - residuals

pyplot.figure(figsize=(14, 6))
pyplot.subplot(1, 2, 1)
pyplot.title('Epicentro + estacoes (Vinculo de Igualdade)')
pyplot.axis('scaled')
vis.map.contourf(xs, ys, goals, shape, 30)
vis.map.points(recs, '^r', label="Estacaoes")
vis.map.points(src, '*y', label="Verdadeiro")
vis.map.points([[xref, yref]], '*w', label="Referencia")
vis.map.points([inicial], '*k', label="Inicial")
Пример #3
0
shape = (50, 50)
xs, ys = gridder.regular(area, shape)
goals = epicenter.mapgoal(xs, ys, ttr, recs, vp, vs, damping=damping)

pyplot.figure()
ax = pyplot.subplot(1, 1, 1)
pyplot.axis('scaled')
pyplot.suptitle("Escolha a estimativa inicial")
vis.map.contourf(xs, ys, goals, shape, 30)
vis.map.points(recs, '^r')
vis.map.points(src, '*y')
inicial = ui.picker.points(area, ax, marker='*', color='k')[0]

solver = inversion.gradient.newton(initial=inicial)
result = epicenter.flat_earth(ttr, recs, vp, vs, solver, damping=damping)
estimate, residuals = result
predicted = ttr - residuals

pyplot.figure(figsize=(14, 6))
pyplot.subplot(1, 2, 1)
pyplot.title('Epicentro + estacoes (Norma Minima)')
pyplot.axis('scaled')
vis.map.contourf(xs, ys, goals, shape, 30)
vis.map.points(recs, '^r', label="Estacaoes")
vis.map.points(src, '*y', label="Verdadeiro")
vis.map.points([inicial], '*k', label="Inicial")
vis.map.points([estimate], '*g', label="Estimado")
vis.map.set_area(area)
leg = pyplot.legend(loc='lower right', numpoints=1)
leg.get_frame().set_alpha(0.5)
Пример #4
0
pyplot.title('Tempo de percurso')
s = numpy.arange(len(ttr)) + 1
width = 0.3
pyplot.bar(s - width, ttr, width, color='g', label="Observado",
           yerr=error)
ax.set_xticks(s)
pyplot.xlabel("Estacao")
pyplot.ylabel("Tempo de percurso")
ax = pyplot.subplot(1, 2, 2)
pyplot.grid()
pyplot.axis('scaled')
vis.map.points(recs, '^r')
inicial = ui.picker.points(area, ax, marker='*', color='k')[0]
srcs, recs = utils.connect_points(src, recs)
solver = inversion.gradient.newton(initial=inicial)
result = epicenter.flat_earth(ttr, recs, vp, vs, solver)
estimate, residuals = result
predicted = ttr - residuals

with open('exercicio3-modelo.pickle',  'w') as f:
    pickle.dump(estimate, f)
                               
pyplot.figure(figsize=(14,6))
pyplot.subplot(1, 2, 1)
pyplot.title('Epicentro + estacoes')
pyplot.axis('scaled')
vis.map.points(recs, '^r', label="Estacaoes")
vis.map.points([inicial], '*k', label="Inicial")
vis.map.points([estimate], '*g', label="Estimado")
vis.map.set_area(area)
leg = pyplot.legend(loc='lower right', numpoints=1)
Пример #5
0
pyplot.figure()
ax = pyplot.subplot(1, 1, 1)
pyplot.axis('scaled')
pyplot.suptitle("Escolha a estimativa inicial")
vis.map.contourf(xs, ys, goals, shape, 50)
vis.map.points(rec_points, '^r')
vis.map.points(src, '*y')
initial = ui.picker.points(area, ax, marker='*', color='k')
if len(initial) > 1:
    log.error("Don't be greedy! Pick only one initial estimate")
    sys.exit()
initial = initial[0]
    
nsolver = inversion.gradient.newton(initial)
newton = [initial]
iterator = epicenter.flat_earth(ttr, recs, vp, vs, nsolver, iterate=True)
for e, r in iterator:
    newton.append(e)
newton_predicted = ttr - r

sdsolver = inversion.gradient.steepest(initial, armijo=True)
steepest = [initial]
iterator = epicenter.flat_earth(ttr, recs, vp, vs, sdsolver, iterate=True)
for e, r in iterator:
    steepest.append(e)
steepest_predicted = ttr - r

lmsolver = inversion.gradient.levmarq(initial)
levmarq = [initial]
iterator = epicenter.flat_earth(ttr, recs, vp, vs, lmsolver, iterate=True)
for e, r in iterator:
Пример #6
0
ax = pyplot.subplot(1, 1, 1)
pyplot.axis('scaled')
pyplot.suptitle("Escolha a estimativa inicial")
vis.map.points(rec_points, '^r')
vis.map.points(src, '*y')
inicial = ui.picker.points(area, ax, marker='*', color='k')[0]

srcs, recs = utils.connect_points(src, rec_points)
ptime = traveltime.straight_ray_2d(model, 'vp', srcs, recs)
stime = traveltime.straight_ray_2d(model, 'vs', srcs, recs)
error_level = params.ruido
ttr_true = stime - ptime
ttr, error = utils.contaminate(ttr_true, error_level, percent=True,
                               return_stddev=True)
solver = inversion.gradient.newton(initial=inicial)
result = epicenter.flat_earth(ttr, recs, vp, vs, solver)
estimate, residuals = result
predicted = ttr - residuals
                               
pyplot.figure(figsize=(14,6))
pyplot.subplot(1, 2, 1)
pyplot.title('Epicentro + estacoes')
pyplot.axis('scaled')
vis.map.points(recs, '^r', label="Estacaoes")
vis.map.points(src, '*y', label="Verdadeiro")
vis.map.points([inicial], '*k', label="Inicial")
vis.map.points([estimate], '*g', label="Estimado")
vis.map.set_area(area)
leg = pyplot.legend(loc='lower right', numpoints=1)
leg.get_frame().set_alpha(0.5)
pyplot.xlabel("X")
Пример #7
0
shape = (50, 50)
xs, ys = gridder.regular(area, shape)
goals = epicenter.mapgoal(xs, ys, ttr, recs, vp, vs, damping=damping)

pyplot.figure()
ax = pyplot.subplot(1, 1, 1)
pyplot.axis('scaled')
pyplot.suptitle("Escolha a estimativa inicial")
vis.map.contourf(xs, ys, goals, shape, 30)
vis.map.points(recs, '^r')
vis.map.points(src, '*y')
inicial = ui.picker.points(area, ax, marker='*', color='k')[0]

solver = inversion.gradient.newton(initial=inicial)
result = epicenter.flat_earth(ttr, recs, vp, vs, solver, damping=damping)
estimate, residuals = result
predicted = ttr - residuals
                               
pyplot.figure(figsize=(14,6))
pyplot.subplot(1, 2, 1)
pyplot.title('Epicentro + estacoes (Norma Minima)')
pyplot.axis('scaled')
vis.map.contourf(xs, ys, goals, shape, 30)
vis.map.points(recs, '^r', label="Estacaoes")
vis.map.points(src, '*y', label="Verdadeiro")
vis.map.points([inicial], '*k', label="Inicial")
vis.map.points([estimate], '*g', label="Estimado")
vis.map.set_area(area)
leg = pyplot.legend(loc='lower right', numpoints=1)
leg.get_frame().set_alpha(0.5)
Пример #8
0
shape = (50, 50)
xs, ys = gridder.regular(area, shape)
goals = epicenter.mapgoal(xs, ys, ttr, recs, vp, vs, equality=equality, ref=ref)

pyplot.figure()
ax = pyplot.subplot(1, 1, 1)
pyplot.axis('scaled')
pyplot.suptitle("Escolha a estimativa inicial")
vis.map.contourf(xs, ys, goals, shape, 30)
vis.map.points(recs, '^r')
vis.map.points([[xref, yref]], '*w', label="Referencia")
vis.map.points(src, '*y')
inicial = ui.picker.points(area, ax, marker='*', color='k')[0]

solver = inversion.gradient.newton(initial=inicial)
result = epicenter.flat_earth(ttr, recs, vp, vs, solver, equality=equality, ref=ref)
estimate, residuals = result
predicted = ttr - residuals
                               
pyplot.figure(figsize=(14,6))
pyplot.subplot(1, 2, 1)
pyplot.title('Epicentro + estacoes (Vinculo de Igualdade)')
pyplot.axis('scaled')
vis.map.contourf(xs, ys, goals, shape, 30)
vis.map.points(recs, '^r', label="Estacaoes")
vis.map.points(src, '*y', label="Verdadeiro")
vis.map.points([[xref, yref]], '*w', label="Referencia")
vis.map.points([inicial], '*k', label="Inicial")
vis.map.points([estimate], '*g', label="Estimado")
vis.map.set_area(area)
leg = pyplot.legend(loc='lower right', numpoints=1)