3.1.1. qupulse._program._loop

class qupulse._program._loop.Loop(parent=None, children=(), waveform=None, measurements=None, repetition_count=1)[source]

Bases: qupulse.utils.tree.Node

Initialize a new loop

Parameters
MAX_REPR_SIZE = 2000
__init__(parent=None, children=(), waveform=None, measurements=None, repetition_count=1)[source]

Initialize a new loop

Parameters
add_measurements(measurements)[source]

Add measurements offset by the current body duration i.e. to the END of the current loop

Parameters

measurements (Iterable[Tuple[str, Real, Real]]) – Measurements to add

append_child(loop=None, **kwargs)[source]

Append a child to this loop. Either an existing Loop object or a newly created from kwargs

Parameters
  • loop (Optional[Loop]) – loop to append

  • **kwargs – Child is constructed with these kwargs

Raises

ValueError – if called with loop and kwargs

Return type

None

property body_duration
Return type

TimeType

cleanup(actions=('remove_empty_loops', 'merge_single_child'))[source]

Apply the specified actions to cleanup the Loop.

remove_empty_loops: Remove loops with no children and no waveform (a DroppedMeasurementWarning is issued) merge_single_child: see _try_merge_single_child documentation

Warning

DroppedMeasurementWarning: Likely a bug in qupulse. TODO: investigate whether there are usecases

copy_tree_structure(new_parent=False)[source]
Return type

Loop

property duration
Return type

TimeType

encapsulate()[source]

Add a nesting level by moving self to its children.

Return type

None

flatten_and_balance(depth)[source]

Modifies the program so all tree branches have the same depth.

Parameters

depth (int) – Target depth of the program

Return type

None

get_duration_structure()[source]
Return type

Tuple[int, Union[TimeType, tuple]]

get_measurement_windows()[source]

Iterates over all children and collect the begin and length arrays of each measurement window.

Return type

Dict[str, Tuple[ndarray, ndarray]]

Returns

A dictionary (measurement_name -> (begin, length)) with begin and length being numpy.ndarray

property repetition_count
Return type

int

property repetition_definition
Return type

Union[int, VolatileRepetitionCount]

split_one_child(child_index=None)[source]

Take the last child that has a repetition count larger one, decrease it’s repetition count and insert a copy with repetition cout one after it

Return type

None

unroll()[source]
Return type

None

unroll_children()[source]
Return type

None

property volatile_repetition
Return type

Optional[VolatileProperty]

property waveform
Return type

Waveform

qupulse._program._loop.make_compatible(program, minimal_waveform_length, waveform_quantum, sample_rate)[source]

check program for compatibility to AWG requirements, make it compatible if necessary and possible

exception qupulse._program._loop.MakeCompatibleWarning[source]

Bases: ResourceWarning