Пример #1
0
    def Planewave3D(self, itime):
        fig = plt.figure(figsize = (12*1.2, 5*1.2))
        ax = fig.add_subplot(111, projection='3d')
        t = np.linspace(0, 0.02, 1000.)
        X1, X2 = t.min(), t.max()
        Y1, Y2 = -1.2, 1.2
        Z1, Z2 = -1.2, 1.2

        Ex, Hy = PlaneEHfield(-10., t=t, f=100., sig=1e-2)
        ax.plot(t, Ex.real / Ex.real.max(), np.zeros_like(t), 'b', lw=1)
        ax.plot(np.r_[t[itime]], (Ex[itime]).real / Ex.real.max(), 0., 'bo', ms=5)
        ax.plot(t[itime]*np.ones(2), np.r_[0., (Ex[itime]).real / Ex.real.max()], np.ones(2)*(Hy[itime]).real / Hy.real.max(), 'r:')
        ax.plot(t, np.zeros_like(t), Hy.real / Hy.real.max(), 'r', lw=1)
        ax.plot(np.r_[t[itime]], 0., (Hy[itime]).real / Hy.real.max(), 'ro', ms=5)
        ax.plot(t[itime]*np.ones(2), np.ones(2)*(Ex[itime]).real / Ex.real.max() , np.r_[0., (Hy[itime]).real / Hy.real.max()], 'b:')

        ax.plot(np.ones_like(t)*t[itime], Ex.real / Ex.real.max(), Hy.real / Hy.real.max(), 'k-', lw=0.5)
        ax.plot(np.ones(1)*t[itime], Ex[itime].real / Ex.real.max(), Hy[itime].real / Hy.real.max(), 'ko', ms=5)
        ax.plot(t, np.zeros_like(t), np.zeros_like(t), 'k--')
        ax.plot(np.ones(2)*t[itime], np.r_[Y1, Y2], np.zeros(2), 'k--')
        ax.plot(np.ones(2)*t[itime], np.zeros(2), np.r_[Z1, Z2], 'k--')
        x = np.r_[X1,X2,X2,X1,X1]
        y = np.zeros(5)
        z = np.r_[Z1,Z1,Z2,Z2,Z1]
        verts = [zip(x,y,z)]
        polya = polyplane(verts, color="red", alpha=0.1)
        ax.plot(x, y, z, "r-", lw=1, alpha=0.2)
        x = np.r_[X1,X2,X2,X1,X1]
        y = np.r_[Y1,Y1,Y2,Y2,Y1]
        z = np.zeros(5)
        verts = [zip(x, y,z)]
        polyb = polyplane(verts, color="blue", alpha=0.1)
        ax.plot(x, y, z, "b-", lw=1, alpha=0.2)
        x = np.ones(5)*t[itime]
        y = np.r_[Y1,Y2,Y2,Y1,Y1]
        z = np.r_[Z1,Z1,Z2,Z2,Z1]
        verts = [zip(x, y,z)]
        polyc = polyplane(verts, color="grey", alpha=0.1)
        ax.plot(x, y, z, "k-", lw=1, alpha=0.2)

        ax.add_collection3d(polya)
        ax.add_collection3d(polyb)
        ax.add_collection3d(polyc)

        ax.set_zlim(1.2, -1.2)
        ax.set_ylim(-1.2, 1.2)
        ax.set_xlim(t.min(), t.max())
        ax.set_xlabel("Time (s)")
        ax.set_ylabel("Ex (V/m)")
        ax.set_zlabel("Hy (A/m)")
        elev=45
        azim=290
        # elev=-90
        # azim=-90
        ax.view_init(elev,azim)

        pass
Пример #2
0
def plotObj3D(fig=None,
              ax=None,
              offset_plane=0.,
              offset_rx=50.,
              elev=20,
              azim=300,
              X1=-500.,
              X2=500,
              Y1=-500,
              Y2=500,
              Z1=-1000,
              Z2=0,
              nRx=10,
              plane="XZ",
              **kwargs):
    plt.rcParams.update({'font.size': 13})
    # define the survey area
    if fig is None:
        fig = plt.figure(figsize=(7, 7))
    if ax is None:
        ax = fig.add_subplot(111, projection='3d')
    # fixed
    xoffset_rx = offset_rx
    yoffset_rx = 0.

    #XZ plane
    x = np.r_[X1, X2, X2, X1, X1]
    y = np.ones(5) * offset_plane
    z = np.r_[Z1, Z1, Z2, Z2, Z1]
    verts = [zip(x, y, z)]
    polya = polyplane(verts, color="red")
    plt.plot(x, y, z, "k:", lw=1)

    #YZ plane
    x = np.ones(5) * offset_plane
    y = np.r_[Y1, Y2, Y2, Y1, Y1]
    z = np.r_[Z1, Z1, Z2, Z2, Z1]
    verts = [zip(x, y, z)]
    polyb = polyplane(verts, color="blue")
    plt.plot(x, y, z, "k:", lw=1)

    x = np.r_[X1, X2, X2, X1, X1]
    y = np.r_[Y1, Y1, Y2, Y2, Y1]
    z = np.ones(5) * 0.
    verts = [zip(x, y, z)]

    polyc = polyplane(verts, color="grey", alpha=0.4)

    ax.add_collection3d(polya)
    ax.add_collection3d(polyb)
    ax.add_collection3d(polyc)

    # ax.plot(np.ones(2)*xoffset_rx, np.ones(2)*yoffset_rx, np.r_[Z1, Z2], 'k-', lw=1)
    ax.plot(np.ones(2) * 0., np.ones(2) * 0., np.r_[Z1, Z2], 'k--', lw=2)
    # ax.plot(xoffset_rx*np.ones(nRx), yoffset_rx*np.ones(nRx), np.linspace(Z1, Z2, nRx), "r.", ms=4)
    # ax.plot(np.linspace(X1, X2, nRx), np.zeros(nRx), np.zeros(nRx), "b-", ms=4)

    a = Arrow3D([0, 0], [0, 0], [-200, -500],
                mutation_scale=10,
                lw=3,
                arrowstyle="->",
                color="k")
    jx = Arrow3D([-200, 200], [0, 0], [0, 0],
                 mutation_scale=10,
                 lw=3,
                 arrowstyle="->",
                 color="r")
    ex = Arrow3D([0, 400], [0, 0], [-200, -200],
                 mutation_scale=10,
                 lw=2,
                 arrowstyle="->",
                 color="r")
    hy = Arrow3D([0, 0], [0, 400], [-200, -200],
                 mutation_scale=10,
                 lw=2,
                 arrowstyle="->",
                 color="b")

    ax.add_artist(a)
    ax.add_artist(jx)
    ax.add_artist(ex)
    ax.add_artist(hy)

    ax.text(0, 0 + 100., -500, "Wave propagation")
    ax.text(400, 0, -200, "$E_x$", color="red")
    ax.text(0, 400, -200, "$H_y$", color="blue")
    ax.text(0, -300, Z2 + 200, "Current sheet ($I_x$)", color="red")
    # ax.text(xoffset_rx, yoffset_rx, Z2, "Rx hole")
    # ax.text(X2, 0, 0, "Tx profile")

    ax.set_xlabel('X (m)')
    ax.set_ylabel('Y (m)')
    ax.set_zlabel('Z (m)')

    ax.set_xlim3d(X1, X2)
    ax.set_ylim3d(Y1, Y2)
    ax.set_zlim3d(Z1, Z2 + 100.)

    ax.view_init(elev, azim)

    plt.show()
    return ax
Пример #3
0
def plotObj3D(fig=None, ax=None, offset_plane=0., offset_rx=50., elev=20, azim=300, X1=-500., X2=500, Y1=-500, Y2=500, Z1=-1000, Z2=0, nRx=10, plane="XZ", **kwargs):
    plt.rcParams.update({'font.size': 13})
    # define the survey area
    if fig is None:
        fig = plt.figure(figsize = (7, 7))
    if  ax is None:
        ax = fig.add_subplot(111, projection='3d')
    # fixed
    xoffset_rx = offset_rx
    yoffset_rx = 0.

    #XZ plane
    x = np.r_[X1,X2,X2,X1,X1]
    y = np.ones(5)*offset_plane
    z = np.r_[Z1,Z1,Z2,Z2,Z1]
    verts = [zip(x,y,z)]
    polya = polyplane(verts, color="red")
    plt.plot(x, y, z, "k:", lw=1)

    #YZ plane
    x = np.ones(5)*offset_plane
    y = np.r_[Y1,Y2,Y2,Y1,Y1]
    z = np.r_[Z1,Z1,Z2,Z2,Z1]
    verts = [zip(x, y,z)]
    polyb = polyplane(verts, color="blue")
    plt.plot(x, y, z, "k:", lw=1)

    x = np.r_[X1,X2,X2,X1,X1]
    y = np.r_[Y1,Y1,Y2,Y2,Y1]
    z = np.ones(5)*0.
    verts = [zip(x, y,z)]

    polyc = polyplane(verts, color="grey", alpha=0.4)

    ax.add_collection3d(polya)
    ax.add_collection3d(polyb)
    ax.add_collection3d(polyc)

    # ax.plot(np.ones(2)*xoffset_rx, np.ones(2)*yoffset_rx, np.r_[Z1, Z2], 'k-', lw=1)
    ax.plot(np.ones(2)*0., np.ones(2)*0., np.r_[Z1, Z2], 'k--', lw=2)
    # ax.plot(xoffset_rx*np.ones(nRx), yoffset_rx*np.ones(nRx), np.linspace(Z1, Z2, nRx), "r.", ms=4)
    # ax.plot(np.linspace(X1, X2, nRx), np.zeros(nRx), np.zeros(nRx), "b-", ms=4)

    a = Arrow3D([0,0], [0,0],
                [-200,-500], mutation_scale=10,
                lw=3, arrowstyle="->", color="k")
    jx = Arrow3D([-200,200], [0,0],
                [0, 0], mutation_scale=10,
                lw=3, arrowstyle="->", color="r")
    ex = Arrow3D([0, 400], [0,0],
                [-200,-200], mutation_scale=10,
                lw=2, arrowstyle="->", color="r")
    hy = Arrow3D([0,0], [0, 400],
                [-200,-200], mutation_scale=10,
                lw=2, arrowstyle="->", color="b")

    ax.add_artist(a)
    ax.add_artist(jx)
    ax.add_artist(ex)
    ax.add_artist(hy)

    ax.text(0, 0+100., -500, "Wave propagation")
    ax.text(400, 0, -200, "$E_x$", color="red")
    ax.text(0, 400, -200, "$H_y$", color="blue")
    ax.text(0, -300, Z2+200, "Current sheet ($I_x$)", color="red")
    # ax.text(xoffset_rx, yoffset_rx, Z2, "Rx hole")
    # ax.text(X2, 0, 0, "Tx profile")

    ax.set_xlabel('X (m)')
    ax.set_ylabel('Y (m)')
    ax.set_zlabel('Z (m)')


    ax.set_xlim3d(X1, X2)
    ax.set_ylim3d(Y1, Y2)
    ax.set_zlim3d(Z1, Z2+100.)

    ax.view_init(elev,azim)

    plt.show()
    return ax