tf = (utils.nt2si(gravmag.prism.tf(xp, yp, zp, model, inc, dec)) + baselevel) # Calculate the derivatives using FFT xderiv = gravmag.fourier.derivx(xp, yp, tf, shape) yderiv = gravmag.fourier.derivy(xp, yp, tf, shape) zderiv = gravmag.fourier.derivz(xp, yp, tf, shape) mpl.figure() titles = ['Total field', 'x derivative', 'y derivative', 'z derivative'] for i, f in enumerate([tf, xderiv, yderiv, zderiv]): mpl.subplot(2, 2, i + 1) mpl.title(titles[i]) mpl.axis('scaled') mpl.contourf(yp, xp, f, shape, 50) mpl.colorbar() mpl.m2km() mpl.show() # Run the euler deconvolution on a single window # Structural index is 3 results = gravmag.euler.classic(xp, yp, zp, tf, xderiv, yderiv, zderiv, 3) print "Base level used: %g" % (baselevel) print "Estimated base level: %g" % (results['baselevel']) myv.figure() myv.points([results['point']], size=100.) myv.prisms(model, 'magnetization', opacity=0.5) axes = myv.axes(myv.outline(extent=bounds)) myv.wall_bottom(axes.axes.bounds, opacity=0.2) myv.wall_north(axes.axes.bounds) myv.show()
# Pick the centers of the expanding windows # The number of final solutions will be the number of points picked mpl.figure() mpl.suptitle('Pick the centers of the expanding windows') mpl.axis('scaled') mpl.contourf(yp, xp, tensor[-1], shape, 50) mpl.colorbar() centers = mpl.pick_points(area, mpl.gca(), xy2ne=True) cms = [] for center in centers: # Use the first eigenvector to estimate the center of mass cm, sigma = gravmag.tensor.center_of_mass(xp, yp, zp, eigenvecs[0], windows=100, wcenter=center) cms.append(cm) print "Sigma = %g" % (sigma) # Plot the prism and the estimated center of mass # It won't work well because we're using only a single window myv.figure() myv.points(cms, size=300.) myv.prisms(prisms, prop='density', opacity=0.5) axes = myv.axes(myv.outline(extent=[-5000, 5000, -5000, 5000, 0, 5000])) myv.wall_bottom(axes.axes.bounds, opacity=0.2) myv.wall_north(axes.axes.bounds) myv.show()
utils.contaminate(prism.gxy(xp, yp, zp, model), noise), utils.contaminate(prism.gxz(xp, yp, zp, model), noise), utils.contaminate(prism.gyy(xp, yp, zp, model), noise), utils.contaminate(prism.gyz(xp, yp, zp, model), noise), utils.contaminate(prism.gzz(xp, yp, zp, model), noise)] # Plot the data titles = ['gxx', 'gxy', 'gxz', 'gyy', 'gyz', 'gzz'] mpl.figure() for i, title in enumerate(titles): mpl.subplot(3, 2, i + 1) mpl.title(title) mpl.axis('scaled') levels = mpl.contourf(yp, xp, data[i], shape, 10) mpl.contour(yp, xp, data[i], shape, levels) mpl.m2km() mpl.show() # Get the eigenvectors from the tensor data eigenvals, eigenvecs = tensor.eigen(data) # Use the first eigenvector to estimate the center of mass cm = tensor.center_of_mass(xp, yp, zp, eigenvecs[0]) # Plot the prism and the estimated center of mass myv.figure() myv.points([cm], size=200.) myv.prisms(model, prop='density', opacity=0.5) axes = myv.axes( myv.outline(extent=[-5000, 5000, -5000, 5000, 0, 5000])) myv.wall_bottom(axes.axes.bounds, opacity=0.2) myv.wall_north(axes.axes.bounds) myv.show()
levels = mpl.contourf(yp, xp, tensor[i], shape, 10) mpl.contour(yp, xp, tensor[i], shape, levels) mpl.m2km() mpl.show() # Pick the centers of the expanding windows # The number of final solutions will be the number of points picked mpl.figure() mpl.suptitle('Pick the centers of the expanding windows') mpl.axis('scaled') mpl.contourf(yp, xp, tensor[-1], shape, 50) mpl.colorbar() centers = mpl.pick_points(area, mpl.gca(), xy2ne=True) cms = [] for center in centers: # Use the first eigenvector to estimate the center of mass cm, sigma = gravmag.tensor.center_of_mass(xp, yp, zp, eigenvecs[0], windows=100, wcenter=center) cms.append(cm) print "Sigma = %g" % (sigma) # Plot the prism and the estimated center of mass # It won't work well because we're using only a single window myv.figure() myv.points(cms, size=200.) myv.prisms(prisms, prop='density', opacity=0.5) axes = myv.axes(myv.outline(extent=[-5000, 5000, -5000, 5000, 0, 5000])) myv.wall_bottom(axes.axes.bounds, opacity=0.2) myv.wall_north(axes.axes.bounds) myv.show()
utils.contaminate(gravmag.prism.gxy(xp, yp, zp, prisms), noise), utils.contaminate(gravmag.prism.gxz(xp, yp, zp, prisms), noise), utils.contaminate(gravmag.prism.gyy(xp, yp, zp, prisms), noise), utils.contaminate(gravmag.prism.gyz(xp, yp, zp, prisms), noise), utils.contaminate(gravmag.prism.gzz(xp, yp, zp, prisms), noise)] # Plot the data titles = ['gxx', 'gxy', 'gxz', 'gyy', 'gyz', 'gzz'] mpl.figure() for i, title in enumerate(titles): mpl.subplot(3, 2, i + 1) mpl.title(title) mpl.axis('scaled') levels = mpl.contourf(yp, xp, tensor[i], shape, 10) mpl.contour(yp, xp, tensor[i], shape, levels) mpl.m2km() mpl.show() # Get the eigenvectors from the tensor data eigenvals, eigenvecs = gravmag.tensor.eigen(tensor) # Use the first eigenvector to estimate the center of mass cm, sigma = gravmag.tensor.center_of_mass(xp, yp, zp, eigenvecs[0]) print "Sigma = %g" % (sigma) # Plot the prism and the estimated center of mass myv.figure() myv.points([cm], size=300.) myv.prisms(prisms, prop='density', opacity=0.5) axes = myv.axes( myv.outline(extent=[-5000, 5000, -5000, 5000, 0, 5000])) myv.wall_bottom(axes.axes.bounds, opacity=0.2) myv.wall_north(axes.axes.bounds) myv.show()
levels = mpl.contourf(yp, xp, tensor[i], shape, 10) mpl.contour(yp, xp, tensor[i], shape, levels) mpl.m2km() mpl.show() # Pick the centers of the expanding windows # The number of final solutions will be the number of points picked mpl.figure() mpl.suptitle('Pick the centers of the expanding windows') mpl.axis('scaled') mpl.contourf(yp, xp, tensor[-1], shape, 50) mpl.colorbar() centers = mpl.pick_points(area, mpl.gca(), xy2ne=True) cms = [] for center in centers: # Use the first eigenvector to estimate the center of mass cm, sigma = gravmag.tensor.center_of_mass(xp, yp, zp, eigenvecs[0], windows=100, wcenter=center) cms.append(cm) print "Sigma = %g" % (sigma) # Plot the prism and the estimated center of mass # It won't work well because we're using only a single window myv.figure() myv.points(cms, size=300.) myv.prisms(prisms, prop='density', opacity=0.5) axes = myv.axes(myv.outline(extent=[-5000, 5000, -5000, 5000, 0, 5000])) myv.wall_bottom(axes.axes.bounds, opacity=0.2) myv.wall_north(axes.axes.bounds) myv.show()
mpl.show() # Pick the centers of the expanding windows # The number of final solutions will be the number of points picked mpl.figure() mpl.suptitle('Pick the centers of the expanding windows') mpl.axis('scaled') mpl.contourf(yp, xp, tf, shape, 50) mpl.colorbar() centers = mpl.pick_points(area, mpl.gca(), xy2ne=True) # Run the euler deconvolution on an expanding window # Structural index is 3 index = 3 results = [] for center in centers: results.append( gravmag.euler.expanding_window(xp, yp, zp, tf, xderiv, yderiv, zderiv, index, gravmag.euler.classic, center, 500, 5000)) print "Base level used: %g" % (baselevel) print "Estimated base level: %g" % (results[-1]['baselevel']) print "Estimated source location: %s" % (str(results[-1]['point'])) myv.figure() myv.points([r['point'] for r in results], size=300.) myv.prisms(model, opacity=0.5) axes = myv.axes(myv.outline(bounds), ranges=[b*0.001 for b in bounds]) myv.wall_bottom(bounds) myv.wall_north(bounds) myv.show()
mpl.show() # Pick the centers of the expanding windows # The number of final solutions will be the number of points picked mpl.figure() mpl.suptitle('Pick the centers of the expanding windows') mpl.axis('scaled') mpl.contourf(yp, xp, tf, shape, 50) mpl.colorbar() centers = mpl.pick_points(area, mpl.gca(), xy2ne=True) # Run the euler deconvolution on an expanding window # Structural index is 3 euler = Classic(xp, yp, zp, tf, xderiv, yderiv, zderiv, 3) sizes = np.linspace(500, 5000, 20) results = [ExpandingWindow(euler, c, sizes).fit() for c in centers] print "Base level used: %g" % (baselevel) for i, res in enumerate(results): print "Center %d:" % (i + 1) print " Base level: %g" % (res.baselevel_) print " Source location: %s" % (str(res.estimate_)) myv.figure() myv.points([r.estimate_ for r in results], size=100.) myv.prisms(model, opacity=0.5) axes = myv.axes(myv.outline(bounds), ranges=[b * 0.001 for b in bounds]) myv.wall_bottom(bounds) myv.wall_north(bounds) myv.show()
mpl.figure() titles = ['Gravity anomaly', 'x derivative', 'y derivative', 'z derivative'] for i, f in enumerate([gz, xderiv, yderiv, zderiv]): mpl.subplot(2, 2, i + 1) mpl.title(titles[i]) mpl.axis('scaled') mpl.contourf(yp, xp, f, shape, 50) mpl.colorbar() mpl.m2km() mpl.show() # Run the euler deconvolution on moving windows to produce a set of solutions euler = Classic(xp, yp, zp, gz, xderiv, yderiv, zderiv, 2) solver = MovingWindow(euler, windows=(10, 10), size=(2000, 2000)).fit() mpl.figure() mpl.axis('scaled') mpl.title('Moving window centers') mpl.contourf(yp, xp, gz, shape, 50) mpl.points(solver.window_centers) mpl.show() myv.figure() myv.points(solver.estimate_, size=100.) myv.prisms(model, opacity=0.5) axes = myv.axes(myv.outline(bounds), ranges=[b * 0.001 for b in bounds]) myv.wall_bottom(bounds) myv.wall_north(bounds) myv.title('Euler solutions') myv.show()
utils.contaminate(prism.gxy(xp, yp, zp, model), noise), utils.contaminate(prism.gxz(xp, yp, zp, model), noise), utils.contaminate(prism.gyy(xp, yp, zp, model), noise), utils.contaminate(prism.gyz(xp, yp, zp, model), noise), utils.contaminate(prism.gzz(xp, yp, zp, model), noise) ] # Plot the data titles = ['gxx', 'gxy', 'gxz', 'gyy', 'gyz', 'gzz'] mpl.figure() for i, title in enumerate(titles): mpl.subplot(3, 2, i + 1) mpl.title(title) mpl.axis('scaled') levels = mpl.contourf(yp, xp, data[i], shape, 10) mpl.contour(yp, xp, data[i], shape, levels) mpl.m2km() mpl.show() # Get the eigenvectors from the tensor data eigenvals, eigenvecs = tensor.eigen(data) # Use the first eigenvector to estimate the center of mass cm = tensor.center_of_mass(xp, yp, zp, eigenvecs[0]) # Plot the prism and the estimated center of mass myv.figure() myv.points([cm], size=200.) myv.prisms(model, prop='density', opacity=0.5) axes = myv.axes(myv.outline(extent=[-5000, 5000, -5000, 5000, 0, 5000])) myv.wall_bottom(axes.axes.bounds, opacity=0.2) myv.wall_north(axes.axes.bounds) myv.show()
# Calculate the derivatives using FFT xderiv = transform.derivx(xp, yp, tf, shape) yderiv = transform.derivy(xp, yp, tf, shape) zderiv = transform.derivz(xp, yp, tf, shape) mpl.figure() titles = ['Total field', 'x derivative', 'y derivative', 'z derivative'] for i, f in enumerate([tf, xderiv, yderiv, zderiv]): mpl.subplot(2, 2, i + 1) mpl.title(titles[i]) mpl.axis('scaled') mpl.contourf(yp, xp, f, shape, 50) mpl.colorbar() mpl.m2km() mpl.show() # Run the Euler deconvolution on the whole dataset euler = Classic(xp, yp, zp, tf, xderiv, yderiv, zderiv, 3).fit() print "Base level used: %g" % (baselevel) print "Estimated:" print " Base level: %g" % (euler.baselevel_) print " Source location: %s" % (str(euler.estimate_)) myv.figure() myv.points([euler.estimate_], size=100.) myv.prisms(model, 'magnetization', opacity=0.5) axes = myv.axes(myv.outline(extent=bounds)) myv.wall_bottom(axes.axes.bounds, opacity=0.2) myv.wall_north(axes.axes.bounds) myv.show()
# Calculate the derivatives using FFT xderiv = fourier.derivx(xp, yp, tf, shape) yderiv = fourier.derivy(xp, yp, tf, shape) zderiv = fourier.derivz(xp, yp, tf, shape) mpl.figure() titles = ['Total field', 'x derivative', 'y derivative', 'z derivative'] for i, f in enumerate([tf, xderiv, yderiv, zderiv]): mpl.subplot(2, 2, i + 1) mpl.title(titles[i]) mpl.axis('scaled') mpl.contourf(yp, xp, f, shape, 50) mpl.colorbar() mpl.m2km() mpl.show() # Run the Euler deconvolution on the whole dataset euler = Classic(xp, yp, zp, tf, xderiv, yderiv, zderiv, 3).fit() print "Base level used: %g" % (baselevel) print "Estimated:" print " Base level: %g" % (euler.baselevel_) print " Source location: %s" % (str(euler.estimate_)) myv.figure() myv.points([euler.estimate_], size=100.) myv.prisms(model, 'magnetization', opacity=0.5) axes = myv.axes(myv.outline(extent=bounds)) myv.wall_bottom(axes.axes.bounds, opacity=0.2) myv.wall_north(axes.axes.bounds) myv.show()
tf = (utils.nt2si(gravmag.prism.tf(xp, yp, zp, model, inc, dec)) + baselevel) # Calculate the derivatives using FFT xderiv = gravmag.fourier.derivx(xp, yp, tf, shape) yderiv = gravmag.fourier.derivy(xp, yp, tf, shape) zderiv = gravmag.fourier.derivz(xp, yp, tf, shape) mpl.figure() titles = ['Total field', 'x derivative', 'y derivative', 'z derivative'] for i, f in enumerate([tf, xderiv, yderiv, zderiv]): mpl.subplot(2, 2, i + 1) mpl.title(titles[i]) mpl.axis('scaled') mpl.contourf(yp, xp, f, shape, 50) mpl.colorbar() mpl.m2km() mpl.show() # Run the euler deconvolution on a single window # Structural index is 3 results = gravmag.euler.classic(xp, yp, zp, tf, xderiv, yderiv, zderiv, 3) print "Base level used: %g" % (baselevel) print "Estimated base level: %g" % (results['baselevel']) myv.figure() myv.points([results['point']], size=300.) myv.prisms(model, 'magnetization', opacity=0.5) axes = myv.axes(myv.outline(extent=bounds)) myv.wall_bottom(axes.axes.bounds, opacity=0.2) myv.wall_north(axes.axes.bounds) myv.show()
utils.contaminate(gravmag.prism.gxy(xp, yp, zp, prisms), noise), utils.contaminate(gravmag.prism.gxz(xp, yp, zp, prisms), noise), utils.contaminate(gravmag.prism.gyy(xp, yp, zp, prisms), noise), utils.contaminate(gravmag.prism.gyz(xp, yp, zp, prisms), noise), utils.contaminate(gravmag.prism.gzz(xp, yp, zp, prisms), noise) ] # Plot the data titles = ['gxx', 'gxy', 'gxz', 'gyy', 'gyz', 'gzz'] mpl.figure() for i, title in enumerate(titles): mpl.subplot(3, 2, i + 1) mpl.title(title) mpl.axis('scaled') levels = mpl.contourf(yp, xp, tensor[i], shape, 10) mpl.contour(yp, xp, tensor[i], shape, levels) mpl.m2km() mpl.show() # Get the eigenvectors from the tensor data eigenvals, eigenvecs = gravmag.tensor.eigen(tensor) # Use the first eigenvector to estimate the center of mass cm, sigma = gravmag.tensor.center_of_mass(xp, yp, zp, eigenvecs[0]) print "Sigma = %g" % (sigma) # Plot the prism and the estimated center of mass myv.figure() myv.points([cm], size=300.) myv.prisms(prisms, prop='density', opacity=0.5) axes = myv.axes(myv.outline(extent=[-5000, 5000, -5000, 5000, 0, 5000])) myv.wall_bottom(axes.axes.bounds, opacity=0.2) myv.wall_north(axes.axes.bounds) myv.show()
mpl.axis('scaled') levels = mpl.contourf(yp, xp, data[i], shape, 10) mpl.contour(yp, xp, data[i], shape, levels) mpl.m2km() mpl.show() # Pick the centers of the expanding windows # The number of final solutions will be the number of points picked mpl.figure() mpl.suptitle('Pick the centers of the expanding windows') mpl.axis('scaled') mpl.contourf(yp, xp, data[-1], shape, 50) mpl.colorbar() centers = mpl.pick_points(area, mpl.gca(), xy2ne=True) # Use the first eigenvector to estimate the center of mass for each expanding # window group cms = [ tensor.center_of_mass(xp, yp, zp, eigenvecs[0], windows=100, wcenter=c) for c in centers ] # Plot the prism and the estimated center of mass # It won't work well because we're using only a single window myv.figure() myv.points(cms, size=200.) myv.prisms(model, prop='density', opacity=0.5) axes = myv.axes(myv.outline(extent=[-5000, 5000, -5000, 5000, 0, 5000])) myv.wall_bottom(axes.axes.bounds, opacity=0.2) myv.wall_north(axes.axes.bounds) myv.show()