qiskit-documentation/docs/api/qiskit/0.31/qiskit.pulse.builder.align_...

57 lines
2.0 KiB
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
title: align_equispaced (v0.31)
description: API reference for qiskit.pulse.builder.align_equispaced in qiskit v0.31
in_page_toc_min_heading_level: 1
python_api_type: function
python_api_name: qiskit.pulse.builder.align_equispaced
---
<span id="qiskit-pulse-builder-align-equispaced" />
# qiskit.pulse.builder.align\_equispaced
<Function id="qiskit.pulse.builder.align_equispaced" isDedicatedPage={true} github="https://github.com/qiskit/qiskit/tree/stable/0.18/qiskit/pulse/builder.py" signature="align_equispaced(duration)">
Equispaced alignment pulse scheduling context.
Pulse instructions within this context are scheduled with the same interval spacing such that the total length of the context block is `duration`. If the total free `duration` cannot be evenly divided by the number of instructions within the context, the modulo is split and then prepended and appended to the returned schedule. Delay instructions are automatically inserted in between pulses.
This context is convenient to write a schedule for periodical dynamic decoupling or the Hahn echo sequence.
Examples:
```python
from qiskit import pulse
d0 = pulse.DriveChannel(0)
x90 = pulse.Gaussian(10, 0.1, 3)
x180 = pulse.Gaussian(10, 0.2, 3)
with pulse.build() as hahn_echo:
with pulse.align_equispaced(duration=100):
pulse.play(x90, d0)
pulse.play(x180, d0)
pulse.play(x90, d0)
hahn_echo.draw()
```
![../\_images/qiskit.pulse.builder.align\_equispaced\_0\_0.png](/images/api/qiskit/0.31/qiskit.pulse.builder.align_equispaced_0_0.png)
**Parameters**
**duration** (`Union`\[`int`, `ParameterExpression`]) Duration of this context. This should be larger than the schedule duration.
**Yields**
None
**Notes**
The scheduling is performed for sub-schedules within the context rather than channel-wise. If you want to apply the equispaced context for each channel, you should use the context independently for channels.
**Return type**
`AlignmentKind`
</Function>