qblox_scheduler.helpers.generate_acq_channels_data#
Helper functions to generate acq_indices.
Attributes#
A mapping from schedulables to an acquisition index. |
Classes#
The AcquisitionIndices stores data for the backend compiler |
|
Data to contain relevant information from LoopOperation. |
|
Data for each acquisition index dimension. |
|
Functions#
|
Evaluate coords even if there are variables in it. |
|
Evaluate coords even if there are variables in it. |
Generates the acquisition channel data, and updates acq_channel_data, |
|
|
|
Generates the acquisition channel data, and updates acq_channel_data, |
|
|
Adds mappings to acq_channels_data and schedulable_label_to_acq_index; |
Collects sets of acquisition channels in acq_channels_coords_keys. |
|
Generates an acquisition index dimension name for each acquisition channel. |
|
Generate acq_index for every schedulable, |
Module Contents#
- class AcquisitionIndices[source]#
The AcquisitionIndices stores data for the backend compiler for each acquisition schedulable: the acquisition indices, and it’s loop structure. For example, if you have a multi-dimensional with 2, 3 and 4 repetitions, and you average over the last nested level, loop_bin_modes=[APPEND, APPEND, AVERAGE], and number the indices if 2*3. The loop_bin_modes element can be None, if the node is inside a conditional operation.
- loop_bin_modes: list[qblox_scheduler.enums.BinMode][source]#
- SchedulableLabelToAcquisitionIndex[source]#
A mapping from schedulables to an acquisition index.
This mapping helps the backend to figure out which binned acquisition corresponds to which acquisition index. Note, it maps the full schedulable label to acquisition indices, Only defined for binned acquisitions, and backend independent.
For control flows, the None in the schedulable label refers to the body of the control flow. This is for future proofing, if control flows were extended to include maybe multiple suboperations.
- class LoopData[source]#
Data to contain relevant information from LoopOperation. repetitions is None if and only if it’s a conditional.
- _evaluate_coords_recursively(loops: list[LoopData], evaluated_coords: list[dict]) list[dict][source]#
Evaluate coords even if there are variables in it. The accumulator is stored in evaluated_coords, which is returned.
- _evaluate_coords(coords: dict, loops: list[LoopData]) list[dict][source]#
Evaluate coords even if there are variables in it.
- _get_loops_with_append_bin_mode_and_all_loop_bin_modes(coords: dict, loops: list[LoopData], append_all_loops: bool) tuple[list[LoopData], list[qblox_scheduler.enums.BinMode]][source]#
- class _AcqIndexDimData[source]#
Data for each acquisition index dimension. An acquisition index dimension can be shared between multiple acquisition channels. This dataclass makes sure that two coords which have the same coords will get the same acquisition index, otherwise they get unique acquisition indices.
For example a coords {“amp”: 0} and coords {“amp”: 1} will get two different acquisition index generated, because they share at least one coords key “amp”, but can be on different acquisition channels.
- _coords_to_acq_channels: collections.defaultdict[frozenset, set[collections.abc.Hashable]][source]#
- update_and_get_acq_index(acq_channel: collections.abc.Hashable, coords: dict) int[source]#
- _generate_acq_channels_data_binned_append(acq_channel_data: qblox_scheduler.schedules.schedule.AcquisitionChannelData, acq_channel: collections.abc.Hashable, schedulable_label_to_acq_index: SchedulableLabelToAcquisitionIndex, full_schedulable_label: FullSchedulableLabel, loops: list[LoopData], coords: dict, append_all_loops: bool, acq_index_dim_data: dict[str, _AcqIndexDimData]) None[source]#
Generates the acquisition channel data, and updates acq_channel_data, and updates schedulable_label_to_acq_index for average bin mode.
- _validate_trace_protocol(acq_channel: collections.abc.Hashable, acq_channels_data: qblox_scheduler.schedules.schedule.AcquisitionChannelsData, loops: list[LoopData]) None[source]#
- _generate_acq_channels_data_for_protocol(acq_info: dict, acq_channels_data: qblox_scheduler.schedules.schedule.AcquisitionChannelsData, schedulable_label_to_acq_index: SchedulableLabelToAcquisitionIndex, full_schedulable_label: FullSchedulableLabel, loops: list[LoopData], acq_index_dim_names: dict[collections.abc.Hashable, str], acq_index_dim_data: dict[str, _AcqIndexDimData]) None[source]#
Generates the acquisition channel data, and updates acq_channel_data, and updates schedulable_label_to_acq_index.
- _generate_acq_channels_data(operation: qblox_scheduler.schedules.schedule.TimeableScheduleBase | qblox_scheduler.operations.operation.Operation, acq_channels_data: qblox_scheduler.schedules.schedule.AcquisitionChannelsData, schedulable_label_to_acq_index: SchedulableLabelToAcquisitionIndex, full_schedulable_label: FullSchedulableLabel, loops: list[LoopData], acq_index_dim_names: dict[collections.abc.Hashable, str], acq_index_dim_data: dict[str, _AcqIndexDimData]) None[source]#
Adds mappings to acq_channels_data and schedulable_label_to_acq_index; these are the output arguments; the others are input arguments. It will also generate the acq_index.
- _get_acq_channels_coords_keys(operation: qblox_scheduler.schedules.schedule.TimeableScheduleBase | qblox_scheduler.operations.operation.Operation, acq_channels_coords_keys: list[_AcqChannelsCoordsKeys] | None = None) list[_AcqChannelsCoordsKeys][source]#
Collects sets of acquisition channels in acq_channels_coords_keys. Two acquisition channels will be at the same index in acq_channels_coords_keys if and only if any acquisition within that acquisition channel share at least one coords key.
For example if two acquisitions on acq_channel=”ch0” and acq_channel=”ch1” have coords={“amp”: 0} and coords={“amp”: 1, “freq”: 2} respectively, then they share the same acq_channels_coords_key index, acq_channels_coords_key=[{“ch0”, “ch1”}, {“amp”, “freq”}]. A different operation with different acquisition channel will be a different element: acq_channels_coords_key=[{“ch0”, “ch1”}, {“amp”, “freq”}, {“ch2”, {“rep”}].
This function only applies to binned acquisitions.
- _generate_acq_index_dim_names(schedule: qblox_scheduler.schedules.schedule.TimeableScheduleBase) dict[collections.abc.Hashable, str][source]#
Generates an acquisition index dimension name for each acquisition channel. Two acquisition channels share the same acquisition index dimension name if and only if any acquisition within that acquisition channel share at least one coords key.
For example if three acquisitions on acq_channel=”ch0”, acq_channel=”ch1” and acq_channel=”ch2” have coords={“amp”: 0}, `coords={“amp”: 1, “freq”: 2} and coords={“rep”: 0} respectively, then the generated acquisition dimension index names are “acq_index_ch0_ch1” (for “ch0” and “ch1”), and “acq_index_ch2” (for “ch2”).
This function only applies to binned acquisitions.
- generate_acq_channels_data(schedule: qblox_scheduler.schedules.schedule.TimeableScheduleBase) tuple[qblox_scheduler.schedules.schedule.AcquisitionChannelsData, SchedulableLabelToAcquisitionIndex][source]#
Generate acq_index for every schedulable, and validate schedule regarding the acquisitions.
This function generates the
AcquisitionChannelDatafor everyacq_channel, and theSchedulableLabelToAcquisitionIndex. It assumes the schedule is device-level.