78 lines
3.5 KiB
Plaintext
78 lines
3.5 KiB
Plaintext
---
|
||
title: align_measures (v0.31)
|
||
description: API reference for qiskit.pulse.transforms.align_measures in qiskit v0.31
|
||
in_page_toc_min_heading_level: 1
|
||
python_api_type: function
|
||
python_api_name: qiskit.pulse.transforms.align_measures
|
||
---
|
||
|
||
<span id="qiskit-pulse-transforms-align-measures" />
|
||
|
||
# qiskit.pulse.transforms.align\_measures
|
||
|
||
<Function id="qiskit.pulse.transforms.align_measures" isDedicatedPage={true} github="https://github.com/qiskit/qiskit/tree/stable/0.18/qiskit/pulse/transforms/canonicalization.py" signature="align_measures(schedules, inst_map=None, cal_gate='u3', max_calibration_duration=None, align_time=None, align_all=True)">
|
||
Return new schedules where measurements occur at the same physical time.
|
||
|
||
This transformation will align the first [`qiskit.pulse.Acquire`](qiskit.pulse.Acquire "qiskit.pulse.Acquire") on every channel to occur at the same time.
|
||
|
||
Minimum measurement wait time (to allow for calibration pulses) is enforced and may be set with `max_calibration_duration`.
|
||
|
||
By default only instructions containing a [`AcquireChannel`](qiskit.pulse.AcquireChannel "qiskit.pulse.AcquireChannel") or [`MeasureChannel`](qiskit.pulse.MeasureChannel "qiskit.pulse.MeasureChannel") will be shifted. If you wish to keep the relative timing of all instructions in the schedule set `align_all=True`.
|
||
|
||
This method assumes that `MeasureChannel(i)` and `AcquireChannel(i)` correspond to the same qubit and the acquire/play instructions should be shifted together on these channels.
|
||
|
||
```python
|
||
from qiskit import pulse
|
||
from qiskit.pulse import transforms
|
||
|
||
d0 = pulse.DriveChannel(0)
|
||
m0 = pulse.MeasureChannel(0)
|
||
a0 = pulse.AcquireChannel(0)
|
||
mem0 = pulse.MemorySlot(0)
|
||
|
||
sched = pulse.Schedule()
|
||
sched.append(pulse.Play(pulse.Constant(10, 0.5), d0), inplace=True)
|
||
sched.append(pulse.Play(pulse.Constant(10, 1.), m0).shift(sched.duration), inplace=True)
|
||
sched.append(pulse.Acquire(20, a0, mem0).shift(sched.duration), inplace=True)
|
||
|
||
sched_shifted = sched << 20
|
||
|
||
aligned_sched, aligned_sched_shifted = transforms.align_measures([sched, sched_shifted])
|
||
|
||
assert aligned_sched == aligned_sched_shifted
|
||
```
|
||
|
||
If it is desired to only shift acquisition and measurement stimulus instructions set the flag `align_all=False`:
|
||
|
||
```python
|
||
aligned_sched, aligned_sched_shifted = transforms.align_measures(
|
||
[sched, sched_shifted],
|
||
align_all=False,
|
||
)
|
||
|
||
assert aligned_sched != aligned_sched_shifted
|
||
```
|
||
|
||
**Parameters**
|
||
|
||
* **schedules** (`Iterable`\[`Union`\[`Schedule`, `Instruction`]]) – Collection of schedules to be aligned together
|
||
* **inst\_map** (`Optional`\[`InstructionScheduleMap`]) – Mapping of circuit operations to pulse schedules
|
||
* **cal\_gate** (`str`) – The name of the gate to inspect for the calibration time
|
||
* **max\_calibration\_duration** (`Optional`\[`int`]) – If provided, inst\_map and cal\_gate will be ignored
|
||
* **align\_time** (`Optional`\[`int`]) – If provided, this will be used as final align time.
|
||
* **align\_all** (`Optional`\[`bool`]) – Shift all instructions in the schedule such that they maintain their relative alignment with the shifted acquisition instruction. If `False` only the acquisition and measurement pulse instructions will be shifted.
|
||
|
||
**Return type**
|
||
|
||
`List`\[`Schedule`]
|
||
|
||
**Returns**
|
||
|
||
The input list of schedules transformed to have their measurements aligned.
|
||
|
||
**Raises**
|
||
|
||
[**PulseError**](qiskit.pulse.PulseError "qiskit.pulse.PulseError") – If the provided alignment time is negative.
|
||
</Function>
|
||
|