Example #1
0
def Prism(dx, dy, dz, depth, pinc, pdec, npts2D, xylim, rx_h, View_elev,
          View_azim):
    #p = definePrism(dx, dy, dz, depth,pinc=pinc, pdec=pdec, susc = 1., Einc=90., Edec=0., Bigrf=1e-6)
    p = definePrism()
    p.dx, p.dy, p.dz, p.z0 = dx, dy, dz, -depth
    p.pinc, p.pdec = pinc, pdec

    srvy = MAG.survey()
    srvy.rx_h, srvy.npts2D, srvy.xylim = rx_h, npts2D, xylim

    # Create problem
    prob = MAG.problem()
    prob.prism = p
    prob.survey = srvy

    return plotObj3D(p, rx_h, View_elev, View_azim, npts2D, xylim,
                     profile="X"), prob
Example #2
0
x1, x2, y1, y2 = x1, x2, y1, y2 = -xylim, xylim, 0., 0.
comp = 'tf'
irt = 'total'
Q, rinc,rdec = 0., 60., 270.
susc = 0.25

vmin, vmax = 0., 0.015

ax1.axis('equal')
ax1.set_title('Forward Simulation')
# Define the problem interactively
p = MAG.definePrism()
p.dx, p.dy, p.dz, p.z0 = dx, dy, dz, -depth
p.pinc, p.pdec = pinc, pdec

srvy = PFlocal.survey()
srvy.rx_h, srvy.npts2D, srvy.xylim = rx_h, npts2D, xylim

# Create problem
prob = PFlocal.problem()
prob.prism = p
prob.survey = srvy

X, Y = np.meshgrid(prob.survey.xr, prob.survey.yr)
Z = np.ones(X.shape)*rx_h
x, y = MAG.linefun(x1, x2, y1, y2, prob.survey.npts2D)
xyz_line = np.c_[x, y, np.ones_like(x)*prob.survey.rx_h]

# Create a mesh
dx    = 5.
Example #3
0
def plotProfile(p, data, Binc, Bdec, Bigrf, susc, Q, rinc, rdec):
    if data is 'MonSt':
        filename = "data/StudentData2015_Monday.csv"
    elif data is 'WedSt':
        filename = "data/StudentData2015_Wednesday.csv"
    elif data is 'WedTA':
        filename = "data/TAData2015_Wednesday.csv"

    dat = pd.DataFrame(pd.read_csv(filename, header=0))
    tf = dat["Corrected Total Field Data (nT)"].values
    std = dat["Standard Deviation (nT)"].values
    loc = dat["Location (m)"].values
    teams = dat["Team"].values

    tfa = tf - Bigrf

    nx, ny = 100, 1
    shape = (nx, ny)
    xLoc = np.linspace(xlim[0], xlim[1], nx)

    zLoc = np.ones(np.shape(xLoc)) * rx_h
    yLoc = np.zeros(np.shape(xLoc))

    #xpl, ypl, zpl = fatiandoGridMesh.regular(surveyArea,shape, z=z)
    rxLoc = np.c_[Utils.mkvc(xLoc), Utils.mkvc(yLoc), Utils.mkvc(zLoc)]

    prob1D = MAG.problem()
    srvy1D = MAG.survey()
    srvy1D._rxLoc = rxLoc

    prob1D.prism = p
    prob1D.survey = srvy1D

    prob1D.Bdec, prob1D.Binc, prob1D.Bigrf = Bdec, Binc, Bigrf
    prob1D.Q, prob1D.rinc, prob1D.rdec = Q, rinc, rdec
    prob1D.uType, prob1D.mType = 'tf', 'total'
    prob1D.susc = susc

    # Compute fields from prism
    magi, magr = prob1D.fields()

    #out_linei, out_liner = getField(p, xyz_line, comp, 'total')
    #out_linei = getField(p, xyz_line, comp,'induced')
    #out_liner = getField(p, xyz_line, comp,'remanent')

    # distance = np.sqrt((x-x1)**2.+(y-y1)**2.)

    f = plt.figure(figsize=(10, 5))
    gs = gridspec.GridSpec(2, 1, height_ratios=[2, 1])

    ax0 = plt.subplot(gs[0])
    ax1 = plt.subplot(gs[1])

    ax1.plot(p.x0, p.z0, 'ko')
    ax1.text(p.x0 + 0.5, p.z0, 'Rebar', color='k')
    ax1.text(xlim[0] + 1., -1.2, 'Magnetometer height (1.9 m)', color='b')
    ax1.plot(xlim, np.r_[-rx_h, -rx_h], 'b--')

    # magi,magr = getField(p, rxLoc, 'bz', 'total')

    ax1.plot(xlim, np.r_[0., 0.], 'k--')
    ax1.set_xlim(xlim)
    ax1.set_ylim(-2.5, 2.5)

    ax0.scatter(loc, tfa, c=teams)
    ax0.errorbar(loc, tfa, yerr=std, linestyle="None", color="k")
    ax0.set_xlim(xlim)
    ax0.grid(which="both")

    ax0.plot(xLoc, magi, 'b', label='induced')
    ax0.plot(xLoc, magr, 'r', label='remnant')
    ax0.plot(xLoc, magi + magr, 'k', label='total')
    ax0.legend(loc=2)
    # ax[1].plot(loc-8, magnT[::-1], )

    ax1.set_xlabel("Northing (m)")
    ax1.set_ylabel("Depth (m)")

    ax0.set_ylabel("Total field anomaly (nT)")

    ax0.grid(True)
    ax0.set_xlabel("Northing (m)")

    ax1.grid(True)
    ax1.set_xlabel("Northing (m)")

    ax1.invert_yaxis()

    plt.tight_layout()
    plt.show()

    return True
Example #4
0
def plogMagSurvey2D(prob2D,
                    susc,
                    Einc,
                    Edec,
                    Bigrf,
                    x1,
                    y1,
                    x2,
                    y2,
                    comp,
                    irt,
                    Q,
                    rinc,
                    rdec,
                    fig=None,
                    axs1=None,
                    axs2=None):

    import matplotlib.gridspec as gridspec

    # The MAG problem created is stored in result[1]
    # prob2D = Box.result[1]

    if fig is None:
        fig = plt.figure(figsize=(18 * 1.5, 3.4 * 1.5))

        plt.rcParams.update({'font.size': 14})
        gs1 = gridspec.GridSpec(2, 7)
        gs1.update(left=0.05, right=0.48, wspace=0.05)

    if axs1 is None:
        axs1 = plt.subplot(gs1[:2, :3])

    if axs2 is None:
        axs2 = plt.subplot(gs1[0, 4:])

    axs1.axis("equal")

    prob2D.Bdec, prob2D.Binc, prob2D.Bigrf = Edec, Einc, Bigrf
    prob2D.Q, prob2D.rinc, prob2D.rdec = Q, rinc, rdec
    prob2D.uType, prob2D.mType = comp, 'total'
    prob2D.susc = susc

    # Compute fields from prism
    b_ind, b_rem = prob2D.fields()

    if irt == 'total':
        out = b_ind + b_rem

    elif irt == 'induced':
        out = b_ind

    else:
        out = b_rem

    X, Y = np.meshgrid(prob2D.survey.xr, prob2D.survey.yr)

    dat = axs1.contourf(X, Y, np.reshape(out, (X.shape)).T, 25)
    cb = plt.colorbar(dat, ax=axs1, ticks=np.linspace(out.min(), out.max(), 5))
    cb.set_label("nT")

    axs1.plot(X, Y, '.k')

    # Compute fields on the line by creating a similar mag problem
    x, y = linefun(x1, x2, y1, y2, prob2D.survey.npts2D)
    xyz_line = np.c_[x, y, np.ones_like(x) * prob2D.survey.rx_h]
    # Create problem
    prob1D = MAG.problem()
    srvy1D = MAG.survey()
    srvy1D._rxLoc = xyz_line

    prob1D.prism = prob2D.prism
    prob1D.survey = srvy1D

    prob1D.Bdec, prob1D.Binc, prob1D.Bigrf = Edec, Einc, Bigrf
    prob1D.Q, prob1D.rinc, prob1D.rdec = Q, rinc, rdec
    prob1D.uType, prob1D.mType = comp, 'total'
    prob1D.susc = susc

    # Compute fields from prism
    out_linei, out_liner = prob1D.fields()

    #out_linei, out_liner = getField(p, xyz_line, comp, 'total')
    #out_linei = getField(p, xyz_line, comp,'induced')
    #out_liner = getField(p, xyz_line, comp,'remanent')

    out_linet = out_linei + out_liner

    distance = np.sqrt((x - x1)**2. + (y - y1)**2.)

    axs1.plot(x, y, 'w.', ms=3)

    axs1.text(x[0], y[0], 'A', fontsize=16, color='w')
    axs1.text(x[-1],
              y[-1],
              'B',
              fontsize=16,
              color='w',
              horizontalalignment='right')

    axs1.set_xlabel('Easting (X; m)')
    axs1.set_ylabel('Northing (Y; m)')
    axs1.set_xlim(X.min(), X.max())
    axs1.set_ylim(Y.min(), Y.max())
    axs1.set_title(irt + ' ' + comp)

    axs2.plot(distance, out_linei, 'b.-')
    axs2.plot(distance, out_liner, 'r.-')
    axs2.plot(distance, out_linet, 'k.-')
    axs2.set_xlim(distance.min(), distance.max())

    axs2.set_xlabel("Distance (m)")
    axs2.set_ylabel("Magnetic field (nT)")

    axs2.text(distance.min(), out_linei.max() * 0.8, 'A', fontsize=16)
    axs2.text(distance.max() * 0.97, out_linei.max() * 0.8, 'B', fontsize=16)
    axs2.legend(("induced", "remanent", "total"), bbox_to_anchor=(0.5, -0.3))
    axs2.grid(True)
    plt.show()

    return True