- class qiskit.pulse.transforms.AlignFunc(duration, func)#
Allocate instructions at position specified by callback function.
The position is specified for each instruction of index
jas a fractional coordinate in [0, 1] within the specified duration.
Instructions played on different channels are also arranged in a sequence. This alignment is convenient to create dynamical decoupling sequences such as UDD.
For example, UDD sequence with 10 pulses can be specified with following function.
def udd10_pos(j): return np.sin(np.pi*j/(2*10 + 2))**2
This context cannot be QPY serialized because of the callable. If you use this context, your program cannot be saved in QPY format.
Create new equispaced context.
duration (int | ParameterExpression) – Duration of this context. This should be larger than the schedule duration. If the specified duration is shorter than the schedule duration, no alignment is performed and the input schedule is just returned. This duration can be parametrized.
func (Callable) – A function that takes an index of sub-schedule and returns the fractional coordinate of of that sub-schedule. The returned value should be defined within [0, 1]. The pulse index starts from 1.
Return context duration.
Return context alignment function.
Reallocate instructions according to the policy.
Only top-level sub-schedules are aligned. If sub-schedules are nested, nested schedules are not recursively aligned.
Returns dictionary to represent this alignment.
funcis not presented in this dictionary. Just name.
Deprecated since version 0.21: The method
qiskit.pulse.transforms.alignments.AlignFunc.to_dict()is deprecated as of qiskit-terra 0.21. It will be removed no earlier than 3 months after the release date.