-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplot_results.py
More file actions
120 lines (81 loc) · 3.4 KB
/
plot_results.py
File metadata and controls
120 lines (81 loc) · 3.4 KB
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
import matplotlib.pyplot as plt
import numpy as np
from os import listdir,chdir
print(listdir())
chdir('Tensor_Networks_topology')
print(listdir())
results = np.loadtxt('results.txt')
N,CHI,RES_tree,RES_mps,MEM_tree,MEM_mps = zip(*results)
chi_range = range(int(np.min(CHI)),int(np.max(CHI))+1,int(CHI[1]-CHI[0]))
N_gate_range = range(int(np.min(N)),int(np.max(N))+1,int(N[len(chi_range)]-N[0]))
# RES = np.array(RES).reshape(len(N),len(CHI))
N = np.array(N).reshape(len(N_gate_range),len(chi_range))
CHI = np.array(CHI).reshape(len(N_gate_range),len(chi_range))
RES_tree = np.array(RES_tree).reshape(len(N_gate_range),len(chi_range))
RES_mps = np.array(RES_mps).reshape(len(N_gate_range),len(chi_range))
MEM_tree = np.array(MEM_tree).reshape(len(N_gate_range),len(chi_range))
MEM_mps = np.array(MEM_mps).reshape(len(N_gate_range),len(chi_range))
RES_diff = np.subtract(RES_tree,RES_mps)
MEM_diff = np.subtract(MEM_tree,MEM_mps)
fig = plt.figure(figsize=(5,5))
elev = 40
azim = 135
rstride = 2
cstride = 2
# ---------------
ax1 = fig.add_subplot(231, projection='3d')
ax1.view_init(elev=elev, azim=azim)
ax1.plot_surface(CHI, N, RES_tree, alpha = 0.7,cmap='coolwarm')
ax1.plot_wireframe(CHI, N, RES_tree, rstride=rstride, cstride=cstride, color='black', linewidth=0.3)
# ax.contour(CHI, N, RES, zdir='x', offset=-15, cmap='coolwarm')
# ax.contour(CHI, N, RES, zdir='y', offset=500, cmap='coolwarm')
ax1.set_xlabel('Chi')
ax1.set_ylabel('N')
ax1.set_title('fidelity tree')
# ---------------
ax2 = fig.add_subplot(232, projection='3d')
ax2.view_init(elev=elev, azim=azim)
ax2.plot_surface(CHI, N, RES_mps, alpha = 0.7,cmap='coolwarm')
ax2.plot_wireframe(CHI, N, RES_mps, rstride=rstride, cstride=cstride, color='black', linewidth=0.3)
# ax.contour(CHI, N, RES, zdir='x', offset=-15, cmap='coolwarm')
# ax.contour(CHI, N, RES, zdir='y', offset=500, cmap='coolwarm')
ax2.set_xlabel('Chi')
ax2.set_ylabel('N')
ax2.set_title('fidelity mps')
# ---------------
ax3 = fig.add_subplot(233, projection='3d')
ax3.view_init(elev=elev, azim=azim)
ax3.plot_surface(CHI, N, RES_diff, alpha = 0.7,cmap='coolwarm')
ax3.plot_wireframe(CHI, N, RES_diff, rstride=rstride, cstride=cstride, color='black', linewidth=0.3)
# ax.contour(CHI, N, RES, zdir='x', offset=-15, cmap='coolwarm')
# ax.contour(CHI, N, RES, zdir='y', offset=500, cmap='coolwarm')
ax3.set_xlabel('Chi')
ax3.set_ylabel('N')
ax3.set_title('fidelity diff')
# ---------------
ax4 = fig.add_subplot(234, projection='3d')
ax4.view_init(elev=elev, azim=azim)
ax4.plot_surface(CHI,N ,MEM_tree ,alpha = 0.7,cmap='coolwarm')
ax4.plot_wireframe(CHI, N, MEM_tree, rstride=rstride, cstride=cstride, color='black', linewidth=0.3)
ax4.set_xlabel('Chi')
ax4.set_ylabel('N')
ax4.set_title('tree mem usage')
# ------------
ax5 = fig.add_subplot(235, projection='3d')
ax5.view_init(elev=elev, azim=azim)
ax5.plot_surface(CHI,N ,MEM_mps ,alpha = 0.7,cmap='coolwarm')
ax5.plot_wireframe(CHI, N, MEM_mps, rstride=rstride, cstride=cstride, color='black', linewidth=0.3)
ax5.set_xlabel('Chi')
ax5.set_ylabel('N')
ax5.set_title('mps mem usage')
# ------------
ax6 = fig.add_subplot(236, projection='3d')
ax6.view_init(elev=elev, azim=azim)
ax6.plot_surface(CHI,N ,MEM_diff ,alpha = 0.7,cmap='coolwarm')
ax6.plot_wireframe(CHI, N, MEM_diff, rstride=rstride, cstride=cstride, color='black', linewidth=0.3)
ax6.set_xlabel('Chi')
ax6.set_ylabel('N')
ax6.set_title('mps mem usage')
# -------
plt.tight_layout()
plt.show()