qblox_backend#
Compiler backend for Qblox hardware.
Module Contents#
Classes#
Timing information for an Operation. |
|
Datastructure containing the information needed to compile to the Qblox backend. |
Functions#
Generate a dict referring to long square pulses to replace in the schedule. |
|
Replace any square pulses indicated by pulse_idx_map by a |
|
|
|
Compiles conditional playback. |
|
Replace square pulses in the schedule with long square pulses. |
|
|
Generate qblox hardware instructions for executing the schedule. |
|
Find all inner dictionaries representing a qblox instrument of the given type. |
Raise an error when pulses overlap, if at least one contains a voltage offset. |
|
Raise an error if any pulse operations overlap on the same port-clock. |
|
|
|
|
- _replace_long_square_pulses_recursively(operation: quantify_scheduler.operations.operation.Operation | quantify_scheduler.schedules.schedule.Schedule) quantify_scheduler.operations.operation.Operation | None [source]#
Generate a dict referring to long square pulses to replace in the schedule.
This function generates a mapping (dict) from the keys in the
operations()
dict to a list of indices, which refer to entries in the “pulse_info” list that describe a square pulse.- Parameters:
operation – An operation, possibly containing long square pulses.
- _replace_long_square_pulses(operation: quantify_scheduler.operations.operation.Operation, square_pulse_idx_to_replace: list[int]) quantify_scheduler.operations.operation.Operation | None [source]#
Replace any square pulses indicated by pulse_idx_map by a
long_square_pulse
.- Parameters:
operation – Operation to be replaced.
square_pulse_idx_to_replace – A list of indices in the pulse info to be replaced.
- Returns:
operation – The operation to be replaced. If returns
None
, the operation does not need to be replaced in the schedule or control flow.square_pulse_idx_to_replace – The pulse indices that need to be replaced in the operation.
- _all_conditional_acqs_and_control_flows_and_latch_reset(operation: quantify_scheduler.operations.operation.Operation | quantify_scheduler.schedules.schedule.Schedule, time_offset: float, accumulator: List[Tuple[float, quantify_scheduler.operations.operation.Operation]]) None [source]#
- class OperationTimingInfo[source]#
Timing information for an Operation.
- classmethod from_operation_and_schedulable(operation: quantify_scheduler.operations.operation.Operation, schedulable: quantify_scheduler.schedules.schedule.Schedulable) OperationTimingInfo [source]#
Create an
OperationTimingInfo
from an operation and a schedulable.
- overlaps_with(operation_timing_info: OperationTimingInfo) bool [source]#
Check if this operation timing info overlaps with another.
- _is_other_operation_overlaps_with_latch_reset(latch_reset_timing_info: OperationTimingInfo, operation: quantify_scheduler.operations.operation.Operation | quantify_scheduler.schedules.schedule.Schedule, time_offset: float, excluded_operation: quantify_scheduler.operations.operation.Operation) bool [source]#
- _set_trigger_address_and_insert_latch_reset(operation: quantify_scheduler.operations.operation.Operation | quantify_scheduler.schedules.schedule.Schedule, abs_time_relative_to_schedule: float, schedule: quantify_scheduler.schedules.schedule.Schedule, address_map: collections.defaultdict[str, int], used_port_clocks: list) None [source]#
- compile_conditional_playback(schedule: quantify_scheduler.schedules.schedule.Schedule, **_: Any) quantify_scheduler.schedules.schedule.Schedule [source]#
Compiles conditional playback.
This compiler pass will determine the mapping between trigger labels and trigger addresses that the hardware will use. The feedback trigger address is stored under the key
feedback_trigger_address
inpulse_info
and inacquisition_info
of the corresponding operation.A valid conditional playback consists of two parts: (1) a conditional acquisition or measure, and (2) a conditional control flow. The first should always be followed by the second, else an error is raised. A conditional acquisition sends a trigger after the acquisition ends and if the acquisition crosses a certain threshold. Each sequencer that is subscribed to this trigger will increase their latch counters by one. To ensure the latch counters contain either 0 or 1 trigger counts, a
LatchReset
operation is inserted right after the start of a conditional acquisition, on all sequencers. If this is not possible (e.g. due to concurring operations), aRuntimeError
is raised.- Parameters:
schedule – The schedule to compile.
- Returns:
The returned schedule is a reference to the original
schedule
, but updated.- Return type:
- Raises:
If a conditional acquisitions/measures is not followed by a conditional control flow.
If a conditional control flow is not preceded by a conditional acquisition/measure.
If the compilation pass is unable to insert
LatchReset
on all sequencers.
- compile_long_square_pulses_to_awg_offsets(schedule: quantify_scheduler.schedules.schedule.Schedule, **_: Any) quantify_scheduler.schedules.schedule.Schedule [source]#
Replace square pulses in the schedule with long square pulses.
Introspects operations in the schedule to find square pulses with a duration longer than
PULSE_STITCHING_DURATION
. Any of these square pulses are converted tolong_square_pulse()
, which consist of AWG voltage offsets.If any operations are to be replaced, a deepcopy will be made of the schedule, which is returned by this function. Otherwise the original unmodified schedule will be returned.
- Parameters:
schedule (Schedule) – A
Schedule
, possibly containing long square pulses.- Returns:
schedule – The schedule with square pulses longer than
PULSE_STITCHING_DURATION
replaced bylong_square_pulse()
. If no replacements were done, this is the original unmodified schedule.- Return type:
- hardware_compile(schedule: quantify_scheduler.schedules.schedule.Schedule, config: quantify_scheduler.backends.graph_compilation.CompilationConfig | dict[str, Any] | None = None, *, hardware_cfg: dict[str, Any] | None = None) quantify_scheduler.schedules.schedule.CompiledSchedule [source]#
Generate qblox hardware instructions for executing the schedule.
The principle behind the overall compilation is as follows:
For every instrument in the hardware configuration, we instantiate a compiler object. Then we assign all the pulses/acquisitions that need to be played by that instrument to the compiler, which then compiles for each instrument individually.
This function then returns all the compiled programs bundled together in a dictionary with the QCoDeS name of the instrument as key.
- Parameters:
schedule – The schedule to compile. It is assumed the pulse and acquisition info is already added to the operation. Otherwise an exception is raised.
config – Compilation config for
QuantifyCompiler
.hardware_cfg – (deprecated) The hardware configuration of the setup. Pass a full compilation config instead using
config
argument.
- Returns:
The compiled schedule.
- Raises:
ValueError – When both
config
andhardware_cfg
are supplied.
- find_qblox_instruments(hardware_config: Dict[str, Any], instrument_type: str) Dict[str, Any] [source]#
Find all inner dictionaries representing a qblox instrument of the given type.
- class QbloxHardwareCompilationConfig(/, **data: Any)[source]#
Bases:
quantify_scheduler.backends.types.common.HardwareCompilationConfig
Datastructure containing the information needed to compile to the Qblox backend.
This information is structured in the same way as in the generic
HardwareCompilationConfig
, but contains fields for hardware-specific settings.- config_type: Type[QbloxHardwareCompilationConfig][source]#
A reference to the
HardwareCompilationConfig
DataStructure for the Qblox backend.
- hardware_description: Dict[str, quantify_scheduler.backends.types.qblox.QbloxHardwareDescription | quantify_scheduler.backends.types.common.HardwareDescription][source]#
Description of the instruments in the physical setup.
- hardware_options: quantify_scheduler.backends.types.qblox.QbloxHardwareOptions[source]#
Options that are used in compiling the instructions for the hardware, such as
LatencyCorrection
orSequencerOptions
.
- compilation_passes: List[quantify_scheduler.backends.graph_compilation.SimpleNodeConfig][source]#
The list of compilation nodes that should be called in succession to compile a schedule to instructions for the Qblox hardware.
- _validate_connectivity_channel_names() QbloxHardwareCompilationConfig [source]#
- classmethod from_old_style_hardware_config(data: Any) Any [source]#
Convert old style hardware config dict to new style before validation.
- _validate_connectivity_graph_structure() QbloxHardwareCompilationConfig [source]#
Validate connectivity graph structure.
- _extract_instrument_compiler_configs(portclocks_used: set[tuple]) Dict[str, quantify_scheduler.structure.model.DataStructure] [source]#
Extract an instrument compiler config for each instrument mentioned in
hardware_description
. Each instrument config has a similar structure thanQbloxHardwareCompilationConfig
, but contains only the settings related to their related instrument. Each config must contain at least one portclock referenced inportclocks_used
, otherwise the config is deleted.
- _all_abs_times_ops_with_voltage_offsets_pulses(operation: quantify_scheduler.operations.operation.Operation | quantify_scheduler.schedules.schedule.Schedule, time_offset: float, accumulator: List[Tuple[float, quantify_scheduler.operations.operation.Operation]]) None [source]#
- _add_clock_freqs_to_set_clock_frequency(schedule: quantify_scheduler.schedules.schedule.Schedule, operation: quantify_scheduler.operations.operation.Operation | quantify_scheduler.schedules.schedule.Schedule | None = None) None [source]#
- validate_non_overlapping_stitched_pulse(schedule: quantify_scheduler.schedules.schedule.Schedule, **_: Any) None [source]#
Raise an error when pulses overlap, if at least one contains a voltage offset.
Since voltage offsets are sometimes used to construct pulses (see e.g.
long_square_pulse()
), overlapping these with regular pulses in time on the same port-clock can lead to undefined behaviour.Note that for each schedulable, all pulse info entries with the same port and clock count as one pulse for that port and clock. This is because schedulables, starting before another schedulable has finished, could affect the waveforms or offsets in the remaining time of that other schedulable.
- Parameters:
schedule (Schedule) – A
Schedule
, possibly containing long square pulses.- Returns:
schedule – A
Schedule
, possibly containing long square pulses.- Return type:
- Raises:
RuntimeError – If the schedule contains overlapping pulses (containing voltage offsets) on the same port and clock.
- _exists_pulse_starting_before_current_end(abs_times_and_operations: list[Tuple[float, quantify_scheduler.operations.operation.Operation]], current_idx: int) Tuple[float, quantify_scheduler.operations.operation.Operation] | Literal[False] [source]#
- _raise_if_pulses_overlap_on_same_port_clock(abs_time_a: float, op_a: quantify_scheduler.operations.operation.Operation, abs_time_b: float, op_b: quantify_scheduler.operations.operation.Operation) None [source]#
Raise an error if any pulse operations overlap on the same port-clock.
A pulse here means a waveform or a voltage offset.
- _get_pulse_start_ends(abs_time: float, operation: quantify_scheduler.operations.operation.Operation) dict[str, tuple[float, float]] [source]#
- _operation_end(abs_time_and_operation: Tuple[float, quantify_scheduler.operations.operation.Operation]) float [source]#