Skip to content
This repository was archived by the owner on Aug 21, 2023. It is now read-only.

Commit d9bd0a7

Browse files
committed
IP
1 parent 1748699 commit d9bd0a7

1 file changed

Lines changed: 132 additions & 0 deletions

File tree

Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"metadata": {},
6+
"source": [
7+
"# Using the Scheduler"
8+
]
9+
},
10+
{
11+
"cell_type": "code",
12+
"execution_count": 2,
13+
"metadata": {},
14+
"outputs": [
15+
{
16+
"data": {
17+
"text/html": [
18+
"<pre style=\"word-wrap: normal;white-space: pre;background: #fff0;line-height: 1.1;font-family: &quot;Courier New&quot;,Courier,monospace\"> ┌───┐┌─┐\n",
19+
"q_0: |0>┤ H ├┤M├\n",
20+
" └───┘└╥┘\n",
21+
" c_0: 0 ══════╩═\n",
22+
" </pre>"
23+
],
24+
"text/plain": [
25+
"<qiskit.visualization.text.TextDrawing at 0x1044ebed0>"
26+
]
27+
},
28+
"execution_count": 2,
29+
"metadata": {},
30+
"output_type": "execute_result"
31+
}
32+
],
33+
"source": [
34+
"from qiskit import QuantumCircuit\n",
35+
"\n",
36+
"circ = QuantumCircuit(1, 1)\n",
37+
"# circ = QuantumCircuit(2, 2)\n",
38+
"circ.h(0)\n",
39+
"# circ.cx(0, 1)\n",
40+
"# circ.measure([0, 1], [0, 1])\n",
41+
"circ.measure([0], [0])\n",
42+
"\n",
43+
"circ.draw()"
44+
]
45+
},
46+
{
47+
"cell_type": "markdown",
48+
"metadata": {},
49+
"source": []
50+
},
51+
{
52+
"cell_type": "code",
53+
"execution_count": null,
54+
"metadata": {},
55+
"outputs": [],
56+
"source": [
57+
"from qiskit import IBMQ\n",
58+
"\n",
59+
"provider = IBMQ.load_account()\n",
60+
"backend = provider.get_backend(open_pulse=True)"
61+
]
62+
},
63+
{
64+
"cell_type": "markdown",
65+
"metadata": {},
66+
"source": []
67+
},
68+
{
69+
"cell_type": "code",
70+
"execution_count": null,
71+
"metadata": {},
72+
"outputs": [],
73+
"source": [
74+
"from qiskit.compiler import transpile, schedule as build_schedule\n",
75+
"\n",
76+
"schedule = build_schedule(transpile(circ, backend), backend)"
77+
]
78+
},
79+
{
80+
"cell_type": "markdown",
81+
"metadata": {},
82+
"source": []
83+
},
84+
{
85+
"cell_type": "code",
86+
"execution_count": null,
87+
"metadata": {},
88+
"outputs": [],
89+
"source": [
90+
"from qiskit.pulse import Gaussian, DriveChannel, Schedule\n",
91+
"custom_q0_h_schedule = Schedule(Gaussian(duration=128, amp=0.045, sigma=8)(DriveChannel(0)))\n",
92+
"\n",
93+
"inst_map = backend.defaults().instruction_schedule_map\n",
94+
"inst_map.add('h', 0, custom_q0_h_schedule)\n",
95+
"\n",
96+
"\n",
97+
"schedule = build_schedule(circ,\n",
98+
" backend,\n",
99+
" inst_map=inst_map)\n",
100+
"\n"
101+
]
102+
},
103+
{
104+
"cell_type": "code",
105+
"execution_count": null,
106+
"metadata": {},
107+
"outputs": [],
108+
"source": []
109+
}
110+
],
111+
"metadata": {
112+
"kernelspec": {
113+
"display_name": "Python 3",
114+
"language": "python",
115+
"name": "python3"
116+
},
117+
"language_info": {
118+
"codemirror_mode": {
119+
"name": "ipython",
120+
"version": 3
121+
},
122+
"file_extension": ".py",
123+
"mimetype": "text/x-python",
124+
"name": "python",
125+
"nbconvert_exporter": "python",
126+
"pygments_lexer": "ipython3",
127+
"version": "3.7.6"
128+
}
129+
},
130+
"nbformat": 4,
131+
"nbformat_minor": 2
132+
}

0 commit comments

Comments
 (0)