1. 后处理Epoch结果:代码及图
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 | import sdf_helper as sh import numpy as np import matplotlib.pyplot as plt from matplotlib.ticker import MultipleLocator as ml from matplotlib.ticker import ScalarFormatter as sf import matplotlib.ticker as ticker import matplotlib.cm as cm dataname = './0005.sdf' i = 500 print ( type (i)) print (dataname) data = sh.getdata(dataname) sh.list_variables(data) y = np.linspace( - 20 , 20 , 400 ) x = np.linspace( - 20 , 20 , 400 ) z = np.linspace( - 40 , 40 , 800 ) # X,Y=np.meshgrid(x,y) Y,Z = np.meshgrid(z,y) Ex = ex[:,:,:] Ey = ey[:,:,:] Ez = ez[:,:,:] # fig, ax = plt.subplots() # q = ax.quiver(X, Y, Ex, Ey, color="C1") # #scale_units='xy', scale=5, width=.015 # ax.set_title(r"t=50 laser periods, x=20 $\lambda$") # ax.set_aspect(1.0) # ax.set(xlim=(-15, 15), ylim=(-15, 15)) # fig.savefig('t=3.png',dpi=1000) # plt.show() # # Plot 1 # vector figure of less points # sEx = np.zeros((40,40)) # sEy = np.zeros((40,40)) # for i in range(1,40): # for j in range(1,40): # sEx[i,j] = Ex[i*5*2,j*5*2] # sEy[i,j] = Ey[i*5*2,j*5*2] # fig, ax = plt.subplots() # q = ax.quiver(sEx, sEy, color="C1") # #scale_units='xy', scale=5, width=.015 # ax.set_title(r"E(x,y) at t=50 laser periods, z=20 $\lambda$") # ax.set_aspect(1.0) # ax.set_xlabel(r"$x [\lambda]$") # ax.set_ylabel(r"$y [\lambda]$") # fig.savefig('t=5small.png',dpi=1000) # plt.show() # # Plot 1 # Density distribution n = data.Derived_Number_Density n0 = 8.9285e27 * 0.01 fig, ax = plt.subplots() plt.pcolor(Y,Z,n.data[ 250 ,:,:] / n0,cmap = 'bwr' ) # # plt.colorbar(label="Plasma density", orientation="vertical") titlename = "t=" "%d" "T" % i ax.set_title(titlename) ax.set_xlabel(r "$x [\lambda]$" ) ax.set_ylabel(r "$y [\lambda]$" ) plt.colorbar() filename1 = 'density at x=x_center" "%d" ".png' % i fig.savefig(filename1) plt.show() # plot 2 # Laser intensity I = Ex * * 2 + Ey * * 2 fig,ax = plt.subplots() plt.pcolor(Y,Z,I[ 200 ,:,:],cmap = 'bwr' ) plt.colorbar() ax.set_xlabel(r "$y [\lambda]$" ) ax.set_ylabel(r "$z [\lambda]$" ) titlename = "t=" "%d" "T" % i ax.set_title(titlename) # plt.colorbar(label="Laser Intensity", orientation="vertical") filename2 = "laserIntensity-yz" "%d" ".png" % i fig.savefig(filename2) plt.show() |
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· 没有Manus邀请码?试试免邀请码的MGX或者开源的OpenManus吧
· 园子的第一款AI主题卫衣上架——"HELLO! HOW CAN I ASSIST YOU TODAY
· 【自荐】一款简洁、开源的在线白板工具 Drawnix