qblox_scheduler.backends.qblox.qblox_acq_index_manager#

Utility class for dynamically allocating Qblox acquisition indices and bins and for Qblox sequencers.

Attributes#

QbloxAcquisitionIndex

QbloxAcquisitionBinMapping

Binned type acquisition hardware mapping.

QbloxAcquisitionHardwareMappingNonFullyAppend

Type for all non-fully append type acquisition hardware mapping.

Exceptions#

AcquisitionMemoryError

Raised when there is an error in allocating acquisition memory.

Classes#

QbloxAcquisitionIndexBin

Qblox acquisition index and QBlox acquisition bin.

FullyAppendAcqInfo

Acquisition info for fully append acquisition.

AcqFullyAppendLoopNode

Node to represent all acquisitions which are within the same loop tree structure.

QbloxAcquisitionBinMappingFullyAppend

Binned type acquisition hardware mapping for acquisitions

QbloxAcquisitionHardwareMapping

Acquisition hardware mapping for all acquisitions.

_SequencerAcquisitionModel

QbloxAcquisitionIndexManager

Utility class that keeps track of all the reserved indices, bins for a sequencer.

Module Contents#

QbloxAcquisitionIndex[source]#
class QbloxAcquisitionIndexBin[source]#

Qblox acquisition index and QBlox acquisition bin.

index: QbloxAcquisitionIndex[source]#

Qblox acquisition index.

bin: int[source]#

Qblox acquisition bin. For average bin mode, this is the bin where the data is stored. For append bin mode, this is first bin where data is stored, for each loop and repetition cycle, the data is consecutively stored.

stride: int[source]#

Stride. Only used for acquisitions within a loop (not schedule repetitions). Defines what’s the stride between each repetitions of the schedule for the data.

The assumption is that for an append bin mode operation with loops and schedule repetitions there is only one register; the register’s inner iteration first goes through the loop, and then the schedule repetitions.

thresholded_trigger_count_metadata: qblox_scheduler.backends.types.common.ThresholdedTriggerCountMetadata | None[source]#

Thresholded trigger count metadata. Only applicable for ThresholdedTriggerCount, and only on QRM, QRM-RF, QRC. On QTM, this is unused, threshold calculations are on the hardware.

QbloxAcquisitionBinMapping[source]#

Binned type acquisition hardware mapping.

Each value maps the acquisition index to a hardware bin, which is specified by the Qblox acquisition index, and the Qblox acquisition bin.

QbloxAcquisitionHardwareMappingNonFullyAppend[source]#

Type for all non-fully append type acquisition hardware mapping.

This is a union of types, because the exact mapping type depends on the protocol.

class FullyAppendAcqInfo[source]#

Acquisition info for fully append acquisition.

acq_channel: collections.abc.Hashable[source]#
acq_index: qblox_scheduler.helpers.generate_acq_channels_data.AcquisitionIndices[source]#
thresholded_trigger_count_metadata: qblox_scheduler.backends.types.common.ThresholdedTriggerCountMetadata | None[source]#
class AcqFullyAppendLoopNode[source]#

Node to represent all acquisitions which are within the same loop tree structure.

parent: AcqFullyAppendLoopNode | None[source]#
children: list[AcqFullyAppendLoopNode | FullyAppendAcqInfo][source]#
repetitions: int | None[source]#
bin_mode: qblox_scheduler.enums.BinMode | None[source]#
add_control_flow_child(child_repetitions: int | None, bin_mode: qblox_scheduler.enums.BinMode | None) AcqFullyAppendLoopNode[source]#

Adds a new control flow as a child to the current node, and returns it.

return_control_flow_child() AcqFullyAppendLoopNode[source]#

Returns the parent, and if the current node is empty, it will remove it from the tree. Only call this function after any add_control_flow_child was called.

class QbloxAcquisitionBinMappingFullyAppend[source]#

Binned type acquisition hardware mapping for acquisitions that are fully appended for all loop levels.

qblox_acq_index: QbloxAcquisitionIndex[source]#
qblox_acq_bin_offset: int[source]#

The starting bin where all acquisition data is stored for this mapping.

tree: AcqFullyAppendLoopNode[source]#

Root node for the whole tree of the loop and acquisition tree.

class QbloxAcquisitionHardwareMapping[source]#

Acquisition hardware mapping for all acquisitions.

non_fully_append: dict[collections.abc.Hashable, QbloxAcquisitionHardwareMappingNonFullyAppend][source]#
fully_append: list[QbloxAcquisitionBinMappingFullyAppend][source]#
exception AcquisitionMemoryError[source]#

Bases: ValueError

Raised when there is an error in allocating acquisition memory.

class _SequencerAcquisitionModel(maximum_qblox_acq_indices: int = constants.NUMBER_OF_QBLOX_ACQ_INDICES, maximum_bins: int = constants.MAX_NUMBER_OF_BINS)[source]#
_num_bins: list[int] = [][source]#
_maximum_qblox_acq_indices = 32[source]#
_maximum_bins = 131072[source]#
property total_remaining_free_bins: int[source]#
reserve_new_qblox_acq_index(num_bins: int = 0) int[source]#
reserve_bins(qblox_acq_index: int, num_bins: int) None[source]#
next_free_bin_index(qblox_acq_index: int) int[source]#

The next free bin for this Qblox acquisition index. Equal to the total amount of reserved bins for this Qblox acquisition index.

to_acq_declaration_dict() dict[str, Any][source]#

Acquisition declaration dictionary.

This data is used in qblox_instruments.qcodes_drivers.Sequencer sequence parameter’s “acquisitions”.

class QbloxAcquisitionIndexManager[source]#

Utility class that keeps track of all the reserved indices, bins for a sequencer.

Each acquisition channel is mapped to a unique Qblox acquisition index. For binned acquisitions, each new allocation request reserves the Qblox acquisition bins in order (incrementing the bin index by one). For trace and ttl and other acquisitions, the whole Qblox acquisition index is reserved, there, the bin index has no relevance.

_acq_hardware_mapping_binned: dict[collections.abc.Hashable, QbloxAcquisitionBinMapping][source]#

Acquisition hardware mapping for binned acquisitions.

_acq_hardware_mapping_not_binned: dict[collections.abc.Hashable, QbloxAcquisitionIndex][source]#

Acquisition hardware mapping for not binned acquisitions.

_sequencer_acquisition_model[source]#

Data model of sequencer acquisition memory, which keeps track of the allocated amount of bins for each Qblox acquisition index.

_acq_channel_to_qblox_acq_index: dict[collections.abc.Hashable, int][source]#

Maps each acquisition channel to the Qblox acquisition index it uses.

_fully_append_qblox_acq_index: int | None = None[source]#

Qblox acquisition index used by the fully append mode acquisitions.

_trace_allocated: bool = False[source]#

Specifying whether a Trace or TimetagTrace have already been allocated.

_acq_hardware_mapping_fully_append: list[QbloxAcquisitionBinMappingFullyAppend] = [][source]#
_number_of_free_qblox_bins() int[source]#
_next_qblox_acq_index_with_all_free_bins() int[source]#
_reserve_qblox_acq_bins_fully_append(number_of_acq_indices: int, qblox_acq_index: int, tree: AcqFullyAppendLoopNode, repetitions: int) int[source]#
allocate_bins_fully_append(number_of_acq_indices: int, tree: AcqFullyAppendLoopNode, repetitions: int | None) tuple[int, int][source]#

Allocates Qblox acquisition bins for acquisitions which needs to be fully appended for all loop levels.

Parameters:
  • number_of_acq_indices – Number of acquisition indices to allocate.

  • tree – The loop tree structure for all of the acquisitions.

  • repetitions – Repetitions of the schedule when using append bin mode.

Returns:

The Qblox acquisition index, and the Qblox acquisition bin offset as integers.

Raises:

AcquisitionMemoryError – When the QbloxAcquisitionBinManager runs out of bins to allocate.

_reserve_qblox_acq_bins(number_of_acq_indices: int, qblox_acq_index: int, acq_channel: collections.abc.Hashable, acq_indices: list[int] | None, thresholded_trigger_count_metadata: qblox_scheduler.backends.types.common.ThresholdedTriggerCountMetadata | None, repetitions: int) int[source]#

Reserves the Qblox acquisition bin with the parameters. This function already assumes that the bin is free, not yet used.

Note, number_of_acq_indices must be equal to the length of acq_indices if not None.

Parameters:
  • number_of_acq_indices – Number of acquisition indices to reserve.

  • qblox_acq_index – Qblox acquisition index to be used.

  • acq_channel – Acquisition channel.

  • acq_indices – Acquisition index. If None, it has no corresponding acquisition index (for example Trace acquisition).

  • thresholded_trigger_count_metadata – Thresholded trigger count metadata. If not applicable, None.

  • repetitions – Repetitions of the schedule for append bin mode; otherwise 1.

Returns:

The starting Qblox acquisition bin.

allocate_bins(acq_channel: collections.abc.Hashable, acq_indices: list[int] | int, thresholded_trigger_count_metadata: qblox_scheduler.backends.types.common.ThresholdedTriggerCountMetadata | None, repetitions: int | None) tuple[int, int][source]#

Allocates len(acq_indices) number of Qblox acquisition bins.

Parameters:
  • acq_channel – Acquisition channel.

  • acq_indices – Acquisition index. If None, it has no corresponding acquisition index (for example Trace acquisition).

  • thresholded_trigger_count_metadata – Thresholded trigger count metadata. If not applicable, None.

  • repetitions – Repetitions of the schedule when using append bin mode.

Returns:

The Qblox acquisition index, and the Qblox acquisition bin offset as integers.

Raises:

AcquisitionMemoryError – When the QbloxAcquisitionBinManager runs out of bins to allocate.

allocate_qblox_index(acq_channel: collections.abc.Hashable) int[source]#

Allocates a whole Qblox acquisition index for ttl, other acquisition for the given acquisition channel.

Parameters:

acq_channel – Acquisition channel.

Returns:

The Qblox acquisition index.

Raises:

AcquisitionMemoryError – When the QbloxAcquisitionBinManager runs out of acquisition indices to allocate.

allocate_trace(acq_channel: collections.abc.Hashable) tuple[int, int][source]#

Allocates a whole Qblox acquisition index for trace for the given acquisition channel.

Parameters:

acq_channel – Acquisition channel.

Returns:

The Qblox acquisition index, and the Qblox acquisition bin offset as integers.

Raises:

AcquisitionMemoryError – When the QbloxAcquisitionBinManager runs out of acquisition indices to allocate.

allocate_timetagtrace(acq_channel: collections.abc.Hashable, acq_indices: list[int], repetitions: int) tuple[int, int][source]#

Allocates a whole Qblox acquisition index for TimetagTrace for the given acquisition channel.

Parameters:
  • acq_channel – Acquisition channel.

  • acq_indices – Acquisition index.

  • repetitions – Repetitions of the schedule.

Returns:

The Qblox acquisition index, and the Qblox acquisition bin offset as integers.

Raises:
acq_declaration_dict() dict[str, Any][source]#

Returns the acquisition declaration dict, which is needed for the qblox-instruments. This data is used in qblox_instruments.qcodes_drivers.Sequencer sequence parameter’s “acquisitions”.

Returns:

The acquisition declaration dict.

acq_hardware_mapping() QbloxAcquisitionHardwareMapping[source]#

Returns the acquisition hardware mapping, which is needed for qblox-scheduler instrument coordinator to figure out which hardware index, bin needs to be mapped to which output acquisition data.

Returns:

The acquisition hardware mapping.