import numpy from matplotlib import pyplot from fatiando.ui.gui import BasinTrap from fatiando.potential import basin2d from fatiando.inversion import gradient from fatiando.mesher.dd import Polygon from fatiando import vis area = (0, 100000, 0, 5000) xp = numpy.arange(0, 100000, 1000) zp = numpy.zeros_like(xp) nodes = [[20000, 1], [80000, 1]] app = BasinTrap(area, nodes, xp, zp) app.run() gz = app.get_data() dens = app.densities[0] model = Polygon(1000 * numpy.array(app.polygons[0])) dm = basin2d.TrapezoidalGzDM(xp, zp, gz, prop=dens, verts=nodes) solver = gradient.levmarq(initial=(2500, 2500)) p, residuals = basin2d.trapezoidal([dm], solver) estimate = Polygon( [nodes[0], nodes[1], [nodes[1][0], p[0]], [nodes[0][0], p[1]]]) pyplot.figure() pyplot.subplot(2, 1, 1) pyplot.title("Anomalia de gravidade") pyplot.plot(xp, gz, 'ok', label='Observada') pyplot.plot(xp, gz - residuals[0], '-r', linewidth=2, label='Predita') leg = pyplot.legend(loc='lower left', numpoints=1) leg.get_frame().set_alpha(0.5) pyplot.ylabel("mGal")
import numpy from fatiando.ui.gui import BasinTrap import cPickle as pickle area = (0, 100000, 0, 5000) xp = numpy.arange(0, 100000, 1000) zp = numpy.zeros_like(xp) nodes = [[20000, 1], [80000, 1]] app = BasinTrap(area, nodes, xp, zp) app.run() with open('exercicio4.pickle', 'w') as f: data = {'xp':xp, 'zp':zp, 'nodes':1000*numpy.array(app.polygons[0]), 'gz':app.get_data(), 'density':app.densities[0]} pickle.dump(data, f)
import numpy from fatiando.ui.gui import BasinTrap import cPickle as pickle with open('exercicio6.pickle') as f: data = pickle.load(f) xp = data['xp'] zp = data['zp'] nodes = data['nodes'] gz = data['gz'] density = data['density'] area = (0, 100000, 0, 5000) xp = numpy.arange(0, 100000, 1000) zp = numpy.zeros_like(xp) app = BasinTrap(area, nodes[0:2], xp, zp, gz) app.densities[0] = density * 1.5 app.run() with open('exercicio6-modelo.pickle', 'w') as f: data = { 'xp': xp, 'zp': zp, 'nodes': 1000 * numpy.array(app.polygons[0]), 'gz': app.get_data(), 'density': app.densities[0] } pickle.dump(data, f)
import numpy from fatiando.ui.gui import BasinTrap import cPickle as pickle with open('exercicio6.pickle') as f: data = pickle.load(f) xp = data['xp'] zp = data['zp'] nodes = data['nodes'] gz = data['gz'] density = data['density'] area = (0, 100000, 0, 5000) xp = numpy.arange(0, 100000, 1000) zp = numpy.zeros_like(xp) app = BasinTrap(area, nodes[0:2], xp, zp, gz) app.densities[0] = density*1.5 app.run() with open('exercicio6-modelo.pickle', 'w') as f: data = {'xp':xp, 'zp':zp, 'nodes':1000*numpy.array(app.polygons[0]), 'gz':app.get_data(), 'density':app.densities[0]} pickle.dump(data, f)
import numpy from fatiando.ui.gui import BasinTrap import cPickle as pickle area = (0, 100000, 0, 5000) xp = numpy.arange(0, 100000, 1000) zp = numpy.zeros_like(xp) nodes = [[20000, 1], [80000, 1]] app = BasinTrap(area, nodes, xp, zp) app.run() with open('exercicio6.pickle', 'w') as f: data = { 'xp': xp, 'zp': zp, 'nodes': 1000 * numpy.array(app.polygons[0]), 'gz': app.get_data(), 'density': app.densities[0] } pickle.dump(data, f)
import numpy from matplotlib import pyplot from fatiando.ui.gui import BasinTrap from fatiando.potential import basin2d from fatiando.inversion import gradient from fatiando.mesher.dd import Polygon from fatiando import vis area = (0, 100000, 0, 5000) xp = numpy.arange(0, 100000, 1000) zp = numpy.zeros_like(xp) nodes = [[20000, 1], [80000, 1]] app = BasinTrap(area, nodes, xp, zp) app.run() gz = app.get_data() dens = app.densities[0] model = Polygon(1000*numpy.array(app.polygons[0])) dm = basin2d.TrapezoidalGzDM(xp, zp, gz, prop=dens, verts=nodes) solver = gradient.levmarq(initial=(2500, 2500)) p, residuals = basin2d.trapezoidal([dm], solver) estimate = Polygon([nodes[0], nodes[1], [nodes[1][0], p[0]], [nodes[0][0], p[1]]]) pyplot.figure() pyplot.subplot(2, 1, 1) pyplot.title("Anomalia de gravidade") pyplot.plot(xp, gz, 'ok', label='Observada') pyplot.plot(xp, gz - residuals[0], '-r', linewidth=2, label='Predita') leg = pyplot.legend(loc='lower left', numpoints=1) leg.get_frame().set_alpha(0.5) pyplot.ylabel("mGal") pyplot.xlim(0, 100000)
import numpy from fatiando.ui.gui import BasinTrap import cPickle as pickle area = (0, 100000, 0, 5000) xp = numpy.arange(0, 100000, 1000) zp = numpy.zeros_like(xp) nodes = [[20000, 1], [80000, 1]] app = BasinTrap(area, nodes, xp, zp) app.run()