Skip to content

Commit 95f1ab4

Browse files
author
v_anyuhe
committed
update
1 parent f4bfba1 commit 95f1ab4

File tree

8 files changed

+2891
-2339
lines changed

8 files changed

+2891
-2339
lines changed

experiments/draw_rabi.py

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
2+
import csv
3+
import matplotlib.pyplot as plt
4+
5+
data = {
6+
'duration': [],
7+
'0': [],
8+
'1': []
9+
}
10+
total_shots = 1000
11+
12+
13+
with open('rabi_data.csv') as f:
14+
reader = csv.DictReader(f)
15+
for row in reader:
16+
data['duration'].append(float(row['duration']))
17+
data['0'].append(int(row['count0'])/total_shots)
18+
data['1'].append(int(row['count1'])/total_shots)
19+
20+
21+
plt.figure(figsize=(10,6))
22+
plt.plot(data['duration'], data['0'], 'b-o', label='State |0>')
23+
plt.plot(data['duration'], data['1'], 'r--s', label='State |1>')
24+
25+
26+
plt.title('Rabi Oscillation Experiment')
27+
plt.xlabel('Duration (dt)')
28+
plt.ylabel('Probability')
29+
plt.grid(alpha=0.3)
30+
plt.legend()
31+
plt.tight_layout()
32+
33+
34+
plt.savefig('rabi.png', dpi=300)
35+
plt.show()

0 commit comments

Comments
 (0)