Schedule¶
-
class
Schedule
(*schedules, name=None, metadata=None)[source]¶ Bases:
object
A quantum program schedule with exact time constraints for its instructions, operating over all input signal channels and supporting special syntaxes for building.
Pulse program representation for the original Qiskit Pulse model [1]. Instructions are not allowed to overlap in time on the same channel. This overlap constraint is immediately evaluated when a new instruction is added to the
Schedule
object.It is necessary to specify the absolute start time and duration for each instruction so as to deterministically fix its execution time.
The
Schedule
program supports some syntax sugar for easier programming.Appending an instruction to the end of a channel
sched = Schedule() sched += Play(Gaussian(160, 0.1, 40), DriveChannel(0))
Appending an instruction shifted in time by a given amount
sched = Schedule() sched += Play(Gaussian(160, 0.1, 40), DriveChannel(0)) << 30
Merge two schedules
sched1 = Schedule() sched1 += Play(Gaussian(160, 0.1, 40), DriveChannel(0)) sched2 = Schedule() sched2 += Play(Gaussian(160, 0.1, 40), DriveChannel(1)) sched2 = sched1 | sched2
A
PulseError
is immediately raised when the overlap constraint is violated.In the schedule representation, we cannot parametrize the duration of instructions. Thus we need to create a new schedule object for each duration. To parametrize an instruction’s duration, the
ScheduleBlock
representation may be used instead.References
[1]: https://arxiv.org/abs/2004.06755
Create an empty schedule.
- Parameters
*schedules – Child Schedules of this parent Schedule. May either be passed as the list of schedules, or a list of
(start_time, schedule)
pairs.name (
Optional
[str
]) – Name of this schedule. Defaults to an autogenerated string if not provided.metadata (
Optional
[dict
]) – Arbitrary key value metadata to associate with the schedule. This gets stored as free-form data in a dict in themetadata
attribute. It will not be directly used in the schedule.
- Raises
TypeError – if metadata is not a dict.
Methods
Return a new schedule with
schedule
inserted at the maximum time over all channels shared betweenself
andschedule
.Assign the parameters in this schedule according to the input.
Return the time of the end of the last instruction over the supplied channels.
Return the time of the start of the first instruction over the supplied channels.
Return maximum start time over supplied channels.
Plot the schedule.
Return a
Schedule
with 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
Schedule
with only the instructions from thisSchedule
which pass though the provided filters; i.e. an instruction will be retained iff every function infilter_funcs
returnsTrue
, the instruction occurs on a channel type contained inchannels
, the instruction type is contained ininstruction_types
, and the period over which the instruction operates is fully contained in one specified intime_ranges
orintervals
.Deprecated.
Get parameter object bound to this schedule by string name.
Create new schedule object with metadata of another schedule object.
Return a new schedule with
schedule
inserted intoself
atstart_time
.Return True iff the instruction is parameterized.
Return a
Schedule
with theold
instruction replaced with anew
instruction.Return a schedule shifted forward by
time
.Attributes
-
channels
¶ Returns channels that this schedule uses.
- Return type
Tuple
[Channel
]
-
children
¶ Return the child schedule components of this
Schedule
in the order they were added to the schedule.Notes
Nested schedules are returned as-is. If you want to collect only instructions, use py:meth:~Schedule.instructions instead.
- Return type
Tuple
[Tuple
[int
,Union
[Schedule
,Instruction
]], …]- Returns
A tuple, where each element is a two-tuple containing the initial scheduled time of each
NamedValue
and the component itself.
-
duration
¶ Duration of this schedule.
- Return type
int
-
instances_counter
= count(0)¶
-
instructions
¶ Get the time-ordered instructions from self.
- Return type
Tuple
[Tuple
[int
,Instruction
]]
-
metadata
¶ The user provided metadata associated with the schedule.
User provided
dict
of 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.- Return type
Dict
[str
,Any
]
-
name
¶ Name of this Schedule
- Return type
str
-
parameters
¶ Parameters which determine the schedule behavior.
- Return type
Set
-
prefix
= 'sched'¶
-
start_time
¶ Starting time of this schedule.
- Return type
int
-
stop_time
¶ Stopping time of this schedule.
- Return type
int
-
timeslots
¶ Time keeping attribute.
- Return type
Dict
[Channel
,List
[Tuple
[int
,int
]]]