pyplot.suptitle("Escolha o epicentro") ax = pyplot.subplot(1, 2, 1) pyplot.axis('scaled') vis.map.points(recs, '^r', label="Stations") ax2 = pyplot.subplot(1, 2, 2) pyplot.title('Tempos de chegada') s = numpy.arange(len(ttr)) + 1 width = 0.2 pyplot.bar(s - width, ttr, width, color='r') ax2.set_xticks(s) pyplot.xlabel("Estacao") pyplot.ylabel("Tempo de chegada") src_model = ui.picker.points(area, ax, marker='*', color='y') srcs, recs = utils.connect_points(src_model, recs) ptime = traveltime.straight_ray_2d(model, 'vp', srcs, recs) stime = traveltime.straight_ray_2d(model, 'vs', srcs, recs) ttr_model = stime - ptime with open('exercicio2-modelo.pickle', 'w') as f: data = {'ttr': ttr_model, 'recs': recs, 'src': src_model} pickle.dump(data, f) pyplot.figure(figsize=(14, 6)) pyplot.subplot(1, 2, 1) pyplot.title('Epicentros') pyplot.axis('scaled') vis.map.points(recs, '^r', label="Estacao") vis.map.points(src_model, '*y', label="Epicentro") vis.map.set_area(area) pyplot.legend(loc='upper left', shadow=True, numpoints=1, prop={'size': 10})
ax = pyplot.subplot(1, 1, 1) pyplot.axis('scaled') pyplot.suptitle("Escolha o evento") vis.map.points(rec_points, '^r') src = ui.picker.points(area, ax, marker='*', color='y') pyplot.figure() 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")
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) cb = pyplot.colorbar() cb.set_label('Velocidade') vis.map.points(src_loc, '*y', label="Epicentros")
pyplot.suptitle("Escolha o epicentro") ax = pyplot.subplot(1, 2, 1) pyplot.axis("scaled") vis.map.points(recs, "^r", label="Stations") ax2 = pyplot.subplot(1, 2, 2) pyplot.title("Tempos de chegada") s = numpy.arange(len(ttr)) + 1 width = 0.2 pyplot.bar(s - width, ttr, width, color="r", yerr=error) ax2.set_xticks(s) pyplot.xlabel("Estacao") pyplot.ylabel("Tempo de chegada") src_model = ui.picker.points(area, ax, marker="*", color="y") srcs, recs = utils.connect_points(src_model, recs) ptime = traveltime.straight_ray_2d(model, "vp", srcs, recs) stime = traveltime.straight_ray_2d(model, "vs", srcs, recs) ttr_model = stime - ptime with open("exercicio3-modelo.pickle", "w") as f: data = {"ttr": ttr_model, "recs": recs, "src": src_model} pickle.dump(data, f) pyplot.figure(figsize=(14, 6)) pyplot.subplot(1, 2, 1) pyplot.title("Epicentros") pyplot.axis("scaled") vis.map.points(recs, "^r", label="Estacao") vis.map.points(src_model, "*y", label="Epicentro") vis.map.set_area(area) pyplot.legend(loc="upper left", shadow=True, numpoints=1, prop={"size": 10})
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) cb = pyplot.colorbar() cb.set_label('Velocidade') vis.map.points(src_loc, '*y', label="Epicentros") vis.map.points(rec_loc, '^r', label="Sismometros") leg = pyplot.legend(loc='lower left', shadow=True, numpoints=1)