Пример #1
0
# scaled, SI, zp, qorder, nlay, minAlt_ridge, maxAlt_ridge = para.set_par(shape=shape,max_elevation=max_elevation)

x1, x2, y1, y2, z1, z2 = np.array(model[0].get_bounds())

p1 = [min(yp), 0]
p2 = [max(yp), 0]

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

#%%
# Plot the data
pEXP.plot_line(xp, yp, U, p1, p2, interp=interp)

#%%
# Pad the edges of grids (if necessary)

xp, yp, U, shape = dEXP.pad_edges(xp, yp, U, shape, pad_type=0)  # reflexion=5
p1 = [min(yp), 0]
p2 = [max(yp), 0]
x_axis = 'y'

pEXP.plot_line(xp, yp, U, p1, p2, interp=interp, Xaxis=x_axis)

#%%
# Upward continuation of the field data

mesh, label_prop = dEXP.upwc(xp,
Пример #2
0
p1 = [-6000, 0]
p2 = [6000, 0]

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'
Пример #3
0
gravity = np.hstack(np.reshape(gravity, [1, gravity.shape[0]**2]))

for slicedir in enumerate('x'):
    if slicedir[1] == 'y':
        print(slicedir[1])
        x_axis = slicedir[1]  # direction of p1p2 profil
        SI = 1.5
        p1 = [0, (easting[0])]
        p2 = [20e3, (easting[0])]
    else:
        p1 = [(northing[0]), 0]
        p2 = [(northing[0]), 20e3]
        x_axis = slicedir[1]  # direction of p1p2 profil
        SI = 2

    pEXP.plot_line(xp, yp, gravity, p1, p2, interp=True, Xaxis=x_axis)
    pEXP.plot_field(xp, yp, gravity, shape_grid)

    #%%
    # Upward continuation of the field data with discretisation in altitude controlled by the number of layers (nlay) and the maximum elevation desired (max_elevation)
    mesh, label_prop = dEXP.upwc(xp,
                                 yp,
                                 zp,
                                 gravity,
                                 shape_grid,
                                 zmin=0,
                                 zmax=max_elevation,
                                 nlayers=nlay,
                                 qorder=qorder)

    plt, cmap = pEXP.plot_xy(mesh,
Пример #4
0
# ui = U[i]
# ui = U[EA]

uAz0_grid = []
uTz0_grid = []
for ni, node in enumerate(grid_to_calc):
    nearest = mesh.findNearestNode([node[0], node[1], node[2]])
    uAz0_grid.append(uA[nearest])
    uTz0_grid.append(uT[nearest])

plt.xlim([area[0], area[1]])
plt.ylim([area[0], area[1]])

p1 = [min(xnew), (area[0] + area[1]) / 2]
p2 = [max(xnew), (area[0] + area[1]) / 2]
pEXP.plot_line(xnew, ynew, uAz0_grid, p1, p2, interp=True)

plt.figure()
plt.subplot(1, 2, 1)
plt.scatter(xnew, ynew, c=uAz0_grid, cmap='viridis')
plt.colorbar()
plt.scatter(elecs[i, 0], elecs[i, 1])
plt.axis('square')
plt.subplot(1, 2, 2)
plt.scatter(xnew, ynew, c=uTz0_grid, cmap='viridis')
plt.colorbar()
plt.scatter(elecs[i, 0], elecs[i, 1], c='black')
plt.axis('square')

# Y=np.random.normal
# uTz0_grid = np.array(uTz0_grid) + max(uTz0_grid)*noiseLevel*np.random.randn(len(uTz0_grid))
Пример #5
0
        print(slicedir[1])
        p1 = [(x1 + x2) / 2, min(yp)]
        p2 = [(x1 + x2) / 2, max(yp)]
        x_axis = slicedir[1]  # direction of p1p2 profil
        SI = 1.5
    else:
        p1 = [min(xp), (y1 + y2) / 2]
        p2 = [max(xp), (y1 + y2) / 2]
        x_axis = slicedir[1]  # direction of p1p2 profil
        SI = 2

    #%%
    # Plot field data over a 2d line crossing the anomalies
    # pEXP.plot_line(xp, yp, U,p1,p2, interp=False, Xaxis='x')

    pEXP.plot_line(xp, yp, U, p1, p2, interp=True, Xaxis=x_axis)
    square([x1, x2, y1, y2])

    pEXP.plot_field(xp, yp, U, shape)
    square([x1, x2, y1, y2])

    # Gaussian function to derivate
    #%% ------------------------------- Plot the derivatives
    # http://campar.in.tum.de/Chair/HaukeHeibelGaussianDerivatives

    xderiv = transform.derivx(xp, yp, U, shape, order=qorder)
    yderiv = transform.derivy(xp, yp, U, shape, order=qorder)
    zderiv = transform.derivz(xp, yp, U, shape, order=qorder)

    # # plt.plot(xderiv)
    # # plt.plot(yderiv)
Пример #6
0
import examples.sources_mag.fwd_mag.fwd_mag_sphere as magfwd

import numpy as np
import matplotlib.pyplot as plt
plt.rcParams['font.size'] = 15


#%% ------------------------------- MAG DATA
# -------------------------------  Model
xp, yp, zp, U, shape, p1, p2, coord= magfwd.load_mag_synthetic()
max_elevation=2*max(coord[:,2])
scaled, SI, zp, qorder, nlay, minAlt_ridge, maxAlt_ridge = para.set_par(shape=shape,max_elevation=max_elevation)
interp = True

#%% ------------------------------- Plot the data 
pEXP.plot_line(xp, yp, U,p1,p2, interp=interp)

#%% ------- upward continuation of the field data

mesh, label_prop = dEXP.upwc(xp, yp, zp, U, shape, 
                 zmin=0, zmax=max_elevation, nlayers=nlay, 
                 qorder=qorder)

plt, cmap = pEXP.plot_xy(mesh, label=label_prop)
plt.colorbar(cmap)
        

# %% ridges identification

dEXP.ridges_minmax_plot(xp, yp, mesh, p1, p2,
                                      label=label_prop,
Пример #7
0
    #                                                     xaxis = x_axis)
    p1_s = np.array([p1[0] - min(xp_r) + offset, p1[1] - min(yp_r)])
    p2_s = np.array([
        p2[0] - min(xp_r) + offset,
        p2[1] - min(yp_r) + abs(p1[1] - min(yp_r) - (yA_r[0] + yA_r[1]) / 2) -
        abs(p2[1] - min(yp_r) - (yA_r[0] + yA_r[1]) / 2)
    ])
    # p1_s = np.array([p1[0] -min(xp_r)+260,0])
    # p2_s = np.array([p2[0] -min(xp_r)+260,800])
    xx, yy, distance, profile, ax, plt = pEXP.plot_line(
        Xs,
        Ys,
        U,
        p1_s,
        p2_s,
        interp=False,
        x_resolution=interp_size,
        smooth=smooth,
        xaxis=x_axis,
        Vminmax=[0, 0.35],
        limx=[100, 650],
        limy=[100, 650],
        showfig=True)
    plt.savefig('profile' + str(file) + '.png', dpi=450)

    xA_r_new = [p1_s[0] + xA_r[0] - xA_r[1], p1_s[0] - xA_r[0] + xA_r[1]]

    #%% ------------------------------- plot publi mirror

    ax, plt = pEXP.plot_field(Xs, Ys, U, shape, Vminmax=[0, 0.35])
    ax.plot(coords_liner_s[2:5, 0], coords_liner_s[2:5, 1], 'k')
    plt.axis('square')
Пример #8
0
import set_parameters as para
import examples.magnetic.fwdmag.fwd_mag_sphere as magfwd

#%%
# Create a model using geometric objects from fatiando.mesher
xp, yp, zp, U, shape, p1, p2, coord = magfwd.load_mag_synthetic()
max_elevation = 2 * max(coord[:, 2])
scaled, SI, zp, qorder, nlay, minAlt_ridge, maxAlt_ridge = para.set_par(
    shape=shape, max_elevation=max_elevation)
interp = True
x_axis = 'y'
qorder = 0

#%%
# Plot field data over a 2d line crossing the anomalies
pEXP.plot_line(xp, yp, U, p1, p2, interp=True, Xaxis=x_axis)
pEXP.plot_field(xp, yp, U, shape)

#%%
# Upward continuation of the field data with discretisation in altitude controlled by the number of layers (nlay) and the maximum elevation desired (max_elevation)
mesh, label_prop = dEXP.upwc(xp,
                             yp,
                             zp,
                             U,
                             shape,
                             zmin=0,
                             zmax=max_elevation,
                             nlayers=nlay,
                             qorder=qorder)

# plt, cmap = pEXP.plot_xy(mesh, label=label_prop)
Пример #9
0
# ax.plot(p1_r,p2_r,'k')
# plt.xlim(300,650)
# plt.ylim(300,650)

#%% ------------------------------- Plot the data
U = np.copy(Us)
# _, p1, p2, _ = MALM.definep1p2(path=Main,radius=300)
# xx, yy, distance, profile = pEXP.plot_line(xp, yp, U ,p1,p2, interp=interp, smooth=False, xaxis = x_axis)
# xx, yy, distance, profile = pEXP.plot_line(xp, yp, U_f ,p1,p2, interp=interp)
x_axis = 'x'
p1_s = np.array([p1[0] - min(xp_r), p1[1] - min(yp_r)])
p2_s = np.array([p2[0] - min(xp_r), p2[1] - min(yp_r)])
xx, yy, distance, profile, ax, plt = pEXP.plot_line(Xs,
                                                    Ys,
                                                    U,
                                                    p1_s,
                                                    p2_s,
                                                    interp=True,
                                                    smooth=True,
                                                    xaxis=x_axis)
# ax.set_xlim()

#%% ------------------------------- 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)
Пример #10
0
p12x = [p1[0], p2[0]]
p12y = [p1[1], p2[1]]
plt.plot(p12x, p12y, c='red')
p12v = plt.scatter(p12x, p12y, c='red')
txt = ['p1', 'p2']
for i in range(len(p12x)):
    plt.annotate(txt[i], (p12x[i], p12y[i]), c='red')

plt.xlabel('x (m)')
plt.ylabel('y (m)')

xx, yy, distance, profile, ax, plt = pEXP.plot_line(xint_scipy,
                                                    yint_scipy,
                                                    U_int_scipy,
                                                    p1,
                                                    p2,
                                                    interp=False,
                                                    smooth=True,
                                                    Xaxis=x_axis,
                                                    showfig=True)

# xx, yy, distance, profile = pEXP.plot_line(xint_scipy,yint_scipy,U_int_scipy,p1,p2,
#                                             interp=interp, smooth=smooth, Xaxis=x_axis)

# xx, yy, distance, profile = pEXP.plot_line(xint_scipy,yint_scipy,U_int_scipy,p1,p2,
#                                             interp=True,smooth=True, Xaxis='x_axis')

# # xx, yy, distance, profile = pEXP.plot_line(xg, yg,U_int ,p1,p2, interp=False, smooth=smooth)
# # xx, yy, distance, profile = pEXP.plot_line(xg, yg,U_int ,p1,p2, interp=False, smooth=True)

# grd = uEXP.load_surfer('grid_ascii.grd')