Skip to main contentIBM Quantum Documentation
This page is from an old version of Qiskit SDK and does not exist in the latest version. We recommend you migrate to the latest version. See the release notes for more information.

qiskit.pulse.transforms.align_measures

align_measures(schedules, inst_map=None, cal_gate='u3', max_calibration_duration=None, align_time=None, align_all=True)

GitHub

Return new schedules where measurements occur at the same physical time.

This transformation will align the first 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 or 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.

from qiskit import pulse
from qiskit.pulse import transforms
 
with pulse.build() as sched:
    with pulse.align_sequential():
        pulse.play(pulse.Constant(10, 0.5), pulse.DriveChannel(0))
        pulse.play(pulse.Constant(10, 1.), pulse.MeasureChannel(0))
        pulse.acquire(20, pulse.AcquireChannel(0), pulse.MemorySlot(0))
 
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 acqusition and measurement stimulus instructions set the flag align_all=False:

aligned_sched, aligned_sched_shifted = transforms.align_measures(
    [sched, sched_shifted],
    align_all=False,
)
 
assert aligned_sched != aligned_sched_shifted

Parameters

  • schedules (Iterable[ScheduleComponent]) – 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 acqusition instruction. If False only the acqusition 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 – If the provided alignment time is negative.

Was this page helpful?
Report a bug or request content on GitHub.