|
18 | 18 | "source": [ |
19 | 19 | "# Building Pulse Schedules\n", |
20 | 20 | "\n", |
21 | | - "Building [`Schedule`](https://qiskit.org/documentation/api/qiskit.pulse.Schedule.html#qiskit.pulse.Schedule)s is very straightforward, yet there are a few ways to compose them. We're going to explore these different methods here.\n", |
| 21 | + "Building `Schedule`s is very straightforward, yet there are a few ways to compose them. We're going to explore these different methods here.\n", |
22 | 22 | "\n", |
23 | | - "Tip: [`Instruction`](https://qiskit.org/documentation/api/qiskit.pulse.Instruction.html#qiskit.pulse.Instruction)s can be treated just like [`Schedule`](https://qiskit.org/documentation/api/qiskit.pulse.Schedule.html#qiskit.pulse.Schedule)s -- that means all the methods we use here work equally well for composing [`Schedule`](https://qiskit.org/documentation/api/qiskit.pulse.Schedule.html#qiskit.pulse.Schedule)s with [`Schedule`](https://qiskit.org/documentation/api/qiskit.pulse.Schedule.html#qiskit.pulse.Schedule)s, [`Instruction`](https://qiskit.org/documentation/api/qiskit.pulse.Instruction.html#qiskit.pulse.Instruction)s with [`Instruction`](https://qiskit.org/documentation/api/qiskit.pulse.Instruction.html#qiskit.pulse.Instruction)s, or between the two.\n", |
| 23 | + "Tip: `Instruction`s can be treated just like `Schedule`s -- that means all the methods we use here work equally well for composing `Schedule`s with `Schedule`s, `Instruction`s with `Instruction`s, or between the two.\n", |
24 | 24 | "\n", |
25 | | - "As the basis for trying out the composition methods, let's initialize a couple dummy [`Schedule`](https://qiskit.org/documentation/api/qiskit.pulse.Schedule.html#qiskit.pulse.Schedule)s." |
| 25 | + "As the basis for trying out the composition methods, let's initialize a couple dummy `Schedule`s." |
26 | 26 | ] |
27 | 27 | }, |
28 | 28 | { |
|
41 | 41 | "cell_type": "markdown", |
42 | 42 | "metadata": {}, |
43 | 43 | "source": [ |
44 | | - "### [`insert`](https://qiskit.org/documentation/api/qiskit.pulse.Schedule.html#qiskit.pulse.Schedule.insert) or `|`\n", |
| 44 | + "### `insert` or `|`\n", |
45 | 45 | "\n", |
46 | | - "The [`insert`](https://qiskit.org/documentation/api/qiskit.pulse.Schedule.html#qiskit.pulse.Schedule.insert) method schedules an [`Instruction`](https://qiskit.org/documentation/api/qiskit.pulse.Instruction.html#qiskit.pulse.Instruction) or [`Schedule`](https://qiskit.org/documentation/api/qiskit.pulse.Schedule.html#qiskit.pulse.Schedule) at a particular time. Let's use it to give each of our schedules a different instruction.\n", |
| 46 | + "The `insert` method schedules an `Instruction` or `Schedule` at a particular time. Let's use it to give each of our schedules a different instruction.\n", |
47 | 47 | "\n", |
48 | | - "The insert schedule method overloads the `|` (or) operator for [`Schedule`](https://qiskit.org/documentation/api/qiskit.pulse.Schedule.html#qiskit.pulse.Schedule)s, so we will use this special syntax on schedule `B`. When using this syntactic sugar, the `time` argument is implicitly zero." |
| 48 | + "The insert schedule method overloads the `|` (or) operator for `Schedule`s, so we will use this special syntax on schedule `B`. When using this syntactic sugar, the `time` argument is implicitly zero." |
49 | 49 | ] |
50 | 50 | }, |
51 | 51 | { |
|
76 | 76 | "cell_type": "markdown", |
77 | 77 | "metadata": {}, |
78 | 78 | "source": [ |
79 | | - "### [`shift`](https://qiskit.org/documentation/api/qiskit.pulse.Schedule.html#qiskit.pulse.Schedule.shift) or `<<`\n", |
| 79 | + "### `shift` or `<<`\n", |
80 | 80 | "\n", |
81 | | - "Sometimes we need to offset one schedule from `time=0`. For instance, when using `|`, we use [`shift`](https://qiskit.org/documentation/api/qiskit.pulse.Schedule.html#qiskit.pulse.Schedule.shift) to add an instruction at a time besides zero." |
| 81 | + "Sometimes we need to offset one schedule from `time=0`. For instance, when using `|`, we use `shift` to add an instruction at a time besides zero." |
82 | 82 | ] |
83 | 83 | }, |
84 | 84 | { |
|
109 | 109 | "cell_type": "markdown", |
110 | 110 | "metadata": {}, |
111 | 111 | "source": [ |
112 | | - "Let's see how we can use [`insert`](https://qiskit.org/documentation/api/qiskit.pulse.Schedule.html#qiskit.pulse.Schedule.insert) to compose schedules `A` and `B` together." |
| 112 | + "Let's see how we can use `insert` to compose schedules `A` and `B` together." |
113 | 113 | ] |
114 | 114 | }, |
115 | 115 | { |
|
140 | 140 | "cell_type": "markdown", |
141 | 141 | "metadata": {}, |
142 | 142 | "source": [ |
143 | | - "### [`append`](https://qiskit.org/documentation/api/qiskit.pulse.Schedule.html#qiskit.pulse.Schedule.append) or `+`\n", |
| 143 | + "### `append` or `+`\n", |
144 | 144 | "\n", |
145 | | - "The [`append`](https://qiskit.org/documentation/api/qiskit.pulse.Schedule.html#qiskit.pulse.Schedule.append) method is like [`insert`](https://qiskit.org/documentation/api/qiskit.pulse.Schedule.html#qiskit.pulse.Schedule.insert), but the insertion time is determined for us. The [`Instruction`](https://qiskit.org/documentation/api/qiskit.pulse.Instruction.html#qiskit.pulse.Instruction) or [`Schedule`](https://qiskit.org/documentation/api/qiskit.pulse.Schedule.html#qiskit.pulse.Schedule) being added will begin when all the channels common to the two become free. If they contain no common channels, then the [`Schedule`](https://qiskit.org/documentation/api/qiskit.pulse.Schedule.html#qiskit.pulse.Schedule) will be appended at `time=0`. In psuedocode:\n", |
| 145 | + "The `append` method is like `insert`, but the insertion time is determined for us. The `Instruction` or `Schedule` being added will begin when all the channels common to the two become free. If they contain no common channels, then the `Schedule` will be appended at `time=0`. In psuedocode:\n", |
146 | 146 | "\n", |
147 | 147 | "```\n", |
148 | 148 | "time = 0\n", |
|
152 | 152 | "\n", |
153 | 153 | "The append schedule method overloads the `+` (add) operator for Schedules.\n", |
154 | 154 | "\n", |
155 | | - "Let's continue with schedule `A` and schedule `B`. Remember that they both have instructions scheduled on the same channel, [`DriveChannel`](https://qiskit.org/documentation/api/qiskit.pulse.DriveChannel.html)`(0)`. Schedule `A` contains positive amplitude pulses, and schedule `B` contains negative amplitude pulses." |
| 155 | + "Let's continue with schedule `A` and schedule `B`. Remember that they both have instructions scheduled on the same channel, `DriveChannel(0)`. Schedule `A` contains positive amplitude pulses, and schedule `B` contains negative amplitude pulses." |
156 | 156 | ] |
157 | 157 | }, |
158 | 158 | { |
|
184 | 184 | "source": [ |
185 | 185 | "Let's see what happens when there are no common channels.\n", |
186 | 186 | "\n", |
187 | | - "Warning: Common channels is not the same as common qubits. Measurements require different channels than gate operations, even on one qubit. If you simply append a measurement to a schedule, you'll likely schedule your measurement at `time=0`, not what you were expecting! Instead, use the shift operation, with [`schedule.duration`](https://qiskit.org/documentation/api/qiskit.pulse.Schedule.html#qiskit.pulse.Schedule.duration) as the time argument." |
| 187 | + "Warning: Common channels is not the same as common qubits. Measurements require different channels than gate operations, even on one qubit. If you simply append a measurement to a schedule, you'll likely schedule your measurement at `time=0`, not what you were expecting! Instead, use the shift operation, with `schedule.duration` as the time argument." |
188 | 188 | ] |
189 | 189 | }, |
190 | 190 | { |
|
216 | 216 | "source": [ |
217 | 217 | "This time, the new instruction being appended was added at `time=0`, because it did not have any instructions on `DriveChannel(0)`.\n", |
218 | 218 | "\n", |
219 | | - "Be wary: [`append`](https://qiskit.org/documentation/api/qiskit.pulse.Schedule.html#qiskit.pulse.Schedule.append) only \"slides\" the appended schedule into the original around channels that are not common between them. The following example demonstrates this point." |
| 219 | + "Be wary: `append` only \"slides\" the appended schedule into the original around channels that are not common between them. The following example demonstrates this point." |
220 | 220 | ] |
221 | 221 | }, |
222 | 222 | { |
|
0 commit comments