qiskit/releasenotes/notes/0.16/pulse-gate-calibrations-78f...

57 lines
2.3 KiB
YAML

---
features:
- |
Support for pulse gates has been added to the
:class:`~qiskit.circuit.QuantumCircuit` class. This enables a
:class:`~qiskit.circuit.QuantumCircuit` to override (for basis gates) or
specify (for standard and custom gates) a definition of a
:class:`~qiskit.circuit.Gate` operation in terms of time-ordered signals
across hardware channels. In other words, it enables the option to provide
pulse-level custom gate calibrations.
The circuits are built exactly as before. For example::
from qiskit import pulse
from qiskit.circuit import QuantumCircuit, Gate
class RxGate(Gate):
def __init__(self, theta):
super().__init__('rxtheta', 1, [theta])
circ = QuantumCircuit(1)
circ.h(0)
circ.append(RxGate(3.14), [0])
Then, the calibration for the gate can be registered using the
:class:`~qiskit.circuit.QuantumCircuit` method
:meth:`~qiskit.circuit.QuantumCircuit.add_calibration` which takes a
:class:`~qiskit.pulse.Schedule` definition as well as the qubits and
parameters that it is defined for::
# Define the gate implementation as a schedule
with pulse.build() as custom_h_schedule:
pulse.play(pulse.library.Drag(...), pulse.DriveChannel(0))
with pulse.build() as q1_x180:
pulse.play(pulse.library.Gaussian(...), pulse.DriveChannel(1))
# Register the schedule to the gate
circ.add_calibration('h', [0], custom_h_schedule) # or gate.name string to register
circ.add_calibration(RxGate(3.14), [0], q1_x180) # Can accept gate
Previously, this functionality could only be used through complete Pulse
Schedules. Additionally, circuits can now be submitted to backends with
your custom definitions (dependent on backend support).
Circuits with pulse gates can still be lowered to a
:class:`~qiskit.pulse.Schedule` by using the
:func:`~qiskit.compiler.schedule` function.
The calibrated gate can also be transpiled using the regular transpilation
process::
transpiled_circuit = transpile(circ, backend)
The transpiled circuit will leave the calibrated gates on the same qubit as
the original circuit and will not unroll them to the basis gates.