Exemple #1
0
def getXKA(fIn):
    isOut = lfmpp.getOut(fIn, mp=True)

    #Get spherical coordinates of last MP Xing
    R, Phi, Lambda = lfmpp.getSphLoss(fIn)

    #Get time index of last MP crossing
    t, tEq = lfmpp.getH5p(fIn, "Teq", Mask=isOut)

    tsEq = np.argmax(tEq, axis=0)
    #Use these slices to find values at last X'ing
    t, Kt = lfmpp.getH5p(fIn, "kev", Mask=isOut)
    t, Vxt = lfmpp.getH5p(fIn, "vx", Mask=isOut)
    t, Vyt = lfmpp.getH5p(fIn, "vy", Mask=isOut)
    t, Vzt = lfmpp.getH5p(fIn, "vz", Mask=isOut)

    Np = Kt.shape[1]
    K = np.zeros(Np)
    A = np.zeros(Np)

    for i in range(Np):
        tsi = tsMP[i]
        vxi = Vxt[tsi, i]
        vyi = Vyt[tsi, i]
        vzi = Vzt[tsi, i]
        vmag = np.sqrt(vxi**2.0 + vyi**2.0 + vzi**2.0)

        K[i] = Kt[tsi, i]
        A[i] = np.arccos(vzi / vmag) * 180 / np.pi

    mlt = Phi
    return mlt, K, A
Exemple #2
0
pBX = []
mDp = []
LogScl = LogNorm(1, 500)

for i in range(Ns):
    #xBin = np.linspace(-180,180,100)
    xBin = np.linspace(-60, 60, 100)
    yBin = np.linspace(0, 30, 30)

    fIn = dirStub + "/" + spcs[i] + "." + fileStub
    print("Reading %s" % (fIn))
    print("Species %s" % (Leg[i]))
    isOut = lfmpp.getOut(fIn)
    pid, NumX = lfmpp.countMPX(fIn, isOut)
    R, PhiMP0, LambdaF, Tmp = lfmpp.getSphLoss1st(fIn)
    R, PhiMP1, LambdaL = lfmpp.getSphLoss(fIn)
    PhiBX = lastPhi(fIn)

    pMP0.append(PhiMP0)
    pMP1.append(PhiMP1)
    mpDp.append(PhiMP1 - PhiMP0)
    pBX.append(PhiBX)
    msDp.append(PhiBX - PhiMP1)

    mDp.append(PhiBX - PhiMP0)
Nb = 40
N0 = -60
N1 = 120
bins = np.linspace(N0, N1, Nb)
doNorm = True
doLog = False
Exemple #3
0
Mrks = ["-", "--"]

lfmv.ppInit()
P0 = -150
P1 = 150
L0 = -60
L1 = 60
pBin = np.linspace(P0, P1, Np)
pC = 0.5 * (pBin[0:-1] + pBin[1:])
lBin = np.linspace(L0, L1, Nl)
lC = 0.5 * (lBin[0:-1] + lBin[1:])

NumSpc = len(Spcs)

for n in range(NumSpc):
    R, Phi, Lambda = lfmpp.getSphLoss(fIns[n])
    X, pI, lI = np.histogram2d(Phi, Lambda, [pBin, lBin])

    Xs = ndimage.filters.gaussian_filter(X, 1, mode='nearest')
    print("Species %s" % (Spcs[n]))
    nS = len(pSlcs)
    for i in range(nS):
        pS = pSlcs[i]
        dP = np.abs(pC - pS)
        I = np.abs(pC - pS).argmin()
        pStr = "%s%s" % (Cols[i], Mrks[n])
        if (n == 0):
            labS = "Phi = %d" % (pS)
        else:
            labS = "_ignore"
        plt.plot(lC, X[I, :], pStr, label=labS)
Exemple #4
0
xbins = 50
ybins = 50
Nb = 50

Ns = len(spcs)
fig = plt.figure(1, figsize=(10, 10))
aCut = 80
cMin = 1
cMax = 200
cNorm = LogNorm(vmin=cMin, vmax=cMax)

for i in range(Ns):
    fIn = dirStub + "/" + spcs[i] + "." + fileStub
    pid, alph0 = lfmpp.getPitch(fIn)

    Rf, Pf, Lf = lfmpp.getSphLoss(fIn, inMask=(alph0 >= aCut))
    Ri, Pi, Li = lfmpp.getSphLoss(fIn, inMask=(alph0 < aCut))

    Np = 2 * i + 1
    plt.subplot(Ns, 2, Np)
    xe, ye, Hi = h2d(Pi, Li, Nb)
    plt.pcolormesh(xe, ye, Hi, norm=cNorm)
    cbar = plt.colorbar()
    plt.xlim((-180, 180))
    plt.ylim((-60, 60))

    plt.subplot(Ns, 2, Np + 1)
    #plt.hist2d(Pf,Lf,[xbins,ybins],cmap=cMap,normed=False,cmin=0,cmax=200)
    xe, ye, Hf = h2d(Pf, Lf, Nb)
    plt.pcolormesh(xe, ye, Hf, norm=cNorm)
    cbar = plt.colorbar()
Exemple #5
0
spcs = ["H", "O"]
Leg = ["Hydrogen", "Oxygen"]
fOut = "OxyDelP.h5part"
K = 5
i = 1  #Oxygen

fIn = dirStub + "/" + spcs[i] + "." + fileStub
print("Reading %s" % (fIn))
print("Species %s" % (Leg[i]))
t, ids = lfmpp.getH5p(fIn, "id")

isOut = lfmpp.getOut(fIn)
pid, NumX = lfmpp.countMPX(fIn, isOut)
R, PhiF, LambdaF, Tmp = lfmpp.getSphLoss1st(fIn)
R, PhiL, LambdaL = lfmpp.getSphLoss(fIn)
DelPhi = PhiL - PhiF

isOut[isOut] = (DelPhi) > 60
Mask = isOut

id0 = ids[0, Mask]
Np = Mask.sum()

print(Np)
print(K)
if (Np < K):
    K = Np
if (subVTI):
    lfmpp.subH5p(fIn, Mask, K, fOut=fOut, xEq=False)
# else:
Exemple #6
0
import os
import lfmViz as lfmv
import lfmPostproc as lfmpp
import matplotlib as mpl
import matplotlib.pyplot as plt
from matplotlib.colors import LogNorm

fIn = '/Users/soratka1/Work/magnetoloss/synth/e.100keV.h5part'
#fIn = '/Users/soratka1/Work/magnetoloss/debug/e.100keV.h5part'

aCut = 80
pCut = 10
lCut = 30
lCut0 = 5
pid, alph0 = lfmpp.getPitch(fIn)
Rf,Pf,Lf = lfmpp.getSphLoss(fIn,inMask=(alph0>aCut))

Out = lfmpp.getOut(fIn)
Out = Out & (alph0>aCut)
ids = pid[Out]
#hiLat = (np.abs(Lf) > lCut) & (np.abs(Pf) < pCut)
hiLat = (np.abs(Lf) < lCut0) & (np.abs(Pf) < pCut)


#Ri,Pi,Li = lfmpp.getSphLoss(fIn,inMask=(alph0<aCut))

print("Found %d high-lat electrons"%(hiLat.sum()))

pIds = ids[hiLat]
print(pIds)
Np = len(pIds)
Exemple #7
0
fileStub = "100keV.h5part"

spcs = ["H","O","e"]
cMap="jet"

Nb = 50
Ns = len(spcs)
fig = plt.figure(1, figsize=(10, 10))
cMin = 1.0e-5
cMax = 1.0e-2

cNorm = LogNorm(vmin=cMin,vmax=cMax)

for i in range(Ns-1):
	fIn = dirStub + "/" + spcs[i] + "." + fileStub
	Rf,Pf,Lf = lfmpp.getSphLoss(fIn)
	Ri,Pi,Li,Tmp = lfmpp.getSphLoss1st(fIn)
	Np = 2*i+1
	plt.subplot(Ns-1,2,Np)
	#plt.hist2d(Pi,Li,[xbins,ybins],cmap=cMap,normed=True,norm=LogNorm())
	xe,ye,Hi = h2d(Pi,Li,Nb)
	plt.pcolormesh(xe,ye,Hi,norm=cNorm)
	cbar=plt.colorbar()
	plt.xlim( (-180,180) )
	plt.ylim( (-90,90) )
	plt.subplot(Ns,2,Np+1)
	#plt.hist2d(Pf,Lf,[xbins,ybins],cmap=cMap,normed=True,norm=LogNorm())
	xe,ye,Hf = h2d(Pf,Lf,Nb)
	plt.pcolormesh(xe,ye,Hf,norm=cNorm)
	cbar=plt.colorbar()
	plt.xlim( (-180,180) )