Ejemplo n.º 1
0
def figure():
        fName = './dataUseCase11/Wrz_2Layer_mcml_ISPGauss_R00.15.npz'

        c0 = 1.0 # speed of sound in medium 
        G = 1.0 # efficiency of transforming absorbed energy to acoustic stress
        zD = -2.0 # z-location of pointlike detector 
        Nphi = 1 # number of azimutal mesh points considered for integration 
                 # (in case of on-axis signals Nphi=1 suffices)

        # READ VOLUMETRIC ENERGY DENSITY FROM COMPRESSED .npz FILE
        (r,z,Wrz) = io.npz.readROI(fName)

        # COMPUTE OA SIGNAL AT DETECTOR POSITION
        t,p = ps.pressure((r,z,G*Wrz),(0.0,zD),c0,Nphi) 
        
        # VISUALIZE USING MATPLOTLIB
        plt.rc('font',family='serif',size=14)
        plt.figure(figsize=(8.,6.), dpi=80)
        plt.plot(c0*t+zD,p, label='$z_D$=%3.2lf cm'%(zD))
        plt.xlim(-0.005,0.18)
        plt.ylabel('$p$ (Pa)', size=14)
        plt.xlabel('$c \\tau$ (cm)', size=14)
        plt.axhline(y=0,color='black', ls='--')
        plt.legend(loc='upper right', prop={'size':14}, frameon=False)
        plt.show()
def figure():

        # PARAMETERS FOR OA SIGNAL GENERATION
        c0 = 150000.0           # sonic velocity
        G = 1.0                 # Grueneissen parameter
        rD = 0.0                # detector location relative to beam axis
        tp = 2.*10**(-8)        # gaussian pulse width (s) 

        # GENERAL FIGURE SETTINGS ---------------------------------------------
        plt.rc('font',family='serif',size=12)
        plt.figure(figsize=(7.,7.))

        # FIG (b): FLAT-TOP ISP
        ax12= plt.subplot2grid((2,2), (0,0))
        ax12.set_aspect('equal')
        r,z,W_ft = io.npz.readROI("./dataUseCase21/Wrz_flatTop.npz")
        ax12.contourf(z,r,W_ft,100,lw=0.1)
        c2 = ax12.contourf(z,r,W_ft,100)
        divider2 = make_axes_locatable(ax12)
        cax12 = divider2.append_axes("right", "5%", pad="3%")
        c2Bar = plt.colorbar(c2,cax=cax12)
        c2Bar.set_label('$W(r,z)$ (J/m$^2$)',fontsize=10)
        c2Bar.ax.tick_params(labelsize=10)
        ax12.set_ylabel('$r$  (cm)')
        ax12.set_xlabel('$z$  (cm)')
        ax12.text(0.,1.05,'(a)',transform=ax12.transAxes,fontsize=12)

        # FIG (c): DONUT ISP
        ax13= plt.subplot2grid((2,2), (0,1))
        ax13.set_aspect('equal')
        r,z,W_d  = io.npz.readROI("./dataUseCase21/Wrz_Donut.npz")
        ax13.contour(z,r,W_d,100,lw=0.1)
        c3 = ax13.contourf(z,r,W_d,100)
        divider3 = make_axes_locatable(ax13)
        cax13 = divider3.append_axes("right", "5%", pad="3%")
        c3Bar = plt.colorbar(c3,cax=cax13)
        c3Bar.set_label('$W(r,z)$ (J/m$^2$)', fontsize=10)
        c3Bar.ax.tick_params(labelsize=10)
        ax13.set_ylabel('$r$  (cm)')
        ax13.set_xlabel('$z$  (cm)')
        ax13.text(0.,1.05,'(b)',transform=ax13.transAxes,fontsize=12)

        # FIG (d): ON-AXIS OA SIGNALS FOR DONUT ISP 
        ax21 = plt.subplot2grid((2,2), (1,0), colspan=2)
        for zD in [-0.5,-1.0,-2.0,-4.0,-8.0]:
            t,p_d = ps.pressure((r,z,G*W_d),(rD,zD),c0,1) 
            p_d = pp.convolveGauss(p_d,(t,tp))
            ax21.plot(c0*t+zD,p_d, label='$z_D$=%3.2lf cm'%(zD))
        ax21.set_xlim([-0.005,0.18])
        ax21.set_ylabel('$p$ (Pa per J)')
        ax21.set_xlabel('$c \\tau$ (cm)')
        ax21.axhline(y=0,color='black', ls='--')
        ax21.legend(loc='upper right', prop={'size':10}, frameon=False)
        ax21.text(0.,1.05,'(c)',transform=ax21.transAxes,fontsize=12)

        plt.tight_layout(pad=2.)
        #plt.show()
        plt.savefig('useCase_mcml_abc.eps',dpi=600,format='eps')
Ejemplo n.º 3
0
def main():
    iPathNpz = sys.argv[1]

    (c0, G) = (1.0, 1.0)
    (rD, zD) = (0.0, -3.0)

    (r, z, Wrz) = io.npz.readROI(iPathNpz)
    t, p = ps.pressure((r, z, G * Wrz), (rD, zD), c0, 1)

    print "# (c0 tau) (p)"
    for i in range(t.size):
        print c0 * t[i] + zD, p[i]
Ejemplo n.º 4
0
def main():
    iPathNpz = sys.argv[2]

    c0, G = 150000.0, 1.0
    rD, zD = 0.0, float(sys.argv[1])
    tp = 2. * 10**(-8)  # gaussian pulse width (s)

    (r, z, Wrz) = io.npz.readROI(iPathNpz)
    t, p = ps.pressure((r, z, G * Wrz), (rD, zD), c0, 1)

    ptp = pp.convolveGauss(p, (t, tp))

    print "# tp = %g s" % (tp)
    print "# (c0 tau) (p)"
    for i in range(t.size):
        print c0 * t[i] + zD, p[i], ptp[i]
Ejemplo n.º 5
0
def main():
    fName = sys.argv[1]  # E.g. 'Wrz_SkinOA_1G_ISPGauss_R00.80.npz'

    c0 = 1.0  # speed of sound in medium
    G = 1.0  # efficiency of transforming absorbed energy to acoustic stress
    zD = -2.0  # z-location of pointlike detector
    Nphi = 1  # number of azimutal mesh points considered for integration
    # (in case of on-axis signals Nphi=1 suffices)

    # READ VOLUMETRIC ENERGY DENSITY FROM COMPRESSED .npz FILE
    (r, z, Wrz) = io.npz.readROI(fName)

    t, p = ps.pressure((r, z, G * Wrz), (0.0, zD), c0, Nphi)

    tau = t + zD / c0
    print "# (c0 tau) (p(tau))"
    for i in range(tau.size):
        print c0 * tau[i], p[i]