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]#
exception NcoOperationTimingError[source]#

Bases: ValueError

Exception thrown if there are timing errors for NCO operations.

class AnalogSequencerCompiler(parent: AnalogModuleCompiler, index: int, portclock: tuple[str, str], static_hw_properties: quantify_scheduler.backends.types.qblox.StaticAnalogModuleProperties, settings: quantify_scheduler.backends.types.qblox.AnalogSequencerSettings, latency_corrections: dict[str, float], distortion_corrections: dict[int, Any] | None = None, qasm_hook_func: Callable | None = None, lo_name: str | None = None, downconverter_freq: float | None = None, mix_lo: bool = True, marker_debug_mode_enable: bool = False)[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.

  • portclock – Tuple that specifies the unique port and clock combination for this sequencer. The first value is the port, second is the clock.

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

  • settings – The settings set to this sequencer.

  • latency_corrections – Dict containing the delays for each port-clock combination.

  • qasm_hook_func – Allows the user to inject custom Q1ASM code into the compilation, just prior to returning the final string.

  • lo_name – The name of the local oscillator instrument connected to the same output via an IQ mixer. This is used for frequency calculations.

  • downconverter_freq

    Warning

    Using downconverter_freq requires custom Qblox hardware, do not use otherwise.

    Frequency of the external downconverter if one is being used. Defaults to None, in which case the downconverter is inactive.

  • mix_lo – Boolean flag for IQ mixing with LO. Defaults to True meaning IQ mixing is applied.

  • marker_debug_mode_enable – Boolean flag to indicate if markers should be pulled high at the start of operations. Defaults to False, which means the markers will not be used during the sequence.

property frequency: float | None[source]#

The frequency used for modulation of the pulses.

Returns:

The frequency.

_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]#
static _replace_marker_pulses(op_strategies: list[quantify_scheduler.backends.qblox.operation_handling.base.IOperationStrategy]) list[quantify_scheduler.backends.qblox.operation_handling.base.IOperationStrategy][source]#

Replaces MarkerPulse operations by explicit high and low operations.

static _check_nco_operation_timing(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.

_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(parent: quantify_scheduler.backends.qblox.instrument_compilers.ClusterCompiler, name: str, total_play_time: float, instrument_cfg: dict[str, Any], latency_corrections: dict[str, float] | None = None, distortion_corrections: dict[int, Any] | None = None)[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:
  • parent (quantify_scheduler.backends.qblox.instrument_compilers.ClusterCompiler) – Reference to the parent object.

  • 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 part of the hardware configuration dictionary referring to this device. This is one of the inner dictionaries of the overall hardware config.

  • latency_corrections – Dict containing the delays for each port-clock combination. This is specified in the top layer of hardware config.

_settings: quantify_scheduler.backends.types.qblox.AnalogModuleSettings[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, portclock: tuple[str, str], channel_name: str, sequencer_cfg: dict[str, Any], channel_cfg: dict[str, Any]) AnalogSequencerCompiler[source]#

Create an instance of AnalogSequencerCompiler.

abstract assign_frequencies(sequencer: AnalogSequencerCompiler) 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).

_set_lo_interm_freqs(freqs: quantify_scheduler.backends.qblox.helpers.Frequencies, sequencer: AnalogSequencerCompiler, compiler_lo_baseband: quantify_scheduler.backends.qblox.instrument_compilers.LocalOscillatorCompiler | None = None, lo_freq_setting_rf: str | None = None) None[source]#

Sets the LO/IF frequencies, for baseband and RF modules.

Parameters:
  • freqs – LO, IF, and clock frequencies, supplied via an helpers.Frequencies object.

  • sequencer – The sequencer for which frequences are to be set.

  • compiler_lo_baseband – For baseband modules, supply the instrument_compilers.LocalOscillatorCompiler instrument compiler of which the frequency is to be set.

  • lo_freq_setting_rf – For RF modules, supply the name of the LO frequency param from the RFModuleSettings that is to be set.

Raises:
  • ValueError – In case neither LO frequency nor IF has been supplied.

  • ValueError – In case both LO frequency and IF have been supplied and do not adhere to \(f_{RF} = f_{LO} + f_{IF}\).

  • ValueError – In case of RF, when the LO frequency was already set to a different value.

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() 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.

_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. Throws a ValueError if a gain value gets modified.

_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() 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(parent: quantify_scheduler.backends.qblox.instrument_compilers.ClusterCompiler, name: str, total_play_time: float, instrument_cfg: dict[str, Any], latency_corrections: dict[str, float] | None = None, distortion_corrections: dict[int, Any] | None = None)[source]#

Bases: AnalogModuleCompiler

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

assign_frequencies(sequencer: AnalogSequencerCompiler) 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()).

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(parent: quantify_scheduler.backends.qblox.instrument_compilers.ClusterCompiler, name: str, total_play_time: float, instrument_cfg: dict[str, Any], latency_corrections: dict[str, float] | None = None, distortion_corrections: dict[int, Any] | None = None)[source]#

Bases: AnalogModuleCompiler

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

assign_frequencies(sequencer: AnalogSequencerCompiler) None[source]#

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

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.

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]#