qiskit/releasenotes/notes/0.22/add-schedule-block-referenc...

43 lines
1.9 KiB
YAML

---
features:
- |
:class:`.ScheduleBlock` has been updated so that it can manage unassigned subroutine,
in other words, to allow lazy calling of other programs.
For example, this enables the following workflow:
.. code-block:: python
from qiskit import pulse
with pulse.build() as prog:
pulse.reference("x", "q0")
with pulse.build() as xq0:
pulse.play(Gaussian(160, 0.1, 40), pulse.DriveChannel(0))
prog.assign_references({("x", "q0"): xq0})
Now a user can create ``prog`` without knowing actual implementation of
the reference ``("x", "q0")``, and assign it at a later time for execution.
This improves modularity of pulse programs, and thus one can easily write a template
pulse program relying on other calibrations.
To realize this feature, the new pulse instruction (compiler directive)
:class:`~qiskit.pulse.instructions.Reference` has been added.
This instruction is injected into the current builder scope when
the :func:`~qiskit.pulse.builder.reference` command is used.
All references defined in the current pulse program can be listed with
the :attr:`~qiskit.pulse.schedule.ScheduleBlock.references` property.
In addition, every reference is managed with a scope to ease parameter management.
:meth:`~.scoped_parameters` and :meth:`~.search_parameters` have been added to
:class:`~.ScheduleBlock`. See API documentation for more details.
upgrade:
- |
Behavior of the :func:`~qiskit.pulse.builder.call` pulse builder function has been upgraded.
When a :class:`.ScheduleBlock` instance is called by this method, it internally creates
a :class:`.Reference` in the current context, and immediately assigns the called program to
the reference. Thus, the :class:`.Call` instruction is no longer generated.
Along with this change, it is prohibited to call different blocks with the same ``name``
argument. Such operation will result in an error.