-
Notifications
You must be signed in to change notification settings - Fork 0
/
visualize_data.py
157 lines (118 loc) · 4.39 KB
/
visualize_data.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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from numpy import *
grid_data_file = 'grid_data.txt'
nr, ntheta, nphi, max_pd, max_real = np.genfromtxt(grid_data_file, unpack=True)
nr = int(nr)
ntheta = int(ntheta)
nphi = int(nphi)
num_data_file = 'data.txt'
X, Z, Psi_sq = np.genfromtxt(num_data_file, unpack=True)
num_data_file = 'data_real.txt'
X_r, Z_r, Psi_r = np.genfromtxt(num_data_file, unpack=True)
num_data_file = 'data_im.txt'
X_im, Z_im, Psi_im = np.genfromtxt(num_data_file, unpack=True)
num_data_file = 'data_real_phi_2.txt'
X_r_phi_2, Y_r_phi_2, Psi_r_phi_2 = np.genfromtxt(num_data_file, unpack=True)
num_data_file = 'data_im_phi_2.txt'
X_r_phi_2_im, Y_r_phi_2_im, Psi_r_phi_2_im = np.genfromtxt(num_data_file, unpack=True)
X_2d = np.zeros((nr, nphi))
Z_2d = np.zeros((nr, nphi))
Psi_sq_2d = np.zeros((nr, nphi))
X_2d_m = np.zeros((nr, nphi))
Z_2d_m = np.zeros((nr, nphi))
Psi_sq_2d_m = np.zeros((nr, nphi))
X_r_2d = np.zeros((nr, nphi))
Z_r_2d = np.zeros((nr, nphi))
Psi_r_2d = np.zeros((nr, nphi))
X_r_2d_m = np.zeros((nr, nphi))
Z_r_2d_m = np.zeros((nr, nphi))
Psi_r_2d_m = np.zeros((nr, nphi))
X_im_2d = np.zeros((nr, nphi))
Z_im_2d = np.zeros((nr, nphi))
Psi_im_2d = np.zeros((nr, nphi))
X_im_2d_m = np.zeros((nr, nphi))
Z_im_2d_m = np.zeros((nr, nphi))
Psi_im_2d_m = np.zeros((nr, nphi))
X_r_phi_2_2d = np.zeros((nr, ntheta))
Y_r_phi_2_2d = np.zeros((nr, ntheta))
Psi_r_phi_2_2d = np.zeros((nr, ntheta))
X_r_phi_2_2d_im = np.zeros((nr, ntheta))
Y_r_phi_2_2d_im = np.zeros((nr, ntheta))
Psi_r_phi_2_2d_im = np.zeros((nr, ntheta))
num = 0
for i in range(0, nr):
for j in range(0, nphi):
X_2d[i][j] = X[num]
Z_2d[i][j] = Z[num]
Psi_sq_2d[i][j] = Psi_sq[num]
X_r_2d[i][j] = X_r[num]
Z_r_2d[i][j] = Z_r[num]
Psi_r_2d[i][j] = Psi_r[num]
X_im_2d[i][j] = X_im[num]
Z_im_2d[i][j] = Z_im[num]
Psi_im_2d[i][j] = Psi_im[num]
num = num + 1
for i in range(0, nr):
for j in range(0, nphi):
X_2d_m[i][j] = X[num]
Z_2d_m[i][j] = Z[num]
Psi_sq_2d_m[i][j] = Psi_sq[num]
X_r_2d_m[i][j] = X_r[num]
Z_r_2d_m[i][j] = Z_r[num]
Psi_r_2d_m[i][j] = Psi_r[num]
X_im_2d_m[i][j] = X_im[num]
Z_im_2d_m[i][j] = Z_im[num]
Psi_im_2d_m[i][j] = Psi_im[num]
num = num + 1
X_t = np.zeros((2*nr, nphi))
Z_t = np.zeros((2*nr, nphi))
Psi_p = np.zeros((2*nr, nphi))
X_r_t = np.zeros((2*nr, nphi))
Z_r_t = np.zeros((2*nr, nphi))
Psi_r_t = np.zeros((2*nr, nphi))
X_im_t = np.zeros((2*nr, nphi))
Z_im_t = np.zeros((2*nr, nphi))
Psi_im_t = np.zeros((2*nr, nphi))
for i in range(0, nr):
for j in range(0, nphi):
X_t[i][j] = X_2d[i][j]
Z_t[i][j] = Z_2d[i][j]
Psi_p[i][j] = Psi_sq_2d[i][j]
X_r_t[i][j] = X_r_2d[i][j]
Z_r_t[i][j] = Z_r_2d[i][j]
Psi_r_t[i][j] = Psi_r_2d[i][j]
X_im_t[i][j] = X_im_2d[i][j]
Z_im_t[i][j] = Z_im_2d[i][j]
Psi_im_t[i][j] = Psi_im_2d[i][j]
for i in range(0, nr):
for j in range(0, nphi):
X_t[i+nr][j] = X_2d_m[i][j]
Z_t[i+nr][j] = Z_2d_m[i][j]
Psi_p[i+nr][j] = Psi_sq_2d_m[i][j]
X_r_t[i+nr][j] = X_r_2d_m[i][j]
Z_r_t[i+nr][j] = Z_r_2d_m[i][j]
Psi_r_t[i+nr][j] = Psi_r_2d_m[i][j]
X_im_t[i+nr][j] = X_im_2d_m[i][j]
Z_im_t[i+nr][j] = Z_im_2d_m[i][j]
Psi_im_t[i+nr][j] = Psi_im_2d_m[i][j]
num = 0
for i in range(0, nr):
for j in range(0, ntheta):
X_r_phi_2_2d[i][j] = X_r_phi_2[num]
Y_r_phi_2_2d[i][j] = Y_r_phi_2[num]
Psi_r_phi_2_2d[i][j] = Psi_r_phi_2[num]
X_r_phi_2_2d_im[i][j] = X_r_phi_2_im[num]
Y_r_phi_2_2d_im[i][j] = Y_r_phi_2_im[num]
Psi_r_phi_2_2d_im[i][j] = Psi_r_phi_2_im[num]
num = num + 1
cont = plt.contourf(X_t, Z_t, Psi_p, linspace(0, max_pd, 300), cmap = 'RdBu')
#cont = plt.contourf(X_r_t, Z_r_t, Psi_r_t, linspace(-max_real, max_real, 300), cmap = 'RdBu')
#cont = plt.contourf(X_im_t, Z_im_t, Psi_im_t, linspace(-max_real, max_real, 300), cmap = 'RdBu')
#cont = plt.contourf(X_r_phi_2_2d, Y_r_phi_2_2d, Psi_r_phi_2_2d, linspace(-max_real, max_real, 300), cmap = 'RdBu')
#cont = plt.contourf(X_r_phi_2_2d_im, Y_r_phi_2_2d_im, Psi_r_phi_2_2d_im, linspace(-max_real, max_real, 300), cmap = 'RdBu')
plt.colorbar()
plt.xlabel("X")
plt.ylabel("Z")
plt.show()