Ejemplo n.º 1
0
def plotPowVsZ(basename):

    filelist = getIntFileSlices(basename)
    print filelist

    mdata = fdata(filelist[0])

    sampleFreq = 1.0 / mdata.vars.dz2

    lenz2 = (mdata.vars.nz2 - 1) * mdata.vars.dz2
    z2axis = (np.arange(0, mdata.vars.nz2)) * mdata.vars.dz2

    xaxis = (np.arange(0, mdata.vars.nx)) * mdata.vars.dxbar
    yaxis = (np.arange(0, mdata.vars.ny)) * mdata.vars.dybar

    fcount = 0

    pows = np.zeros(len(filelist))
    zData = np.zeros(len(filelist))

    if (mdata.vars.iMesh == iPeriodic):
        gAv = iav  #  for average...
        plotLab = 'Power'
        axLab = 'Power (W)'
    else:
        gAv = ipeak  #  for peak...
        plotLab = 'Peak Power'
        axLab = 'Power (W)'

    for ij in filelist:
        pows[fcount] = getPowFromInt(ij, irtype=gAv, qScale=0)
        zData[fcount] = getZData(ij)
        fcount += 1

    ax1 = plt.subplot(111)
    plt.semilogy(zData, pows, label=plotLab)
    #ax1.set_title(axLab)
    plt.xlabel('z (m)')
    plt.ylabel(axLab)

    #plt.legend()

    opname = basename + "-unfiltered-power.png"

    plt.savefig(opname)
    #    plt.show()

    outfilename = 'powers.h5'
    h5o = tables.open_file(outfilename, 'w')
    h5o.create_array('/', 'power_SI', pows)
    h5o.create_array('/', 'z_SI', zData)
    h5o.close()
Ejemplo n.º 2
0
def plotPowVsZ2(fname):


    mdata = fdata(fname)

    sampleFreq = 1.0 / mdata.vars.dz2

    lenz2 = (mdata.vars.nz2-1) * mdata.vars.dz2
    z2axis = (np.arange(0,mdata.vars.nz2)) * mdata.vars.dz2
    saxis = z2axis * mdata.vars.lc * 1e6
        
    xaxis = (np.arange(0,mdata.vars.nx)) * mdata.vars.dxbar
    yaxis = (np.arange(0,mdata.vars.ny)) * mdata.vars.dybar
    
    z = mdata.vars.z


    gAv = iav  #  for average...
    plotLab = 'Power'
    axLab = 'Power (W)'
    
    pows = getPowFromInt(fname, irtype = itemp, qScale = 0)


    ax1 = plt.subplot(111)
    plt.plot(saxis, pows)
    plt.xlabel(r'$ct-z (\mu m)$')
    plt.ylabel(axLab)
    ax1.set_title('z = ' + str(z) + 'm')

    #plt.legend()









    nameparts = fname.split('_')
    basename = nameparts[0]


    #plt.show()

    plt.savefig(basename + "-powvsz2-step-" + str(mdata.vars.step) + "-z-" + \
        str(z) + "m" + ".png")
Ejemplo n.º 3
0
def plotPowVsZ(basename):
    filelist = getIntFileSlices(basename)
    print(filelist)

    mdata = fdata(filelist[0])

    fcount = 0
    
    pows = np.zeros(len(filelist))
    zData = np.zeros(len(filelist))

    if (mdata.vars.iMesh == iPeriodic):
        gAv = iav  #  for average...
        plotLab = 'Power'
        axLab = 'Power (W)'
    else:
        gAv = ipeak  #  for peak...
        plotLab = 'Peak Power'
        axLab = 'Power (W)'
    
    for ij in filelist:
        pows[fcount] = getPowFromInt(ij, irtype = gAv, qScale = 0)
        zData[fcount] = getZData(ij)
        fcount += 1

    plt.semilogy(zData, pows, label=plotLab)
    plt.xlabel('z (m)')
    plt.ylabel(axLab)

    opname = basename + "-unfiltered-power.png"

    plt.savefig(opname)

    outfilename = 'powers.h5'
    h5o = tables.open_file(outfilename,'w')
    h5o.create_array('/','power_SI',pows)
    h5o.create_array('/','z_SI',zData)
    h5o.close()
Ejemplo n.º 4
0
def plotPowZZ2(basename):

    filelist = getIntFileSlices(basename)
    print(filelist)

    mdata = fdata(filelist[0])

    sampleFreq = 1.0 / mdata.vars.dz2

    lenz2 = (mdata.vars.nz2 - 1) * mdata.vars.dz2
    z2axis = (np.arange(
        0, mdata.vars.nz2)) * mdata.vars.dz2 * mdata.vars.lc * 1.e6

    xaxis = (np.arange(0, mdata.vars.nx)) * mdata.vars.dxbar
    yaxis = (np.arange(0, mdata.vars.ny)) * mdata.vars.dybar

    fcount = 0

    pows = np.zeros(len(filelist))
    zData = np.zeros(len(filelist))

    #    if (mdata.vars.iMesh == iPeriodic):
    #        gAv = 1  #  for average...
    #    else:
    #        gAv = 2  #  for peak...

    gAv = 0  # for temporal (no cycle averaging)

    pows = np.ones([len(filelist), mdata.vars.nz2])
    powsN = np.ones([len(filelist), mdata.vars.nz2])

    for ij in filelist:
        pows[-1 - fcount, :] = getPowFromInt(ij, irtype=gAv, qScale=0)
        mv = np.max(pows[-1 - fcount, :])
        if (mv != 0.):
            powsN[-1 - fcount, :] = pows[-1 - fcount, :] / np.max(
                pows[-1 - fcount, :])
        else:
            powsN[-1 - fcount, :] = 0.
        zData[fcount] = getZData(ij)
        fcount += 1
#        print fcount

#    plotLab = 'SI Power'
#    axLab = 'Power (W)'

#    if (mdata.vars.iMesh == iPeriodic):
#        plotLab = 'SI Power'
#        axLab = 'Power (W)'
#    else:
#        plotLab = 'SI Peak Power'
    axLab = 'Power (W)'

    ax1 = plt.subplot(111)
    im = plt.imshow(powsN, aspect='auto', interpolation='bilinear', \
        extent=[z2axis[0], z2axis[-1], zData[0], zData[-1]])
    ax1.set_title('Power')
    plt.xlabel(r'$ct-z (\mu m)$')
    plt.ylabel('z (m)')

    cb = plt.colorbar(im)

    plt.tight_layout()
    #plt.legend()

    opname = basename + "-powerALL.png"

    plt.savefig(opname)