mirror of https://github.com/Qiskit/qiskit.git
29 lines
895 B
YAML
29 lines
895 B
YAML
---
|
|
features:
|
|
- |
|
|
Added a new pulse builder function, :func:`qiskit.pulse.macro`.
|
|
This enables normal Python functions to be decorated as macros.
|
|
This enables pulse builder functions to be used within the decorated
|
|
function. The builder macro can then be called from within a pulse
|
|
building context, enabling code reuse.
|
|
|
|
For Example:
|
|
|
|
.. code-block:: python
|
|
|
|
from qiskit import pulse
|
|
|
|
@pulse.macro
|
|
def measure(qubit: int):
|
|
pulse.play(pulse.GaussianSquare(16384, 256, 15872),
|
|
pulse.MeasureChannel(qubit))
|
|
mem_slot = pulse.MemorySlot(0)
|
|
pulse.acquire(16384, pulse.AcquireChannel(0), mem_slot)
|
|
return mem_slot
|
|
|
|
with pulse.build(backend=backend) as sched:
|
|
mem_slot = measure(0)
|
|
print(f"Qubit measured into {mem_slot}")
|
|
|
|
sched.draw()
|