Pulse (qiskit.pulse
)¶
Qiskit-Pulse is a pulse-level quantum programming kit. This lower level of
programming offers the user more control than programming with
QuantumCircuit
s.
Extracting the greatest performance from quantum hardware requires real-time pulse-level instructions. Pulse answers that need: it enables the quantum physicist user to specify the exact time dynamics of an experiment. It is especially powerful for error mitigation techniques.
The input is given as arbitrary, time-ordered signals (see: Instructions (qiskit.pulse.instructions)) scheduled in parallel over multiple virtual hardware or simulator resources (see: Channels (qiskit.pulse.channels)). The system also allows the user to recover the time dynamics of the measured output.
This is sufficient to allow the quantum physicist to explore and correct for noise in a quantum system.
Instructions (qiskit.pulse.instructions
)¶
The |
|
|
The Acquire instruction is used to trigger the ADC associated with a particular qubit; e.g. |
|
Pulse |
|
A blocking instruction with no other effect. |
|
This instruction is responsible for applying a pulse on a channel. |
|
Set the channel frequency. |
|
Shift the channel frequency away from the current frequency. |
|
The set phase instruction sets the phase of the proceeding pulses on that channel to |
|
The shift phase instruction updates the modulation phase of proceeding pulses played on the same |
|
An instruction targeted for simulators, to capture a moment in the simulation. |
Pulse Library (waveforms qiskit.pulse.library
)¶
This library provides Pulse users with convenient methods to build Pulse waveforms. |
|
Module for builtin discrete pulses. |
|
|
A pulse specified completely by complex-valued samples; each sample is played for the duration of the backend cycle-time, dt. |
|
A simple constant pulse, with an amplitude value and a duration: |
|
The Derivative Removal by Adiabatic Gate (DRAG) pulse is a standard Gaussian pulse with an additional Gaussian derivative component. |
|
A truncated pulse envelope shaped according to the Gaussian function whose mean is centered at the center of the pulse (duration / 2): |
|
A square pulse with a Gaussian shaped risefall on both sides. Either risefall_sigma_ratio |
Channels (qiskit.pulse.channels
)¶
Pulse is meant to be agnostic to the underlying hardware implementation, while still allowing low-level control. Therefore, our signal channels are virtual hardware channels. The backend which executes our programs is responsible for mapping these virtual channels to the proper physical channel within the quantum control hardware.
Channels are characterized by their type and their index. See each channel type below to learn more.
This module defines Pulse Channels. |
|
|
Drive channels transmit signals to qubits which enact gate operations. |
|
Measure channels transmit measurement stimulus pulses for readout. |
|
Acquire channels are used to collect data. |
|
Control channels provide supplementary control over the qubit to the drive channel. |
|
Classical resister slot channels represent classical registers (low-latency classical memory). |
|
Memory slot channels represent classical memory storage. |
Schedules¶
Schedules are Pulse programs. They describe instruction sequences for the control hardware.
|
A quantum program schedule with exact time constraints for its instructions, operating over all input signal channels and supporting special syntaxes for building. |
|
A |
|
The smallest schedulable unit: a single instruction. |
Configuration¶
Mapping from |
Schedule Transforms (qiskit.pulse.transforms
)¶
Schedule transforms take Schedule
s as input and return modified
Schedule
s.
|
Return new schedules where measurements occur at the same physical time. |
|
Return a new schedule with implicit acquires from the measurement mapping replaced by explicit ones. |
|
Pad the input Schedule with |
Exceptions¶
|
Errors raised by the pulse module. |
Pulse Builder (builder
)¶
Warning
The pulse builder interface is still in active development. It may have breaking API changes without deprecation warnings in future releases until otherwise indicated.
The pulse builder provides an imperative API for writing pulse programs
with less difficulty than the Schedule
API.
It contextually constructs a pulse schedule and then emits the schedule for
execution. For example to play a series of pulses on channels is as simple as:
from qiskit import pulse
dc = pulse.DriveChannel
d0, d1, d2, d3, d4 = dc(0), dc(1), dc(2), dc(3), dc(4)
with pulse.build(name='pulse_programming_in') as pulse_prog:
pulse.play([1, 1, 1, 0, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 1, 0, 1, 1, 1], d0)
pulse.play([1, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0], d1)
pulse.play([1, 0, 1, 0, 0, 0, 1, 0, 0, 1, 1, 1, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0], d2)
pulse.play([1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0], d3)
pulse.play([1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 1, 0, 0, 1, 0], d4)
pulse_prog.draw()

In the future the pulse builder will be coupled to the
QuantumCircuit
with an equivalent circuit builder
interface.
|
Create a context manager for launching the imperative pulse builder DSL. |
Channels¶
Methods to return the correct channels for the respective qubit indices.
from qiskit import pulse
from qiskit.test.mock import FakeArmonk
backend = FakeArmonk()
with pulse.build(backend) as drive_sched:
d0 = pulse.drive_channel(0)
print(d0)
DriveChannel(0)
|
Return |
|
Return |
|
Return |
|
Return |
Instructions¶
Pulse instructions are available within the builder interface. Here’s an example:
from qiskit import pulse
from qiskit.test.mock import FakeArmonk
backend = FakeArmonk()
with pulse.build(backend) as drive_sched:
d0 = pulse.drive_channel(0)
a0 = pulse.acquire_channel(0)
pulse.play(pulse.library.Constant(10, 1.0), d0)
pulse.delay(20, d0)
pulse.shift_phase(3.14/2, d0)
pulse.set_phase(3.14, d0)
pulse.shift_frequency(1e7, d0)
pulse.set_frequency(5e9, d0)
with pulse.build() as temp_sched:
pulse.play(pulse.library.Gaussian(20, 1.0, 3.0), d0)
pulse.play(pulse.library.Gaussian(20, -1.0, 3.0), d0)
pulse.call(temp_sched)
pulse.acquire(30, a0, pulse.MemorySlot(0))
drive_sched.draw()

|
Acquire for a |
|
Barrier directive for a set of channels and qubits. |
|
Call the |
|
Delay on a |
|
Play a |
|
Set the |
|
Set the |
|
Shift the |
|
Shift the |
|
Simulator snapshot. |
Contexts¶
Builder aware contexts that modify the construction of a pulse program. For
example an alignment context like align_right()
may
be used to align all pulses as late as possible in a pulse program.
from qiskit import pulse
d0 = pulse.DriveChannel(0)
d1 = pulse.DriveChannel(1)
with pulse.build() as pulse_prog:
with pulse.align_right():
# this pulse will start at t=0
pulse.play(pulse.Constant(100, 1.0), d0)
# this pulse will start at t=80
pulse.play(pulse.Constant(20, 1.0), d1)
pulse_prog.draw()

|
Equispaced alignment pulse scheduling context. |
|
Callback defined alignment pulse scheduling context. |
Left alignment pulse scheduling context. |
|
Right alignment pulse scheduling context. |
|
Sequential alignment pulse scheduling context. |
|
|
Set the currently active circuit scheduler settings for this context. |
|
Shift the frequency of inputs channels on entry into context and undo on exit. |
|
Deprecated. |
|
Deprecated. |
|
Shift the phase of input channels on entry into context and undo on exit. |
|
Set the currently active transpiler settings for this context. |
Macros¶
Macros help you add more complex functionality to your pulse program.
from qiskit import pulse
from qiskit.test.mock import FakeArmonk
backend = FakeArmonk()
with pulse.build(backend) as measure_sched:
mem_slot = pulse.measure(0)
print(mem_slot)
MemorySlot(0)
|
Measure a qubit within the currently active builder context. |
Measure all qubits within the currently active builder context. |
|
|
Insert delays on all of the |
Circuit Gates¶
To use circuit level gates within your pulse program call a circuit
with qiskit.pulse.builder.call()
.
Warning
These will be removed in future versions with the release of a circuit builder interface in which it will be possible to calibrate a gate in terms of pulses and use that gate in a circuit.
import math
from qiskit import pulse
from qiskit.test.mock import FakeArmonk
backend = FakeArmonk()
with pulse.build(backend) as u3_sched:
pulse.u3(math.pi, 0, math.pi, 0)
|
Call a |
|
Call a |
|
Call a |
|
Call a |
|
Call a |
Utilities¶
The utility functions can be used to gather attributes about the backend and modify how the program is built.
from qiskit import pulse
from qiskit.test.mock import FakeArmonk
backend = FakeArmonk()
with pulse.build(backend) as u3_sched:
print('Number of qubits in backend: {}'.format(pulse.num_qubits()))
samples = 160
print('There are {} samples in {} seconds'.format(
samples, pulse.samples_to_seconds(160)))
seconds = 1e-6
print('There are {} seconds in {} samples.'.format(
seconds, pulse.seconds_to_samples(1e-6)))
Number of qubits in backend: 1
There are 160 samples in 3.5555555555555554e-08 seconds
There are 1e-06 seconds in 4500 samples.
Get the backend of the currently active builder context. |
|
Return the current active builder context’s transpiler settings. |
|
Return the current active builder context’s circuit scheduler settings. |
|
Return number of qubits in the currently active backend. |
|
|
Returns the set of channels associated with a qubit. |
|
Obtain the time in seconds that will elapse for the input number of samples on the active backend. |
|
Obtain the number of samples that will elapse in |