-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathVisualization.py
More file actions
65 lines (45 loc) · 1.79 KB
/
Visualization.py
File metadata and controls
65 lines (45 loc) · 1.79 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
from Utils import *
data_out = pd.read_csv('output/data_out.csv')
x = np.arange(len(data_out))
fig, (ax, ax1) = plt.subplots(1, 2, figsize=(10,3))
p0_avg = data_out.qAVG_sim
p0_ens = data_out.qEns_sim
p0_clas = data_out.cAVG
#ax = plt.subplot(221)
ax.plot(x, p0_ens, color='orange', label='qEnsemble', zorder=1, linewidth=5)
ax.plot(x, p0_avg, color='steelblue', label='qAVG')
ax.scatter(x, p0_clas, label='cEnsemble', color='sienna', zorder=2, linewidth=.5)
#ax.set_xlim(-1.1, 1.1)
# ax.set_ylim(-.2, 1.05)
ax.grid(alpha=0.3)
ax.set_xticks(np.round(np.arange(0, 21, 5), 1).tolist())
ax.set_xlabel('runs')
ax.set_ylabel(r'Prob. of state $0$ ($target$ qubit)')
ax.set_title('Quantum Simulator', size=12)
ax.tick_params(labelsize=10)
avg = data_out.qAVG_real
ens = data_out.qEns_real
clas = data_out.cAVG
#ax1 = plt.subplot(222)
ax1.plot(x, ens, color='orange', label='qEnsemble', zorder=1, linewidth=5)
ax1.plot(x, avg, color='steelblue', label='qAVG')
ax1.scatter(x, clas, label='cEnsemble', color='sienna', zorder=2, linewidth=.5)
#ax.set_xlim(-1.1, 1.1)
# ax.set_ylim(-.2, 1.05)
ax1.grid(alpha=0.3)
ax1.set_xticks(np.round(np.arange(0, 21, 5), 1).tolist())
ax1.set_title('Real Device', size=12)
ax1.tick_params(labelsize=10)
ax1.set_xlabel('runs')
# plt.legend(loc='lower center',# bbox_to_anchor=(0.5, -.15),
# ncol=3, fancybox=True, shadow=True, fontsize = 12)
# handles, labels = ax.get_legend_handles_labels()
# lgd=fig.legend(handles, labels, loc='lower center', ncol=3, bbox_to_anchor=(0.4, -.025))
plt.savefig('output/experiments.png', dpi = 300, bbox_inches='tight')
plt.show()
# plt.close()
fig = plt.figure(figsize=(6, 1))
handles, labels = ax.get_legend_handles_labels()
fig.legend(handles, labels, loc='center', ncol=3)
plt.savefig('output/legend.png', dpi=300, bbox_inches='tight')
plt.show()