- class ScheduleBlock(name=None, metadata=None, alignment_context=None)¶
ScheduleBlockis a time-ordered sequence of instructions and transform macro to manage their relative timing. The relative position of the instructions is managed by the
alignment_context. This allows
ScheduleBlockto support instructions with a parametric duration and allows the lazy scheduling of instructions, i.e. allocating the instruction time just before execution.
ScheduleBlocks should be initialized with one of the following alignment contexts:
AlignLeft: Align instructions in the as-soon-as-possible manner. Instructions are scheduled at the earliest possible time on the channel.
AlignRight: Align instructions in the as-late-as-possible manner. Instructions are scheduled at the latest possible time on the channel.
AlignSequential: Align instructions sequentially even though they are allocated in different channels.
AlignEquispaced: Align instructions with equal interval within a specified duration. Instructions on different channels are aligned sequentially.
AlignFunc: Align instructions with arbitrary position within the given duration. The position is specified by a callback function taking a pulse index
jand returning a fractional coordinate in [0, 1].
ScheduleBlockdefaults to the
AlignLeftalignment. The timing overlap constraint of instructions is not immediately evaluated, and thus we can assign a parameter object to the instruction duration. Instructions are implicitly scheduled at optimum time when the program is executed.
ScheduleBlockto build an experimental program, but
Scheduleis not supported. This should be added as a
Callinstruction. This conversion is automatically performed with the pulse builder.
ScheduleBlockrepresentation we can fully parametrize pulse waveforms. For example, Rabi schedule generator can be defined as
duration = Parameter('rabi_dur') amp = Parameter('rabi_amp') block = ScheduleBlock() rabi_pulse = pulse.Gaussian(duration=duration, amp=amp, sigma=duration/4) block += Play(rabi_pulse, pulse.DriveChannel(0)) block += Call(measure_schedule)
Note that such waveform cannot be appended to the
In the block representation, the interval between two instructions can be managed with the
Delayinstruction. Because the schedule block lacks an instruction start time
t0, we cannot
shiftthe target instruction. In addition, stored instructions are not interchangable because the schedule block is sensitive to the relative position of instructions. Apart from these differences, the block representation can provide compatible functionality with
Create an empty schedule block.
str]) – Name of this schedule. Defaults to an autogenerated string if not provided.
dict]) – Arbitrary key value metadata to associate with the schedule. This gets stored as free-form data in a dict in the
metadataattribute. It will not be directly used in the schedule.
alignment_context (AlignmentKind) –
AlignmentKindinstance that manages scheduling of instructions in this block.
TypeError – if metadata is not a dict.
Return a new schedule block with
blockappended to the context block.
Assign the parameters in this schedule according to the input.
Return the time of the end of the last instruction over the supplied channels.
Plot the schedule.
Schedulewith only the instructions from this Schedule failing at least one of the provided filters. This method is the complement of py:meth:~self.filter, so that::.
Return a new
Schedulewith only the instructions from this
ScheduleBlockwhich pass though the provided filters; i.e. an instruction will be retained iff every function in
True, the instruction occurs on a channel type contained in
channels, the instruction type is contained in
instruction_types, and the period over which the instruction operates is fully contained in one specified in
Get parameter object bound to this schedule by string name.
Create new schedule object with metadata of another schedule object.
Return True iff the instruction is parameterized.
Trueif all durations are assigned.
oldcomponent replaced with a
Return alignment instance that allocates block component to generate schedule.
Get the time-ordered instructions from self.
Duration of this schedule block.
- instances_counter = count(0)¶
The user provided metadata associated with the schedule.
dictof metadata for the schedule. The metadata contents do not affect the semantics of the program but are used to influence the execution of the schedule. It is expected to be passed between all transforms of the schedule and that providers will associate any schedule metadata with the results it returns from the execution of that schedule.
Name of this Schedule
Parameters which determine the schedule behavior.
- prefix = 'block'¶