stack_pulses#

Pulse stacking algorithm for Qblox backend.

Module Contents#

Classes#

PulseInterval

Represents an interval of (possibly) overlapping pulses.

PulseParameters

Represents information about a specific pulse. Used for calculating intervals.

PortClock

Functions#

stack_pulses(→ quantify_scheduler.schedules.Schedule)

Processes a given schedule by identifying and stacking overlapping pulses.

_construct_pulses_by_port_clock(...)

Construct a dictionary of pulses by port and clock.

_construct_pulses_by_interval(→ list[PulseInterval])

Constructs a list of PulseInterval objects representing time intervals and active pulses.

_stack_pulses_by_interval(...)

_stack_arbitrary_pulses(→ None)

_stack_square_pulses(→ None)

_create_schedulable(→ None)

class PulseInterval[source]#

Represents an interval of (possibly) overlapping pulses.

start_time: float[source]#
end_time: float[source]#
pulse_keys: set[str][source]#
class PulseParameters[source]#

Represents information about a specific pulse. Used for calculating intervals.

time: float[source]#
is_end: bool[source]#
schedulable_key: str[source]#
class PortClock[source]#

Bases: tuple

port[source]#
clock[source]#
stack_pulses(schedule: quantify_scheduler.schedules.Schedule, config) quantify_scheduler.schedules.Schedule[source]#

Processes a given schedule by identifying and stacking overlapping pulses. The function first defines intervals of overlapping pulses and then stacks the pulses within these intervals.

Parameters:

schedule – The schedule containing the pulses to stack.

Returns:

The schedule with stacked pulses.

_construct_pulses_by_port_clock(schedule: quantify_scheduler.schedules.Schedule) collections.defaultdict[str, list[PulseParameters]][source]#

Construct a dictionary of pulses by port and clock.

_construct_pulses_by_interval(sorted_pulses: list[PulseParameters]) list[PulseInterval][source]#

Constructs a list of PulseInterval objects representing time intervals and active pulses.

Given a sorted list of PulseParameters objects, this function identifies distinct intervals where pulses are active. Each PulseInterval records the start time, end time, and the set of active pulses during that interval. Pulses are added to or removed from the set based on their is_end attribute, indicating whether the pulse is starting or ending at a given time.

Example Input/Output:#

If the input list has pulses with start and end times as:
[PulseParameters(time=1, schedulable_key=’A’, is_end=False),

PulseParameters(time=3, schedulable_key=’A’, is_end=True), PulseParameters(time=2, schedulable_key=’B’, is_end=False)]

The output will be:
[PulseInterval(start_time=1, end_time=2, active_pulses={‘A’}),

PulseInterval(start_time=2, end_time=3, active_pulses={‘A’, ‘B’})]

See https://softwareengineering.stackexchange.com/questions/363091 for algo.

_stack_pulses_by_interval(schedule: quantify_scheduler.schedules.Schedule, pulses_by_interval: list[PulseInterval]) quantify_scheduler.schedules.Schedule[source]#
_stack_arbitrary_pulses(interval: PulseInterval, schedule: quantify_scheduler.schedules.Schedule, old_schedulable_keys: set[str]) None[source]#
_stack_square_pulses(interval: PulseInterval, schedule: quantify_scheduler.schedules.Schedule, old_schedulable_keys: set[str]) None[source]#
_create_schedulable(schedule: quantify_scheduler.schedules.Schedule, start_time: float, pulse: quantify_scheduler.operations.Operation | quantify_scheduler.schedules.Schedule | None) None[source]#