def stdr_mag(x, y, mag, area, cel=200, M=50000): #STDR Map #(Nasuti et al. 2018) #Calculating the derivatives through Fatiando library numcols, numrows = int((area[1] - area[0]) / cel), int( (area[3] - area[2]) / cel) deriv_x = transform.derivx(x, y, mag, (numcols, numrows)) deriv_y = transform.derivy(x, y, mag, (numcols, numrows)) deriv_z = transform.derivz(x, y, mag, (numcols, numrows)) deriv2_z = transform.derivz(x, y, deriv_z, (numcols, numrows)) thd = np.sqrt(deriv_x**2 + deriv_y**2) derivx_thd = transform.derivx(x, y, thd, (numcols, numrows)) derivy_thd = transform.derivy(x, y, thd, (numcols, numrows)) #applying the equations stdr = np.arctan(M * deriv2_z / np.sqrt(derivx_thd**2 + derivy_thd**2)) return stdr
def test_derivatives_uneven_shape(): "gravmag.transform FFT derivatives work if grid spacing is uneven" model = [Prism(-1000, 1000, -500, 500, 0, 2000, {'density': 100})] shape = (150, 300) x, y, z = gridder.regular([-10000, 10000, -10000, 10000], shape, z=-100) grav = utils.mgal2si(prism.gz(x, y, z, model)) analytical = prism.gzz(x, y, z, model) calculated = utils.si2eotvos(transform.derivz(x, y, grav, shape, method='fft')) diff = _trim(np.abs(analytical - calculated), shape) assert np.all(diff <= 0.005*np.abs(analytical).max()), \ "Failed for gzz"
def test_derivatives_uneven_shape(): "gravmag.transform FFT derivatives work if grid spacing is uneven" model = [Prism(-1000, 1000, -500, 500, 0, 2000, {'density': 100})] shape = (150, 300) x, y, z = gridder.regular([-10000, 10000, -10000, 10000], shape, z=-100) grav = utils.mgal2si(prism.gz(x, y, z, model)) analytical = prism.gzz(x, y, z, model) calculated = utils.si2eotvos( transform.derivz(x, y, grav, shape, method='fft')) diff = _trim(np.abs(analytical - calculated), shape) assert np.all(diff <= 0.005*np.abs(analytical).max()), \ "Failed for gzz"
def asta_mag(x, y, mag, area, cel=200): #Analytic Signal of Tilt Angle #(Ansari and Alamdar, 2011) #Calculating the derivatives through Fatiando library numcols, numrows = int((area[1] - area[0]) / cel), int( (area[3] - area[2]) / cel) deriv_x = transform.derivx(x, y, mag, (numcols, numrows)) deriv_y = transform.derivy(x, y, mag, (numcols, numrows)) deriv_z = transform.derivz(x, y, mag, (numcols, numrows)) #Calculating TDR and its derivatives thd = np.sqrt(deriv_x**2 + deriv_y**2) tdr = np.arctan(deriv_z / thd) deriv_tdr_x = transform.derivx(x, y, tdr, (numcols, numrows)) deriv_tdr_y = transform.derivy(x, y, tdr, (numcols, numrows)) deriv_tdr_z = transform.derivz(x, y, tdr, (numcols, numrows)) #applyng the equations asta = np.sqrt(deriv_tdr_x**2 + deriv_tdr_y**2 + deriv_tdr_z**2) return asta
def test_laplace_from_potential(): "gravmag.transform 2nd derivatives of potential obey the Laplace equation" model = [Prism(-1000, 1000, -500, 500, 0, 2000, {'density': 200})] shape = (300, 300) x, y, z = gridder.regular([-10000, 10000, -10000, 10000], shape, z=-100) potential = prism.potential(x, y, z, model) gxx = utils.si2eotvos( transform.derivx(x, y, potential, shape, order=2, method='fft')) gyy = utils.si2eotvos( transform.derivy(x, y, potential, shape, order=2, method='fft')) gzz = utils.si2eotvos(transform.derivz(x, y, potential, shape, order=2)) laplace = _trim(gxx + gyy + gzz, shape) assert np.all(np.abs(laplace) <= 1e-10), \ "Max: {} Mean: {} STD: {}".format( laplace.max(), laplace.mean(), laplace.std())
def asa_mag(x, y, mag, area, cel=200): # Analytical Signal or Total Gradient (ASA or GT) #(Nabighian 1972; Roest et al. 1992) #Calculating the derivatives through Fatiando library numcols, numrows = int((area[1] - area[0]) / cel), int( (area[3] - area[2]) / cel) deriv_x = transform.derivx(x, y, mag, (numcols, numrows)) deriv_y = transform.derivy(x, y, mag, (numcols, numrows)) deriv_z = transform.derivz(x, y, mag, (numcols, numrows)) #applying the equations asa = np.sqrt(deriv_x**2 + deriv_y**2 + deriv_z**2) return asa
def test_laplace_from_potential(): "gravmag.transform 2nd derivatives of potential obey the Laplace equation" model = [Prism(-1000, 1000, -500, 500, 0, 2000, {'density': 200})] shape = (300, 300) x, y, z = gridder.regular([-10000, 10000, -10000, 10000], shape, z=-100) potential = prism.potential(x, y, z, model) gxx = utils.si2eotvos(transform.derivx(x, y, potential, shape, order=2, method='fft')) gyy = utils.si2eotvos(transform.derivy(x, y, potential, shape, order=2, method='fft')) gzz = utils.si2eotvos(transform.derivz(x, y, potential, shape, order=2)) laplace = _trim(gxx + gyy + gzz, shape) assert np.all(np.abs(laplace) <= 1e-10), \ "Max: {} Mean: {} STD: {}".format( laplace.max(), laplace.mean(), laplace.std())
def gdo_mag(x, y, mag, area, theta, phi, cel=200): #Generalised derivative operator #(Cooper and Cowan 2011) #Calculating the derivatives through Fatiando library numcols, numrows = int((area[1] - area[0]) / cel), int( (area[3] - area[2]) / cel) deriv_x = transform.derivx(x, y, mag, (numcols, numrows)) deriv_y = transform.derivy(x, y, mag, (numcols, numrows)) deriv_z = transform.derivz(x, y, mag, (numcols, numrows)) gdo = ( (deriv_x * np.sin(theta) + deriv_y * np.cos(theta)) * np.cos(phi) + deriv_z * np.sin(phi)) / np.sqrt(deriv_x**2 + deriv_y**2 + deriv_z**2) return gdo
def tdr_mag(x, y, mag, area, cel=200): # Tilt Angle Filter (TDR or ISA) #(Miller and Singh 1994) #Calculating the derivatives through Fatiando library numcols, numrows = int((area[1] - area[0]) / cel), int( (area[3] - area[2]) / cel) deriv_x = transform.derivx(x, y, mag, (numcols, numrows)) deriv_y = transform.derivy(x, y, mag, (numcols, numrows)) deriv_z = transform.derivz(x, y, mag, (numcols, numrows)) #applying the equations thd = np.sqrt(deriv_x**2 + deriv_y**2) tdr = np.arctan(deriv_z / thd) return tdr
def tdx_mag(x, y, mag, area, cel=200): #TDX Filter #(Cooper and Cowan 2006) #Calculating the derivatives through Fatiando library numcols, numrows = int((area[1] - area[0]) / cel), int( (area[3] - area[2]) / cel) deriv_x = transform.derivx(x, y, mag, (numcols, numrows)) deriv_y = transform.derivy(x, y, mag, (numcols, numrows)) deriv_z = transform.derivz(x, y, mag, (numcols, numrows)) #applying the equations thd = np.sqrt(deriv_x**2 + deriv_y**2) tdx = np.arctan(thd / np.abs(deriv_z)) return tdx
def theta_mag(x, y, mag, area, cel=200): # Theta Map #(Wijns et al. 2005) #Calculating the derivatives through Fatiando library numcols, numrows = int((area[1] - area[0]) / cel), int( (area[3] - area[2]) / cel) deriv_x = transform.derivx(x, y, mag, (numcols, numrows)) deriv_y = transform.derivy(x, y, mag, (numcols, numrows)) deriv_z = transform.derivz(x, y, mag, (numcols, numrows)) #applying the equations asa = np.sqrt(deriv_x**2 + deriv_y**2 + deriv_z**2) thd = np.sqrt(deriv_x**2 + deriv_y**2) theta = (thd / asa) return theta
def tahg_mag(x, y, mag, area, cel=200): #TAHG Filter #(Ferreira et al. 2013) #Calculating the derivatives through Fatiando library numcols, numrows = int((area[1] - area[0]) / cel), int( (area[3] - area[2]) / cel) deriv_x = transform.derivx(x, y, mag, (numcols, numrows)) deriv_y = transform.derivy(x, y, mag, (numcols, numrows)) thd = np.sqrt(deriv_x**2 + deriv_y**2) derivx_thd = transform.derivx(x, y, thd, (numcols, numrows)) derivy_thd = transform.derivy(x, y, thd, (numcols, numrows)) derivz_thd = transform.derivz(x, y, thd, (numcols, numrows)) #applying the equations tahg = np.arctan(derivz_thd / np.sqrt(derivx_thd**2 + derivy_thd**2)) return tahg
def thd_tdr_mag(x, y, mag, area, cel=200): # Total Horizontal Derivative of the Tilt Angle (THD_TDR) #(Verduzco et al. 2004) #Calculating the derivatives through Fatiando library numcols, numrows = int((area[1] - area[0]) / cel), int( (area[3] - area[2]) / cel) deriv_x = transform.derivx(x, y, mag, (numcols, numrows)) deriv_y = transform.derivy(x, y, mag, (numcols, numrows)) deriv_z = transform.derivz(x, y, mag, (numcols, numrows)) #applying the equations thd = np.sqrt(deriv_x**2 + deriv_y**2) tdr = np.arctan(deriv_z / thd) derivx_tdr = transform.derivx(x, y, tdr, (numcols, numrows)) derivy_tdr = transform.derivy(x, y, tdr, (numcols, numrows)) thd_tdr = np.sqrt(derivx_tdr**2 + derivy_tdr**2) return thd_tdr
def euler_deconv(inc, dec,syn_bounds,area,depth=-300,magnetization = 0.5,si=1.0,size = (1000, 1000),windows=(10, 10),proc_data='None'): # IN PROGRESSING ##### mag = utils.ang2vec(magnetization, inc, dec) model = [] for i in range(len(syn_bounds)): model.append(Prism(syn_bounds[i][0], syn_bounds[i][1], syn_bounds[i][2], syn_bounds[i][3], syn_bounds[i][4], syn_bounds[i][5], {'magnetization': mag})) #model = [Prism(syn_bounds[0]-1000, syn_bounds[1]-1000, syn_bounds[2]-1000, syn_bounds[3]-1000, syn_bounds[4], syn_bounds[5], {'magnetization': mag}),Prism(syn_bounds[0]+1000, syn_bounds[1]+1000, syn_bounds[2]+1000, syn_bounds[3]+1000, syn_bounds[4], syn_bounds[5], {'magnetization': mag})] cel = 200 numcols, numrows = int((area[1] - area[0])/cel), int((area[3] - area[2])/cel) x, y, z = gridder.regular(area[:4], (numcols, numrows), z=depth) mag = prism.tf(x, y, z, model, inc, dec) #derivatives deriv_x = transform.derivx(x, y, mag, (numcols, numrows)) deriv_y = transform.derivy(x, y, mag, (numcols, numrows)) deriv_z = transform.derivz(x, y, mag, (numcols, numrows)) #label = 'Total Magnetic Intensity (nT)' solver = euler.EulerDeconvMW(x, y, z, mag, deriv_x, deriv_y, deriv_z, structural_index=si, windows=windows, size=size) solver_expand = euler.EulerDeconvEW(x, y, z, mag, deriv_x, deriv_y, deriv_z, structural_index=si, center = (-1250,0),sizes=np.linspace(300, 7000, 20)) solver.fit() solver_expand.fit() #print('Kept Euler solutions after the moving window scheme:') #print(solver_expand.estimate_) return solver,solver_expand
model = [ mesher.Sphere(x=-1000, y=-1000, z=1500, radius=1000, props={'magnetization': utils.ang2vec(2, inc, dec)}), mesher.Sphere(x=1000, y=1500, z=1000, radius=1000, props={'magnetization': utils.ang2vec(1, inc, dec)}), ] # Generate some magnetic data from the model shape = (100, 100) area = [-5000, 5000, -5000, 5000] x, y, z = gridder.regular(area, shape, z=-150) data = sphere.tf(x, y, z, model, inc, dec) # We also need the derivatives of our data xderiv = transform.derivx(x, y, data, shape) yderiv = transform.derivy(x, y, data, shape) zderiv = transform.derivz(x, y, data, shape) # Now we can run our Euler deconv solver using expanding windows. We'll run 2 # solvers, each one expanding windows from points close to the anomalies. # We use a structural index of 3 to indicate that we think the sources are # spheres. # Make the solver and use fit() to obtain the estimate for the lower right # anomaly print("Euler solutions:") sol1 = euler.EulerDeconvEW(x, y, z, data, xderiv, yderiv, zderiv, structural_index=3, center=(-2000, -2000), sizes=np.linspace(300, 7000, 20)) sol1.fit() print("Lower right anomaly location:", sol1.estimate_)
zmin=0, zmax=max_elevation, nlayers=nlay, qorder=qorder) plt, cmap = pEXP.plot_xy(mesh, label=label_prop, Xaxis=x_axis, p1p2=np.array([p1, p2])) plt.colorbar(cmap) #%% xderiv = transform.derivx(xp, yp, gravity, shape_grid, order=qorder) yderiv = transform.derivy(xp, yp, gravity, shape_grid, order=qorder) zderiv = transform.derivz(xp, yp, gravity, shape_grid, order=qorder) # # plt.plot(xderiv) # # plt.plot(yderiv) # # interp = True pEXP.plot_line(xp, yp, xderiv, p1, p2, title='xderiv', savefig=False, interp=interp, Xaxis=x_axis) pEXP.plot_line(xp,
# plt.xlim(min(Xs),max(Ys)) # plt.ylim(min(Xs),max(Ys)) plt.xlim(300, 500) plt.ylim(300, 500) plt.savefig('publi_mirror' + file + '.png', dpi=450) #%% ------------------------------- Pad the edges of grids # xp,yp,U, shape = dEXP.pad_edges(xp,yp,U,shape,pad_type=0) # reflexion=5 # pEXP.plot_line(xp, yp,U,p1,p2, interp=interp) #%% ------------------------------- Plot the derivatives xderiv = transform.derivx(Xs, Ys, U, shape, order=0) yderiv = transform.derivy(Xs, Ys, U, shape, order=0) zderiv = transform.derivz(Xs, Ys, U, shape, order=0) # interp = True pEXP.plot_line(Xs, Ys, xderiv, p1_s, p2_s, title='xderiv', x_resolution=interp_size, savefig=False, interp=interp, smooth=smooth, Xaxis=x_axis) plt.savefig('xderiv' + str(file) + '.png', dpi=450)
bounds = [-5000, 5000, -5000, 5000, 0, 5000] model = [ Prism(-1500, -500, -500, 500, 1000, 2000, {'magnetization': 2})] # Generate some data from the model shape = (200, 200) area = bounds[0:4] xp, yp, zp = gridder.regular(area, shape, z=-1) # Add a constant baselevel baselevel = 10 # Convert from nanoTesla to Tesla because euler and derivatives require things # in SI tf = (utils.nt2si(prism.tf(xp, yp, zp, model, inc, dec)) + baselevel) # 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)
max_elevation = z2 * 1.2 scaled, SI, zp, qorder, nlay, minAlt_ridge, maxAlt_ridge = para.set_par( shape=shape, max_elevation=max_elevation) interp = True qorder = 0 max_elevation / nlay #%% # Plot the data xx, yy, distance, profile, ax, plt = pEXP.plot_line(xp, yp, U, p1, p2, interp=True) zderiv = transform.derivz(xp, yp, U, shape, order=1) xx, yy, distance, dz, ax, plt = pEXP.plot_line(xp, yp, zderiv, p1, p2, interp=True, title='zderiv') fig, ax1 = plt.subplots() color = 'tab:red' ax1.set_xlabel('x(m)') ax1.set_ylabel('Amplitude of the\n potential field', color=color) ax1.plot(xx, profile, color=color)
bounds = [-5000, 5000, -5000, 5000, 0, 5000] model = [ Prism(-1500, -500, -1500, -500, 500, 1500, {'density': 1000}), Prism(500, 1500, 1000, 2000, 500, 1500, {'density': 1000})] # Generate some data from the model shape = (100, 100) area = bounds[0:4] xp, yp, zp = gridder.regular(area, shape, z=-1) # Add a constant baselevel baselevel = 10 # Convert the data from mGal to SI because Euler and FFT derivation require # data in SI gz = utils.mgal2si(prism.gz(xp, yp, zp, model)) + baselevel xderiv = transform.derivx(xp, yp, gz, shape) yderiv = transform.derivy(xp, yp, gz, shape) zderiv = transform.derivz(xp, yp, gz, shape) 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()
model = [ Prism(-1500, -500, -1500, -500, 500, 1500, {'density': 1000}), Prism(500, 1500, 1000, 2000, 500, 1500, {'density': 1000}) ] # Generate some data from the model shape = (100, 100) area = bounds[0:4] xp, yp, zp = gridder.regular(area, shape, z=-1) # Add a constant baselevel baselevel = 10 # Convert the data from mGal to SI because Euler and FFT derivation require # data in SI gz = utils.mgal2si(prism.gz(xp, yp, zp, model)) + baselevel xderiv = transform.derivx(xp, yp, gz, shape) yderiv = transform.derivy(xp, yp, gz, shape) zderiv = transform.derivz(xp, yp, gz, shape) 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()
""" from fatiando import mesher, gridder, utils from fatiando.gravmag import prism, transform from fatiando.vis import mpl model = [mesher.Prism(-1000, 1000, -1000, 1000, 0, 2000, {'density': 100})] area = (-5000, 5000, -5000, 5000) shape = (51, 51) z0 = -500 xp, yp, zp = gridder.regular(area, shape, z=z0) gz = utils.contaminate(prism.gz(xp, yp, zp, model), 0.001) # Need to convert gz to SI units so that the result can be converted to Eotvos gxz = utils.si2eotvos(transform.derivx(xp, yp, utils.mgal2si(gz), shape)) gyz = utils.si2eotvos(transform.derivy(xp, yp, utils.mgal2si(gz), shape)) gzz = utils.si2eotvos(transform.derivz(xp, yp, utils.mgal2si(gz), shape)) gxz_true = prism.gxz(xp, yp, zp, model) gyz_true = prism.gyz(xp, yp, zp, model) gzz_true = prism.gzz(xp, yp, zp, model) mpl.figure() mpl.title("Original gravity anomaly") mpl.axis('scaled') mpl.contourf(xp, yp, gz, shape, 15) mpl.colorbar(shrink=0.7) mpl.m2km() mpl.figure(figsize=(14, 10)) mpl.subplots_adjust(top=0.95, left=0.05, right=0.95) mpl.subplot(2, 3, 1)
# Make a model bounds = [-5000, 5000, -5000, 5000, 0, 5000] model = [Prism(-1500, -500, -500, 500, 1000, 2000, {'magnetization': 2})] # Generate some data from the model shape = (200, 200) area = bounds[0:4] xp, yp, zp = gridder.regular(area, shape, z=-1) # Add a constant baselevel baselevel = 10 # Convert from nanoTesla to Tesla because euler and derivatives require things # in SI tf = (utils.nt2si(prism.tf(xp, yp, zp, model, inc, dec)) + baselevel) # 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)
plt.colorbar() plt.xlabel('East (km)') plt.ylabel('North (km)') mpl.m2km() plt.show() #plt.title(strname +'ztop' + str(za) +'_zbot'+ str(zb) + '_data', fontsize=20) #plt.savefig(pathFig+strname + '_ExempleFig_z' + str(za) + str(zb) + '_data' + '.png') #x1, x2, y1, y2, z1, z2 = np.array(model[0].get_bounds()) square([y1, y2, x1, x2]) # %% ------------------------------- derivatives xderiv = transform.derivx(xp, yp, gz, shape, order=1) yderiv = transform.derivy(xp, yp, gz, shape) zderiv = transform.derivz(xp, yp, gz, shape, order=1) plt.subplots_adjust() levels = 30 cbargs = dict(orientation='horizontal') ax = plt.subplot(1, 3, 1) plt.axis('scaled') plt.title('x derivative') mpl.contourf(yp, xp, xderiv, shape, levels, cmap=plt.cm.RdBu_r) plt.colorbar(**cbargs).set_label('u/m') mpl.m2km() plt.xlabel('x (m)') plt.ylabel('y (m)') ax = plt.subplot(1, 3, 2)
fig.savefig('data.png', dpi=200, bbox_inches='tight', pad_inches=0) xc = np.loadtxt('xc.txt') yc = np.loadtxt('yc.txt') gauss = sp.ndimage.filters.gaussian_filter(data,1.) # apply mild smoothing d = gauss.ravel() # rearrange data, X, and Y from 2D arrays to 1D arrays y = xc.ravel() # x, y are switched because x in Fatiando is North-South. x = yc.ravel() # If we wanted to plot the data using coordinates we'd have to pass it, as , for example: contourf(y, x, ...) xderiv = transform.derivx(x, y, d, data.shape) # calculate derivatives using Fatiando a Terra yderiv = transform.derivy(x, y, d, data.shape) zderiv = transform.derivz(x, y, d, data.shape) xderiv2D = np.reshape(xderiv, (81, 81)) # reshape output arrays back to 2D yderiv2D = np.reshape(yderiv, (81, 81)) zderiv2D = np.reshape(zderiv, (81, 81)) dx = xderiv2D # rename for convenience dy = yderiv2D dz = zderiv2D fig = plt.figure(figsize=(10,7)) ax = fig.add_subplot(1, 1, 1)
# plt.xlim(min(Xs),max(Ys)) # plt.ylim(min(Xs),max(Ys)) plt.xlim(300, 500) plt.ylim(300, 500) plt.savefig('publi_mirror_field.png', dpi=450) #%% ------------------------------- Pad the edges of grids # xp,yp,U, shape = dEXP.pad_edges(xp,yp,U,shape,pad_type=0) # reflexion=5 # pEXP.plot_line(xp, yp,U,p1,p2, interp=interp) #%% ------------------------------- Plot the derivatives xderiv = transform.derivx(XFs, YFs, UF, shape, order=0) yderiv = transform.derivy(XFs, YFs, UF, shape, order=0) zderiv = transform.derivz(XFs, YFs, UF, shape, order=0) # interp = True pEXP.plot_line(XFs, YFs, xderiv, p1_s, p2_s, title='xderiv', x_resolution=interp_size, savefig=False, interp=interp, smooth=smooth, Xaxis=x_axis) plt.savefig('xderiv' + str(file) + '.png', dpi=450)
mesher.Sphere(x=1000, y=1500, z=1000, radius=1000, props={'magnetization': utils.ang2vec(1, inc, dec)}) ] # Generate some magnetic data from the model shape = (100, 100) area = [-5000, 5000, -5000, 5000] x, y, z = gridder.regular(area, shape, z=-150) data = sphere.tf(x, y, z, model, inc, dec) # We also need the derivatives of our data xderiv = transform.derivx(x, y, data, shape) yderiv = transform.derivy(x, y, data, shape) zderiv = transform.derivz(x, y, data, shape) # Now we can run our Euler deconv solver using expanding windows. We'll run 2 # solvers, each one expanding windows from points close to the anomalies. # We use a structural index of 3 to indicate that we think the sources are # spheres. # Make the solver and use fit() to obtain the estimate for the lower right # anomaly print("Euler solutions:") sol1 = euler.EulerDeconvEW(x, y, z, data, xderiv,