-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFDTD_image.py
107 lines (80 loc) · 2.21 KB
/
FDTD_image.py
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
import numpy as np
import matplotlib.pyplot as plt
import matplotlib as mpl
from mpl_toolkits.mplot3d import Axes3D
#Path
input_path1="/home/Changwan/Fortran/FDTD_1D_E.txt"
input_path2="/home/Changwan/Fortran/FDTD_1D_H.txt"
input_path3="/home/Changwan/Fortran/Source.txt"
input_path4="/home/Changwan/Fortran/FDTD_1D_E1.txt"
input_path5="/home/Changwan/Fortran/FDTD_1D_H1.txt"
#Laoding
#EM=np.genfromtxt(input_path,dtype=np.float)
E1=np.loadtxt(input_path1, usecols=0)
#E2=np.loadtxt(input_path1, usecols=1)
#E3=np.loadtxt(input_path1, usecols=2)
E11=np.loadtxt(input_path4, usecols=0)
M1=np.loadtxt(input_path2, usecols=0)
#M2=np.loadtxt(input_path2, usecols=1)
#M3=np.loadtxt(input_path2, usecols=2)
M11=np.loadtxt(input_path5, usecols=0)
"""
#=======================================
fig = plt.figure()
ax = fig.gca(projection='3d')
z1=E1
#z2=E2
#z3=E3
z11=E11
y1=M1
#y2=M2
#y3=M3
y11=M11
x=np.arange(len(y1))
w=np.zeros(len(y1))
#ax.plot(x,w,z1,'r',label='E_z_field')
#ax.plot(x[0:10000],w[0:10000],z1[0:10000],'r',label='E_z_field')
#ax.plot(x[18000:20000],w[18000:20000],z1[18000:20000],'r',label='E_z_field')
#ax.plot(x[18000:20000],y1[18000:20000],w[18000:20000],'b',label='H_y_field')
#ax.plot(x,w,z11,'g')
#ax.plot(x,y11,w,'g')
ax.grid()
ax.minorticks_on()
ax.tick_params(which="both", width=2)
ax.tick_params(which="major",length=7)
ax.tick_params(which="minor",length=4,color='r')
ax.legend()
#ax.set_xlabel("x [time]",fontsize=20)
#ax.set_zlabel("z [E_z]",fontsize=20)
#ax.set_ylabel("y [H_y]",fontsize=20)
#=====================================
"""
#"""
#====================================
S1=np.loadtxt(input_path3,usecols=0)
#ax.plot(x,w,S1,'g',label='Source')
plt.subplot(2,2,1)
plt.plot(S1,'b',label='Source')
plt.title("Source")
plt.grid()
plt.minorticks_on()
plt.subplot(2,2,2)
plt.plot(E1,'r',label='E_z_field')
plt.title("E_z_field")
plt.grid()
plt.minorticks_on()
plt.subplot(2,2,3)
plt.plot(E1[0:10000],'r',label='E_z_field')
plt.title("E_z_field [0:10000]")
plt.grid()
plt.minorticks_on()
plt.subplot(2,2,4)
plt.plot(E1[18000:20000],'r',label='E_z_field')
plt.title("E_z_field [18000:20000]")
plt.grid()
plt.minorticks_on()
#=====================================
#"""
#plt.grid()
#plt.plot(z,M,'b')
plt.show()