analog#

Utilty classes for Qblox analog modules.

Module Contents#

Classes#

AnalogSequencerCompiler

Class that performs the compilation steps on the sequencer level, for QCM and

AnalogModuleCompiler

Base class for QCM and QRM-type modules.

BasebandModuleCompiler

Abstract class with all the shared functionality between the QRM and QCM baseband

RFModuleCompiler

Abstract class with all the shared functionality between the QRM-RF and QCM-RF

Attributes#

logger[source]#
class AnalogSequencerCompiler(parent: AnalogModuleCompiler, index: int, static_hw_properties: quantify_scheduler.backends.types.qblox.StaticAnalogModuleProperties, sequencer_cfg: quantify_scheduler.backends.qblox_backend._SequencerCompilationConfig)[source]#

Bases: quantify_scheduler.backends.qblox.compiler_abc.SequencerCompiler

Class that performs the compilation steps on the sequencer level, for QCM and QRM-type modules.

Parameters:
  • parent – A reference to the module compiler this sequencer belongs to.

  • index – Index of the sequencer.

  • static_hw_properties – The static properties of the hardware. This effectively gathers all the differences between the different modules.

  • sequencer_cfg – The instrument compiler config associated to this device.

static_hw_properties: quantify_scheduler.backends.types.qblox.StaticAnalogModuleProperties[source]#
_settings: quantify_scheduler.backends.types.qblox.AnalogSequencerSettings[source]#
associated_ext_lo[source]#
downconverter_freq[source]#
mix_lo[source]#
_marker_debug_mode_enable[source]#
_default_marker[source]#
property settings: quantify_scheduler.backends.types.qblox.AnalogSequencerSettings[source]#

Gives the current settings. Overridden from the parent class for type hinting.

Returns:

The settings set to this sequencer.

property frequency: float | None[source]#

The frequency used for modulation of the pulses.

Returns:

The frequency.

get_operation_strategy(operation_info: quantify_scheduler.backends.types.qblox.OpInfo) quantify_scheduler.backends.qblox.operation_handling.base.IOperationStrategy[source]#

Determines and instantiates the correct strategy object.

Parameters:
  • operation_info – The operation we are building the strategy for.

  • channel_name – Specifies the channel identifier of the hardware config (e.g. complex_output_0).

Returns:

The instantiated strategy object.

add_operation_strategy(op_strategy: quantify_scheduler.backends.qblox.operation_handling.base.IOperationStrategy) None[source]#

Adds the operation strategy to the sequencer compiler.

Parameters:

op_strategy – The operation strategy.

_prepare_acq_settings(acquisitions: list[quantify_scheduler.backends.qblox.operation_handling.base.IOperationStrategy], acq_metadata: quantify_scheduler.schedules.schedule.AcquisitionMetadata) None[source]#

Sets sequencer settings that are specific to certain acquisitions. For example for a TTL acquisition strategy.

Parameters:
  • acquisitions – List of the acquisitions assigned to this sequencer.

  • acq_metadata – Acquisition metadata.

_get_integration_length_from_acquisitions() int | None[source]#

Get the (validated) integration_length sequencer setting.

Get the duration of all SSB integration acquisitions assigned to this sequencer and validate that they are all the same.

prepare() None[source]#

Perform necessary operations on this sequencer’s data before compile() is called.

_update_set_clock_frequency_operations() None[source]#
_get_latency_correction_ns(latency_correction: float) int[source]#
static _assert_nco_operation_timing_on_grid(ordered_op_strategies: list[quantify_scheduler.backends.qblox.operation_handling.base.IOperationStrategy]) None[source]#

Check whether this sequencer’s operation adhere to NCO timing restrictions.

_assert_total_play_time_on_nco_grid() None[source]#

Raises an error if the total play time does not align with the NCO grid time.

Method is implemented on the base class instead of the AnalogSequencerCompiler subclass because it is called by generate_qasm_program.

_write_pre_wait_sync_instructions(qasm: quantify_scheduler.backends.qblox.qasm_program.QASMProgram) None[source]#

Write instructions to the QASM program that must come before the first wait_sync.

The duration must be equal for all module types.

_write_repetition_loop_header(qasm: quantify_scheduler.backends.qblox.qasm_program.QASMProgram) None[source]#

Write the Q1ASM that should appear at the start of the repetition loop.

The duration must be equal for all module types.

_insert_qasm(op_strategy: quantify_scheduler.backends.qblox.operation_handling.base.IOperationStrategy, qasm_program: quantify_scheduler.backends.qblox.qasm_program.QASMProgram) None[source]#

Get Q1ASM instruction(s) from op_strategy and insert them into qasm_program.

Optionally wrap pulses and acquisitions in marker pulses depending on the marker_debug_mode_enable setting.

_decide_markers(operation: quantify_scheduler.backends.qblox.operation_handling.base.IOperationStrategy) int[source]#

Helper method to decide what markers should be pulled high when enable_marker is set to True. Checks what module and operation are being processed, then builds a bit string accordingly.

Note that with the current quantify structure a sequencer cannot have connected inputs and outputs simultaneously. Therefore, the QRM baseband module pulls both input or output markers high when doing an operation, as it is impossible during compile time to find out what physical port is being used.

Parameters:

operation – The operation currently being processed by the sequence.

Returns:

A bit string passed on to the set_mrk function of the Q1ASM object.

class AnalogModuleCompiler(name: str, total_play_time: float, instrument_cfg: quantify_scheduler.backends.qblox_backend._ClusterModuleCompilationConfig)[source]#

Bases: quantify_scheduler.backends.qblox.compiler_abc.ClusterModuleCompiler, abc.ABC

Base class for QCM and QRM-type modules.

This class is defined as an abstract base class since the distinctions between the different devices are defined in subclasses. Effectively, this base class contains the functionality shared by all Qblox devices and serves to avoid repeated code between them.

Parameters:
  • name – Name of the QCoDeS instrument this compiler object corresponds to.

  • total_play_time – Total time execution of the schedule should go on for. This parameter is used to ensure that the different devices, potentially with different clock rates, can work in a synchronized way when performing multiple executions of the schedule.

  • instrument_cfg – The instrument compiler config referring to this device.

_settings: quantify_scheduler.backends.types.qblox.AnalogModuleSettings[source]#
sequencers: dict[str, AnalogSequencerCompiler][source]#
property static_hw_properties: quantify_scheduler.backends.types.qblox.StaticAnalogModuleProperties[source]#
Abstractmethod:

The static properties of the hardware. This effectively gathers all the differences between the different modules.

_construct_sequencer_compiler(index: int, sequencer_cfg: quantify_scheduler.backends.qblox_backend._SequencerCompilationConfig) AnalogSequencerCompiler[source]#

Create an instance of AnalogSequencerCompiler.

abstract assign_frequencies(sequencer: AnalogSequencerCompiler, external_lo: quantify_scheduler.backends.qblox.instrument_compilers.LocalOscillatorCompiler | None, clock_frequency: float) None[source]#

An abstract method that should be overridden. Meant to assign an IF frequency to each sequencer, and an LO frequency to each output (if applicable).

Parameters:
  • sequencer – Sequencer compiler object whose NCO frequency will be determined and set.

  • external_lo – Optional LO compiler object representing an external LO, whose LO frequency will be determined and set.

  • clock_frequency – Clock frequency of the clock assigned to the sequencer compiler.

abstract assign_attenuation() None[source]#

An abstract method that should be overridden. Meant to assign attenuation settings from the hardware configuration if there is any.

prepare(external_los: dict[str, quantify_scheduler.backends.qblox.instrument_compilers.LocalOscillatorCompiler] | None = None, schedule_resources: dict[str, quantify_scheduler.resources.Resource] | None = None, **kwargs) None[source]#

Performs the logic needed before being able to start the compilation. In effect, this means assigning the pulses and acquisitions to the sequencers and calculating the relevant frequencies in case an external local oscillator is used.

Parameters:
  • external_los – Optional LO compiler objects representing external LOs, whose LO frequency will be determined and set.

  • schedule_resources – Mapping from clock name to clock resource, which contains the clock frequency.

  • kwargs – Potential keyword arguments for other compiler classes.

_configure_input_gains() None[source]#

Configures input gain of module settings. Loops through all valid channel names and checks for gain values in hw config.

_configure_mixer_offsets() None[source]#

Configures offset of input, uses calc_from_units_volt found in helper file. Raises an exception if a value outside the accepted voltage range is given.

_configure_distortion_correction_latency_compensations(distortion_configs: dict[int, Any] | None = None) None[source]#
_configure_dc_latency_comp_for_output(output: int, dc_comp: int) None[source]#
_configure_dc_latency_comp_for_marker(output: int, dc_comp: int) None[source]#
_configure_hardware_distortion_corrections() None[source]#

Assign distortion corrections to settings of instrument compiler.

_ensure_single_scope_mode_acquisition_sequencer() None[source]#

Raises an error if multiple sequencers use scope mode acquisition, because that’s not supported by the hardware. Also, see _determine_scope_mode_acquisition_sequencer_and_qblox_acq_index() which also ensures the program that gets uploaded to the hardware satisfies this requirement.

Raises:

ValueError – Multiple sequencers have to perform trace acquisition. This is not supported by the hardware.

class BasebandModuleCompiler(name: str, total_play_time: float, instrument_cfg: quantify_scheduler.backends.qblox_backend._ClusterModuleCompilationConfig)[source]#

Bases: AnalogModuleCompiler

Abstract class with all the shared functionality between the QRM and QCM baseband modules.

_settings_type[source]#
_settings[source]#
assign_frequencies(sequencer: AnalogSequencerCompiler, external_lo: quantify_scheduler.backends.qblox.instrument_compilers.LocalOscillatorCompiler | None, clock_frequency: float) None[source]#

Determines LO/IF frequencies and assigns them, for baseband modules.

In case of no external local oscillator, the NCO is given the same frequency as the clock – unless NCO was permanently disabled via “interm_freq”: 0 in the hardware config.

In case of an external local oscillator and sequencer.mix_lo is False, the LO is given the same frequency as the clock (via helpers.determine_clock_lo_interm_freqs()).

Parameters:
  • sequencer – Sequencer compiler object whose NCO frequency will be determined and set.

  • external_lo – Optional LO compiler object representing an external LO, whose LO frequency will be determined and set.

  • clock_frequency – Clock frequency of the clock assigned to the sequencer compiler.

Raises:

ValueError – If the NCO and/or LO frequencies cannot be determined, are invalid, or are inconsistent with the clock frequency.

assign_attenuation() None[source]#

Meant to assign attenuation settings from the hardware configuration, if there is any. For baseband modules there is no attenuation parameters currently.

_configure_dc_latency_comp_for_marker(output: int, dc_comp: int) None[source]#
class RFModuleCompiler(name: str, total_play_time: float, instrument_cfg: quantify_scheduler.backends.qblox_backend._ClusterModuleCompilationConfig)[source]#

Bases: AnalogModuleCompiler

Abstract class with all the shared functionality between the QRM-RF and QCM-RF modules.

_settings: quantify_scheduler.backends.types.qblox.RFModuleSettings[source]#
assign_frequencies(sequencer: AnalogSequencerCompiler, external_lo: quantify_scheduler.backends.qblox.instrument_compilers.LocalOscillatorCompiler | None, clock_frequency: float) None[source]#

Determines LO/IF frequencies and assigns them for RF modules.

Parameters:
  • sequencer – Sequencer compiler object whose NCO frequency will be determined and set.

  • external_lo – Optional LO compiler object representing an external LO. Not used for RF modules, since they use the LO frequency in the module settings.

  • clock_frequency – Clock frequency of the clock assigned to the sequencer compiler.

Raises:

ValueError – If the NCO and/or LO frequencies cannot be determined, are invalid, or are inconsistent with the clock frequency.

static _get_connected_lo_indices(sequencer: AnalogSequencerCompiler) Iterator[int][source]#

Identify the LO the sequencer is outputting. Use the sequencer output to module output correspondence, and then use the fact that LOX is connected to module output X.

_get_lo_frequency(lo_idx: int) float | None[source]#

Get the LO frequency from the settings.

Parameters:

lo_idx (int) – The LO index.

Returns:

The frequency, or None if it has not been determined yet.

Return type:

float | None

Raises:

IndexError – If the derived class instance does not contain an LO with that index.

_set_lo_frequency(lo_idx: int, frequency: float) None[source]#

Set the LO frequency from the settings.

Parameters:
  • lo_idx (int) – The LO index.

  • frequency (float) – The frequency.

Raises:

IndexError – If the derived class instance does not contain an LO with that index.

assign_attenuation() None[source]#

Assigns attenuation settings from the hardware configuration.

Floats that are a multiple of 1 are converted to ints. This is needed because the quantify_core.measurement.control.grid_setpoints() converts setpoints to floats when using an attenuation as settable.

_configure_dc_latency_comp_for_marker(output: int, dc_comp: int) None[source]#