Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def build_gamma(f5F):
vx = read_h5_array(f5F, "Vxp")
vy = read_h5_array(f5F, "Vyp")
vz = read_h5_array(f5F, "Vzp")
gam = 1.0/np.sqrt(1.0 - vx**2 + vy**2 + vz**2)
return gam
def read_periphery(outdir, fname, var, lap):
#fields_file = conf.outdir + "/" + fname_fld + "_" + str(lap) + ".h5"
fname = "slices" #overwrite
xy_file = outdir + "/" + fname + "-xy_" + str(lap) + ".h5"
xz_file = outdir + "/" + fname + "-xz_" + str(lap) + ".h5"
yz_file = outdir + "/" + fname + "-yz_" + str(lap) + ".h5"
f5_xy = h5.File(xy_file, "r")
f5_xz = h5.File(xz_file, "r")
f5_yz = h5.File(yz_file, "r")
data_xy = pytools.read_h5_array(f5_xy, var)
data_xz = pytools.read_h5_array(f5_xz, var)
data_yz = pytools.read_h5_array(f5_yz, var)
nx,ny,ns0 = np.shape(data_xy)
print(nx,ny,ns0)
nx,nz,ns1 = np.shape(data_xz)
print(nx,nz,ns1)
ny,nz,ns2 = np.shape(data_yz)
print(ny,nz,ns2)
# full data
#data = np.zeros((nx,ny,nz))
#xy
#data[:,:,0 ] = data_xy[:,:,0]
#data[:,:,-1] = data_xy[:,:,0]
print(conf.outdir)
fname_fld = "flds"
fname_prtcls = "test-prtcls"
#args.lap
lap = 1000
box_offset = 0
for lap in [100, 1000, 2000]:
fields_file = conf.outdir + '/'+fname_fld+'_'+str(lap)+'.h5'
f5 = h5.File(fields_file,'r')
data = pytools.read_h5_array(f5, 'jz')
#cut reflector out
data = data[6:,:,:]
#limit box length
xlen = 512
if lap <= 100:
xlen = 128
elif lap <= 1000:
xlen = 256+64
#data = data[0:256,:,:]
#data = data[0:512,:,:]
data = data[0:xlen,:,:]
print(np.shape(data))
def read_full_box(outdir, fname_fld, var, lap):
fields_file = outdir + "/" + fname_fld + "_" + str(lap) + ".h5"
f5 = h5.File(fields_file, "r")
return pytools.read_h5_array(f5, var)
def build_bdens(f5F):
bx = read_h5_array(f5F, "bx")
by = read_h5_array(f5F, "by")
bz = read_h5_array(f5F, "bz")
return bx*bx + by*by + bz*bz
def build_gamma(f5F):
vx = read_h5_array(f5F, "Vxp")
vy = read_h5_array(f5F, "Vyp")
vz = read_h5_array(f5F, "Vzp")
gam = 1.0/np.sqrt(1.0 - vx**2 + vy**2 + vz**2)
return gam
def read_periphery(outdir, fname, var, lap):
#fields_file = conf.outdir + "/" + fname_fld + "_" + str(lap) + ".h5"
fname = "slices" #overwrite
xy_file = outdir + "/" + fname + "-xy_" + str(lap) + ".h5"
xz_file = outdir + "/" + fname + "-xz_" + str(lap) + ".h5"
yz_file = outdir + "/" + fname + "-yz_" + str(lap) + ".h5"
f5_xy = h5.File(xy_file, "r")
f5_xz = h5.File(xz_file, "r")
f5_yz = h5.File(yz_file, "r")
data_xy = pytools.read_h5_array(f5_xy, var)
data_xz = pytools.read_h5_array(f5_xz, var)
data_yz = pytools.read_h5_array(f5_yz, var)
nx,ny,ns0 = np.shape(data_xy)
print(nx,ny,ns0)
nx,nz,ns1 = np.shape(data_xz)
print(nx,nz,ns1)
ny,nz,ns2 = np.shape(data_yz)
print(ny,nz,ns2)
# full data
#data = np.zeros((nx,ny,nz))
#xy
#data[:,:,0 ] = data_xy[:,:,0]
#data[:,:,-1] = data_xy[:,:,0]
def build_edens(f5F):
ex = read_h5_array(f5F, "ex")
ey = read_h5_array(f5F, "ey")
ez = read_h5_array(f5F, "ez")
return ex*ex + ey*ey + ez*ez
def build_bdens(f5F):
bx = read_h5_array(f5F, "bx")
by = read_h5_array(f5F, "by")
bz = read_h5_array(f5F, "bz")
return bx*bx + by*by + bz*bz