Schedule#

class iqm.pulse.playlist.schedule.Schedule(contents=None, *, duration=None)#

Bases: object

Set of synchronously executed AWG/readout programs that start on a single trigger.

Consists of a number of channels, each containing a Segment of Instruction s for a specific controller. For each channel, maps the channel name to its Segment of Instructions.

Mutable. To make an independent copy, use copy().

Parameters:
  • contents (Mapping[str, Iterable[Instruction]] | None) – mapping from channel name to a list of Instructions for that channel

  • duration (int | None) – Optional precomputed duration (in samples). In cases where the duration is known and performance is critical, the duration can be given in the constructor, allowing one to skip computing it.

Module: iqm.pulse.playlist.schedule

Attributes

duration

The maximum duration of the Schedule's channels, in samples.

Methods

add_channels

Add new empty channels to the schedule.

append

Append a single Instruction to a specific channel in the Schedule.

channels

The channels occupied in self.

cleanup

Cleans up the schedule by removing things that do not affect the execution.

copy

Make an independent copy of the schedule.

duration_in_seconds

Schedule duration in seconds, taking into account the sample rates of the channels.

extend

Append given Instruction to a specific channel in the Schedule.

front_pad

Modifies the schedule in place by front-padding it with Wait instructions.

front_pad_in_seconds

Modifies the schedule in place by front-padding it with Wait instructions.

has_content_in

Returns True if self has content in any of the given channels, otherwise False.

items

Iterator over the schedule channel names and segments.

pad_to_hard_box

Pad channels in self to the maximum channel length found within with Wait instructions.

pad_to_hard_box_in_seconds

Pad channels in self to the maximum channel length (seconds) found within with Wait instructions.

pprint

Fixed-width character graphics representation of the Schedule.

reverse

Copy of the schedule with the order of the instructions in each channel reversed.

reverse_hard_box

Copy of the schedule with the order of the instructions in each channel reversed.

validate

Validate the contents of the schedule.

property duration: int#

The maximum duration of the Schedule’s channels, in samples.

Computed only when needed and cached for performance.

duration_in_seconds(channel_properties)#

Schedule duration in seconds, taking into account the sample rates of the channels.

Parameters:

channel_properties (dict[str, ChannelProperties]) – channel properties.

Returns:

schedule duration (in seconds)

Return type:

float

pprint(time_unit=16)#

Fixed-width character graphics representation of the Schedule.

Assumes the Instruction.duration s are in samples.

Parameters:

time_unit (int) – unit of time represented by a single symbol (in samples)

Return type:

str

items()#

Iterator over the schedule channel names and segments.

channels()#

The channels occupied in self.

Return type:

KeysView

copy()#

Make an independent copy of the schedule.

Mutating the original must not affect the copy, or vice versa. Instructions are immutable, so they need not be copied.

Returns:

copy of the schedule

Return type:

Schedule

add_channels(channel_names)#

Add new empty channels to the schedule.

If a given channel (identified by its controller name) already exist in the schedule, it is unchanged.

Modifies self.

Parameters:

channel_names (Iterable[str]) – names of the controllers for which empty channels are added

Return type:

None

append(channel, instruction)#

Append a single Instruction to a specific channel in the Schedule.

Parameters:
  • channel (str) – name of the channel to append the instruction to

  • instruction (Instruction) – instruction to append

Return type:

None

extend(channel, instructions)#

Append given Instruction to a specific channel in the Schedule.

Parameters:
  • channel (str) – name of the channel to append the instructions to

  • instructions (Iterable[Instruction]) – instructions to append

Return type:

None

front_pad(to_duration)#

Modifies the schedule in place by front-padding it with Wait instructions.

NOTE: this method cannot be used when there are variable sampling rates present in the schedule. In that case, use the method front_pad_in_seconds.

Parameters:

to_duration (int) – duration of the resulting schedule, in samples

Returns:

self, with the padding

Return type:

Schedule

front_pad_in_seconds(to_duration, channel_properties)#

Modifies the schedule in place by front-padding it with Wait instructions.

The new duration is given in seconds, and this method works also with variable sample rates.

Parameters:
Returns:

self, with the padding

pad_to_hard_box()#

Pad channels in self to the maximum channel length found within with Wait instructions.

The Wait``s are appended to the end of the segments. NOTE: this method cannot be used when there are variable sampling rates present in the schedule. In that case, use the method ``pad_to_hard_box_in_seconds.

Return type:

None

pad_to_hard_box_in_seconds(channel_properties)#

Pad channels in self to the maximum channel length (seconds) found within with Wait instructions.

The Waits are appended to the end of the segments. The segment durations are compared in seconds, so this method works in the case of variable sampling rates as well. The padding is added to a channel only if the difference between the channel’s duration and the maximum duration is larger than the smallest possible instruction duration for that channel.

Parameters:

channel_properties (dict[str, ChannelProperties]) – channel properties (containing the sampling rates and granularities).

Return type:

None

reverse()#

Copy of the schedule with the order of the instructions in each channel reversed.

NOTE: this method cannot be used when there are variable sampling rates present in the schedule.

To preserve synchronization of the channels, the channels are first rear-padded with Nothing instructions.

Return type:

Schedule

reverse_hard_box()#

Copy of the schedule with the order of the instructions in each channel reversed.

No additional time-synchronisation logic is implemented, so this method will break the synchronisation if self is not a schedule with matching durations in all segments.

Return type:

Schedule

cleanup()#

Cleans up the schedule by removing things that do not affect the execution.

Removes

  • empty channels, and

  • channels that only have idling instructions.

Modifies self.

Return type:

Schedule

validate(path=())#

Validate the contents of the schedule.

Parameters:

path (tuple[str, ...]) –

Return type:

None

has_content_in(channel_names)#

Returns True if self has content in any of the given channels, otherwise False.

Parameters:

channel_names (Iterable[str]) –

Return type:

bool