You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
87 lines
2.4 KiB
Python
87 lines
2.4 KiB
Python
import numpy as np
|
|
import matplotlib.pyplot as plt
|
|
from matplotlib.colors import ListedColormap, LinearSegmentedColormap
|
|
|
|
|
|
def plotK_imshow(kk, pdir, logn, xlabel, minfact, maxfact):
|
|
kk = np.rot90(kk)
|
|
|
|
if logn == True:
|
|
# kk=np.log(kk)
|
|
vmin, vmax = minfact, maxfact
|
|
# print(vmax)
|
|
colormap = "viridis"
|
|
plt.imshow(kk, vmin=vmin, vmax=vmax) # ,cmap='binary'
|
|
else:
|
|
# colormap='binary'
|
|
plt.imshow(kk, cmap="binary") # ,cmap='binary'
|
|
|
|
plt.colorbar()
|
|
# cbar.set_label(xlabel)
|
|
plt.title(xlabel)
|
|
plt.tight_layout()
|
|
plt.savefig(pdir + ".png", dpi=1200)
|
|
plt.close()
|
|
|
|
return
|
|
|
|
|
|
def plot_hist(k, pdir, logn, xlabel, minfact, maxfact, llg):
|
|
|
|
if logn == True:
|
|
vmin, vmax = minfact, maxfact
|
|
# plt.hist(k.reshape(-1),bins=100,range=(vmin,vmax),histtype='step',normed=1,label=llg)#,range=(vmin,vmax))
|
|
plt.hist(
|
|
k.reshape(-1), bins=100, histtype="step", normed=1, label=llg
|
|
) # ,range=(vmin,vmax))
|
|
else:
|
|
plt.hist(k.reshape(-1))
|
|
plt.xlabel(xlabel)
|
|
plt.ylabel("Counts")
|
|
|
|
return
|
|
|
|
|
|
ps = np.linspace(0, 100, 50)
|
|
rdir = "./testlc8/"
|
|
rdir = "./lc0/"
|
|
plt.figure(1)
|
|
for j in range(1):
|
|
for i in range(0, 50, 1):
|
|
|
|
log = True
|
|
|
|
label = r"$\log_{10}(vx/<vx>)$"
|
|
|
|
folder = j * 50 + i
|
|
|
|
V = np.load(rdir + str(folder) + "/V.npy")[0][:, :, 0]
|
|
perco = np.load(
|
|
rdir + str(folder) + "/ConnectivityMetrics/1024.npy", allow_pickle=True
|
|
).item()["spanning"][0, 0, 0]
|
|
V = np.log10(np.abs(V)) # /np.mean(np.abs(V)))
|
|
leg = "p = " + str(ps[i])[:4] + "% (" + str(perco) + ")"
|
|
plot_hist(V, rdir + str(folder) + "/HisTabsV", log, label, -0.8, 0.5, leg)
|
|
plotK_imshow(V[512:1536, 512:1536], rdir + str(i) + "/V", log, label, -4, 1)
|
|
plt.legend(loc="upper left")
|
|
plt.savefig(rdir + str(folder) + "VelHistogramB.png")
|
|
plt.close()
|
|
"""
|
|
|
|
label=r'$\log_{10}(|v_x|/<|v_x|>)$'
|
|
V=np.load(rdir+str(i)+'/V.npy')[0][:,:,0]
|
|
V=np.log10(np.abs(V)/np.mean(np.abs(V)))
|
|
plot_hist(V,rdir+str(i)+'/HisTabsVx',log,label,-4,1.5)
|
|
plotK_imshow(V[1024:2048,512:1024],rdir+str(i)+'/Vx',log,label,0,2)
|
|
|
|
label=r'$\log_{10}(|v_y|/<|v_y|>)$'
|
|
V=np.load(rdir+str(i)+'/V.npy')[1][:,:,0]
|
|
V=np.log10(np.abs(V)/np.mean(np.abs(V)))
|
|
plot_hist(V,rdir+str(i)+'/HisTabsVy',log,label,-5,1.5)
|
|
plotK_imshow(V[1024:2048,512:1024],rdir+str(i)+'/Vy',log,label,0,1)
|
|
#plot_hist(k,rdir+'Res/'+resname,log)
|
|
|
|
|
|
|
|
"""
|