Esempio n. 1
0
def plotCrossCorrelateValues(fileh5, A="2DPhi",B="2DTp",frame=-1, Z=0, species=1):
    import scipy.signal
    

    D, T, A = gkcData.getData(A, fileh5, Z, frame)
    D, T, B = gkcData.getData(B, fileh5, Z, frame)
    

    # first correlate then average
    C = []
    
    for nky in np.arange(1,len(A[:,0])): C.append(scipy.signal.correlate(abs(A[nky,:]), abs(B[nky,:])))
    Corr = np.array(C)
  
    X = np.linspace(-np.pi, np.pi, len(Corr[0,:]))
    Y = (D['ky'])[1:]


    ax = pylab.subplot(111)
    
    ax.contourf(X,Y,Corr[:,:],100, cmap=pylab.cm.hot)
    #pylab.colorbar()
    
    ax.set_yscale("log") 
    
    ax.set_xticks([-np.pi, -np.pi/2., 0, np.pi/2., np.pi])
    ax.set_xticklabels(['$\\pi$', '$-\\pi/2$', '$0$', '$\\pi/2$', '$\\pi$'])
    
    ax.plot(np.linspace(0., 0., 101), np.linspace(Y.min(), Y.max(), 101), 'r-')
    
    ax.set_xlim((-np.pi, np.pi))
    pylab.ylim((Y.min(), Y.max()))
    
    pylab.xlabel("Phase")
    pylab.ylabel("$k_y$")
Esempio n. 2
0
def plotCrossCorrelateValues(fileh5,
                             A="2DPhi",
                             B="2DTp",
                             frame=-1,
                             Z=0,
                             species=1):
    import scipy.signal

    D, T, A = gkcData.getData(A, fileh5, Z, frame)
    D, T, B = gkcData.getData(B, fileh5, Z, frame)

    # first correlate then average
    C = []

    for nky in np.arange(1, len(A[:, 0])):
        C.append(scipy.signal.correlate(abs(A[nky, :]), abs(B[nky, :])))
    Corr = np.array(C)

    X = np.linspace(-np.pi, np.pi, len(Corr[0, :]))
    Y = (D['ky'])[1:]

    ax = pylab.subplot(111)

    ax.contourf(X, Y, Corr[:, :], 100, cmap=pylab.cm.hot)
    #pylab.colorbar()

    ax.set_yscale("log")

    ax.set_xticks([-np.pi, -np.pi / 2., 0, np.pi / 2., np.pi])
    ax.set_xticklabels(['$\\pi$', '$-\\pi/2$', '$0$', '$\\pi/2$', '$\\pi$'])

    ax.plot(np.linspace(0., 0., 101), np.linspace(Y.min(), Y.max(), 101), 'r-')

    ax.set_xlim((-np.pi, np.pi))
    pylab.ylim((Y.min(), Y.max()))

    pylab.xlabel("Phase")
    pylab.ylabel("$k_y$")
Esempio n. 3
0
def plotContour(fileh5, var="2DPhi", **kwargs):
    """
        Plots Scalar Data (2D) in XY  coordinates


        Optional keyword arguments:

        Keyword           Description
        ===============   ==============================================
         *dir*             Direction 'X' (for radial) or 'Y' for poloidal
         *modes*           List of modes (default plot modes). 
                           e.g. modes = [1,4,5]         - to plot all modes
                                modes = range(Nky)[::2] - to plot every second mode
         *field*           'phi' electric potential
                           'A' parallel magnetic vector potential
                           'B' parallel magnetic field
         *dir*             Direction 'X' (for radial) or 'Y' for poloidal
         *doCFL*           clear previous figure
         *label*           'ky' or 'm'
         *offset*          Offset due to zeroset to 2 .

    """
    D = gkcData.getDomain(fileh5)
    
    #norm     = kwargs.pop('Normalize', True)
    Z        = kwargs.pop('Z', 0)
    modes    = kwargs.pop('modes' , range(D['Nky']))
    doCFL    = kwargs.pop('doCFL' , True)
    #interpolation = kwargs.pop('interpolation' , 'bilinear')
    printTitle    = kwargs.pop('printTitle' , True)
    #orientation   = kwargs.pop('orientation' , 'horizontal')
    frame         = kwargs.pop('frame' , -1)
    
    
    D, T, data = gkcData.getData(var, fileh5, Z, frame, species=0)
  
    X, Y, data = gkcData.getRealFromXky(fileh5, data, modes)
   
    gkcStyle.plotContourWithColorbar(X,Y, data, **kwargs)
   
   
    pylab.xlabel(kwargs.pop('xlabel' , 'X'))
    pylab.ylabel(kwargs.pop('ylabel' , 'Y'))

    if printTitle == True : pylab.title("TimeStep : %i   Time : %.3f " % (T[0], T[1]))
Esempio n. 4
0
def plotContour(fileh5, var="2DPhi", **kwargs):
    """
        Plots Scalar Data (2D) in XY  coordinates


        Optional keyword arguments:

        Keyword           Description
        ===============   ==============================================
         *dir*             Direction 'X' (for radial) or 'Y' for poloidal
         *modes*           List of modes (default plot modes). 
                           e.g. modes = [1,4,5]         - to plot all modes
                                modes = range(Nky)[::2] - to plot every second mode
         *field*           'phi' electric potential
                           'A' parallel magnetic vector potential
                           'B' parallel magnetic field
         *dir*             Direction 'X' (for radial) or 'Y' for poloidal
         *doCFL*           clear previous figure
         *label*           'ky' or 'm'
         *offset*          Offset due to zeroset to 2 .

    """
    D = gkcData.getDomain(fileh5)

    #norm     = kwargs.pop('Normalize', True)
    Z = kwargs.pop('Z', 0)
    modes = kwargs.pop('modes', range(D['Nky']))
    doCFL = kwargs.pop('doCFL', True)
    #interpolation = kwargs.pop('interpolation' , 'bilinear')
    printTitle = kwargs.pop('printTitle', True)
    #orientation   = kwargs.pop('orientation' , 'horizontal')
    frame = kwargs.pop('frame', -1)

    D, T, data = gkcData.getData(var, fileh5, Z, frame, species=0)

    X, Y, data = gkcData.getRealFromXky(fileh5, data, modes)

    gkcStyle.plotContourWithColorbar(X, Y, data, **kwargs)

    pylab.xlabel(kwargs.pop('xlabel', 'X'))
    pylab.ylabel(kwargs.pop('ylabel', 'Y'))

    if printTitle == True:
        pylab.title("TimeStep : %i   Time : %.3f " % (T[0], T[1]))