コード例 #1
0
ファイル: energy_test.py プロジェクト: rochSmets/pywi
def main():

    run = hr.HeckleRun('r', '/Volumes/drobo/nico/asymmetric/078')

    # this will read the data
    # calculate :vsp
    nrjbox = nrj.box(
        run,
        time,
        extent=(x0, y0, x1, y1),
        specie='ions',
    )

    print "super main"
コード例 #2
0
def test():
    # Create some sample data
    #    dx = np.linspace(0,1,20)
    #    X,Y = np.meshgrid(dx,dx)
    #    Z  = X**2 - Y
    #    Z3 = Y
    #    Z2 = X

    #    r = hr.HeckleRun('r','/Volumes/drobo/nico/asymmetric/078/')
    r = hr.HeckleRun('r', '/Users/naunai/Documents/data/071/')

    Vi = r.GetVi(26.)
    Vix = Vi[0, :, :]
    Viy = Vi[1, :, :]

    immt = mmt.Momentum(r, np.arange(25, 27, 0.2), 'ions', smoothing='yes')

    #    force = r.divP(42.5,'ions')#immt.pressure(sigma=1) #r.GetField("piyy",42.5)#immt.pressure(sigma=1)
    force = immt.electric(sigma=0)
    force = immt.acceleration(sigma=0)
    force = immt.pressure(sigma=1)

    dtf = r.GetTimeStep('fields')

    x = r.dl[0] * np.arange(0, r.ncells[0] + 1)
    y = r.dl[1] * np.arange(0, r.ncells[1] + 1)

    Flux = r.GetFlux(26.)

    c = cp.ColorP(
        force[1, :, :],
        x,
        y,
        xlabel='x',
        ylabel='y',
        title='Test Momentum on Heckle',
        vmin=-0.9,
        vmax=0.9,
        extent=(55, 95, 15, 35),  #extent=(20,40,5,20),
        vecfield=(force[0, :, :], force[1, :, :]),
        veccolorcode=np.sqrt(Vix**2 + Viy**2),
        vecscale=1.0,
        vecbin=6,
        fieldlines=Flux  #, 
        #save=True
    )

    c.display()

    plot_momentum(r, immt, 10.0)
コード例 #3
0
def test():
    # Create some sample data
#    dx = np.linspace(0,1,20)
#    X,Y = np.meshgrid(dx,dx)
#    Z  = X**2 - Y
#    Z3 = Y
#    Z2 = X


    r = hr.HeckleRun('r','/Volumes/drobo/nico/asymmetric/062/')

    Vi = r.GetVi(50.)
    Vix= Vi[0,:,:]
    Viy = Vi[1,:,:]

    E = r.GetE(50.0)
    Ex = E[0,:,:]
    Ey = E[1,:,:]

    dtf = r.GetTimeStep('fields')


    x   = r.dl[0]*np.arange(0, r.ncells[0]+1)
    y   = r.dl[1]*np.arange(0, r.ncells[1]+1)

    Flux = r.GetFlux(50.)

    c = cp.ColorP(Vix,x, y,
                  xlabel='x',
                  ylabel='y',
                  title=r'$V_{ix}$ and $\mathbf{E}$',
                  vmin = -1,vmax=1,
                  extent=(60,85,15,35),
                  vecfield=(Ex,Ey),
                  veccolorcode=np.sqrt(Ex**2 + Ey**2),
                  fieldlines=Flux, 
                  save=True
                  )

    c.display()
コード例 #4
0
def getlines():

    run062 = hr.HeckleRun('run062',\
                          '/Volumes/drobo/nico/asymmetric/062/')



    Vi = run062.GetVi(50.)

    dx = run062.dl[0]
    dy = run062.dl[1]

    seeds = [ (76./dx,30./dy),(77./dx,30./dy)]

    Vix = Vi[0,:,:]
    Viy = Vi[1,:,:]

    print "Calculating fieldlines..."

    st = stl.fieldlines(Vix,Viy,seeds)

    print "fieldlines calculated."

    return st
コード例 #5
0
ファイル: momentum_test.py プロジェクト: rochSmets/pywi
def main():
    import picgsfc as pr
    import numpy as np
    import momentum as mmt
    import matplotlib.pyplot as plt
    import matplotlib.patches as mpatches
    import hecklerun as hr
    import scipy.ndimage as ndimage

    #    run = pr.PICGSFCrun('by10',\
    #                            '/Volumes/drobo/nico/asymmetric/by10/data/')

    run = hr.HeckleRun('r', '/Volumes/drobo/nico/asymmetric/79')

    immt = mmt.Momentum(run,
                        np.arange(40, 42, 0.5),
                        'ions',
                        smoothing='yes',
                        silent='yes')

    datac = run.GetB(21., silent='yes')
    datac = datac[1, :, :]

    plt.imshow(
        np.transpose(datac),  # data to show \
        cmap='jet',  # color map\
        origin='lower',  # where is the zero\
        interpolation='nearest',  # pixels \
        extent=[0, 64, 0, 25.6],  # range for x and y 
        aspect='equal',  # auto = aspect ratio given by 'extent'
        vmin=np.min(datac),
        vmax=np.max(datac))
    #
    #  ax1.set_title(r'$J_z$', fontsize=25)
    #  ax1.set_xlabel(r'$x/\delta_i$', fontsize=20)
    #  ax1.set_ylabel(r'$y/\delta_i$', fontsize=20)

    plt.colorbar()
    plt.savefig('acc')
    #   plt.show()

    plt.close()

    # take the indice of x=35.0, don't care about iy
    ix, iy = run.coord2indices((35.0, 0.0))

    print "We do a cut at ix(x=35.) = ", ix

    forces = immt.totalforce(sigma=1)
    acc = immt.acceleration(sigma=1)

    mag = (immt.magnetic(sigma=0))[2, ix, :]
    elec = (immt.electric(sigma=0))[2, ix, :]
    press = (immt.pressure(sigma=[1., 0.5]))[2, ix, :]
    acc = (immt.acceleration(sigma=[1., 0.5]))[2, ix, :]

    z = run.GetCoord(0, 50, axis='y')

    print np.shape(z), np.shape(mag)

    plt.plot(z, mag, label='Magnetic force')
    plt.plot(z, elec, label='Electric force')
    plt.plot(z, press, label='Pressure force')
    plt.plot(z, acc, label='Acceleration (steady part)')

    plt.axis((8.8, 16.8, -2, 2))
    plt.legend()

    plt.show()
コード例 #6
0
ファイル: ohm_test.py プロジェクト: rochSmets/pywi
def ohmtest():
    r = hr.HeckleRun('r', '/Volumes/drobo/nico/asymmetric/062/')
    ol = ohm.Ohm(r, 50)

    return [r, ol]