zhinst_backend#
Backend for Zurich Instruments.
Module Contents#
Classes#
Zurich Instruments acquisition configuration. |
|
Zurich Instruments device configuration. |
|
Datastructure containing the information needed to compile to the Zurich Instruments backend. |
Functions#
|
Iterates over all hardware_channels in a schedule to determine if any of the pulses |
|
Take the hardware configuration file and return a dictionary that maps port-clock |
|
depending on the output channel, select the right clock cycle time and sample rate |
|
|
|
|
|
|
|
Changes the "abs_time" of a timing table depending on the specified latency |
Calculates by how much time to shift all operations to ensure a measurement starts |
|
|
Updates the abs_time of all operations based on the measurement fixpoint correction. |
|
Adds the sequence clock cycle start and sampling start of each operation for each |
|
Multiple (numerical) waveforms might be needed to represent a single operation. |
|
Returns the LocalOscillator domain models parsed from the data dictionary. |
|
|
|
Validates the CompiledSchedule required values for creating the backend. |
|
Add waveform corrections such as modulation, changing the |
Iterates over a timing table for a specific output for which clock_cycle_start and |
|
|
Extract the old-style Zhinst hardware config from the CompilationConfig. |
Generate a new-style ZIHardwareCompilationConfig from an old-style hardware config. |
|
|
|
|
Compiles zhinst hardware instructions for a schedule. |
|
Adds configuration for a local oscillator required for a specific output channel to |
|
|
|
|
|
|
|
Initialize programming the UHFQA ZI Instrument. |
|
|
|
Iterates over all unique waveforms in a timing_table dataframe to calculate the |
Attributes#
- WAVEFORM_GRANULARITY: dict[quantify_scheduler.backends.types.zhinst.DeviceType, int][source]#
- DEVICE_SAMPLING_RATES: dict[quantify_scheduler.backends.types.zhinst.DeviceType, dict[int, int]][source]#
- ensure_no_operations_overlap(timing_table: pandas.DataFrame) None [source]#
Iterates over all hardware_channels in a schedule to determine if any of the pulses have overlap.
- Parameters:
timing_table – a timing table containing the absolute time and duration as well as the hardware channels on which these pulses are to be applied.
- Raises:
ValueError – If there is overlap between operations.
- _extract_port_clock_channelmapping(hardware_cfg: dict[str, Any]) dict[str, str] [source]#
Take the hardware configuration file and return a dictionary that maps port-clock pairs to instrument output channels.
- e.g.: {‘q0:mw-q0.01’: ‘ic_hdawg0.channel_0’,
‘q0:res-q0.ro’: ‘ic_uhfqa0.channel_0’}
- _determine_clock_sample_start(hardware_channel: str, abs_time: float, operation_name: str = '') tuple[int, float] [source]#
depending on the output channel, select the right clock cycle time and sample rate from the channel descriptor for ZI channels. the sample is returned as a float to preserve information of incorrect rounding to full samples if present.
- _determine_sample_start(hardware_channel: str, abs_time: float, operation_name: str) float [source]#
- _add_channel_information(timing_table: pandas.DataFrame, port_clock_channelmapping: dict) pandas.DataFrame | None [source]#
- _apply_latency_corrections(timing_table: pandas.DataFrame, latency_dict: dict) pandas.DataFrame [source]#
Changes the “abs_time” of a timing table depending on the specified latency corrections for each port-clock combination as specified in the latency dict. The corrections are added to the abs_time elements fulfilling the specific port-clock combination.
- _determine_measurement_fixpoint_correction(measurement_start_sample: int, common_frequency: float = 600000000.0) tuple[float, int] [source]#
Calculates by how much time to shift all operations to ensure a measurement starts at sample 0.
- Parameters:
measurement_start_sample – the sample at which the measurement starts
common_frequency – The shift needs to be such that it occurs at a multiple of the common frequency. A larger common frequency results in a smaller time correction. This largest common frequency is the common frequency of the HDAWG and UHFQA and is 600 MHz.
- Returns:
The time correction to be applied in seconds. The correction in the number of samples.
- Return type:
- _apply_measurement_fixpoint_correction(timing_table: pandas.DataFrame, common_frequency: float = 600000000.0) pandas.DataFrame [source]#
Updates the abs_time of all operations based on the measurement fixpoint correction.
The abs_time is applied to all operations between two acquisitions. After that the samples and clocks are re-calculated to reflect this change in time.
- Parameters:
timing_table – A timing table that has the samples already determined.
common_frequency – The shift needs to be such that it occurs at a multiple of the common frequency. A larger common frequency results in a smaller time correction. This largest common frequency is the common frequency of the HDAWG and UHFQA and is 600 MHz.
- _add_clock_sample_starts(timing_table: pandas.DataFrame) pandas.DataFrame [source]#
Adds the sequence clock cycle start and sampling start of each operation for each channel.
- _add_waveform_ids(timing_table: pandas.DataFrame) pandas.DataFrame [source]#
Multiple (numerical) waveforms might be needed to represent a single operation.
This waveform_id consists of a concatenation of the waveform_op_id with the sample_start and modulation phase added to it.
- _parse_local_oscillators(data: dict[str, Any]) dict[str, quantify_scheduler.backends.types.zhinst.LocalOscillator] [source]#
Returns the LocalOscillator domain models parsed from the data dictionary.
- Parameters:
data – The hardware map “local_oscillators” entry.
- Returns:
A dictionary of unique LocalOscillator instances.
- Raises:
RuntimeError – If duplicate LocalOscillators have been found.
- _parse_devices(data: dict[str, Any]) list[quantify_scheduler.backends.types.zhinst.Device] [source]#
- _validate_schedule(schedule: quantify_scheduler.schedules.schedule.Schedule) None [source]#
Validates the CompiledSchedule required values for creating the backend.
- Parameters:
schedule –
- Raises:
ValueError – The validation error.
- apply_waveform_corrections(output: quantify_scheduler.backends.types.zhinst.Output, waveform: numpy.ndarray, start_and_duration_in_seconds: tuple[float, float], instrument_info: quantify_scheduler.backends.types.zhinst.InstrumentInfo, is_pulse: bool) tuple[int, int, numpy.ndarray] [source]#
Add waveform corrections such as modulation, changing the waveform starting time by shifting it and resizing it based on the Instruments granularity.
- Parameters:
output –
waveform –
start_and_duration_in_seconds –
instrument_info –
is_pulse – True if it is a pulse to be up converted, False if it is an integration weight.
- _get_instruction_list(output_timing_table: pandas.DataFrame) list[quantify_scheduler.backends.types.zhinst.Instruction] [source]#
Iterates over a timing table for a specific output for which clock_cycle_start and waveform_id have been determined to return a list of all instructions to be played on a Zurich Instruments device.
- class ZIAcquisitionConfig[source]#
Zurich Instruments acquisition configuration.
- Parameters:
bin_mode –
- resolvers: dict[int, Callable][source]#
Resolvers used to retrieve the results from the right UHFQA nodes.
See also
resolvers
- bin_mode: quantify_scheduler.enums.BinMode[source]#
The bin mode of the acquisitions.
- class ZIDeviceConfig[source]#
Zurich Instruments device configuration.
- settings_builder: quantify_scheduler.backends.zhinst.settings.ZISettingsBuilder[source]#
The builder to configure the ZI settings.
The builder typically includes DAQ and AWG settings.
- acq_config: ZIAcquisitionConfig | None[source]#
Acquisition config for the schedule.
The acquisition config contains the number of acquisitions and a dictionary of resolvers used to retrieve the results from the right UHFQA nodes. Note that this part of the config is not needed during prepare, but only during the retrieve acquisitions step.
- _generate_legacy_hardware_config(schedule: quantify_scheduler.schedules.schedule.Schedule, compilation_config: quantify_scheduler.backends.graph_compilation.CompilationConfig) dict [source]#
Extract the old-style Zhinst hardware config from the CompilationConfig.
Only the port-clok combinations that are used in the schedule are included in the old-style hardware config.
- Parameters:
schedule (Schedule) – Schedule from which the port-clock combinations are extracted.
config (CompilationConfig) – CompilationConfig from which hardware config is extracted.
- Returns:
hardware_config – Zhinst hardware configuration.
- Return type:
- Raises:
KeyError – If the CompilationConfig.connectivity does not contain a hardware config.
KeyError – If the ‘frequency_param’ is not specified for in a LO config.
ValueError – If a value is specified in both the hardware options and the hardware config.
RuntimeError – If no external local oscillator is found in the generated zhinst hardware configuration.
- _generate_new_style_hardware_compilation_config(old_style_config: dict) dict [source]#
Generate a new-style ZIHardwareCompilationConfig from an old-style hardware config.
- Parameters:
old_style_config – Old-style hardware config.
- Returns:
New-style hardware compilation config dictionary.
- Return type:
- _get_operations_by_repr(schedule: quantify_scheduler.schedules.schedule.Schedule) dict[str, quantify_scheduler.operations.operation.Operation] [source]#
- compile_backend(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]#
Compiles zhinst hardware instructions for a schedule.
This method generates sequencer programs, waveforms and configurations required for the instruments defined in the hardware configuration.
- Parameters:
schedule – The schedule to be compiled.
config – Compilation config for
QuantifyCompiler
.hardware_cfg – (deprecated) The hardware configuration of the setup. Pass a full compilation config instead using
config
argument.
- Returns:
A collection containing the compiled backend configuration for each device.
- Raises:
NotImplementedError – Thrown when using unsupported ZI Instruments.
ValueError – When both
config
andhardware_cfg
are supplied.
- class ZIHardwareCompilationConfig(/, **data: Any)[source]#
Bases:
quantify_scheduler.backends.types.common.HardwareCompilationConfig
Datastructure containing the information needed to compile to the Zurich Instruments backend.
This information is structured in the same way as in the generic
HardwareCompilationConfig
, but contains fields for hardware-specific settings.- config_type: Type[ZIHardwareCompilationConfig][source]#
A reference to the
HardwareCompilationConfig
DataStructure for the Zurich Instruments backend.
- hardware_description: Dict[str, quantify_scheduler.backends.types.zhinst.ZIHardwareDescription | quantify_scheduler.backends.types.common.HardwareDescription][source]#
Description of the instruments in the physical setup.
- hardware_options: quantify_scheduler.backends.types.zhinst.ZIHardwareOptions[source]#
Options that are used in compiling the instructions for the hardware, such as
LatencyCorrection
orOutputGain
.
- 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 Zurich Instruments hardware.
- _add_lo_config(channel: quantify_scheduler.backends.types.zhinst.Output, local_oscillators: dict[str, quantify_scheduler.backends.types.zhinst.LocalOscillator], resources: dict[str, quantify_scheduler.resources.Resource], device_configs: dict[str, ZIDeviceConfig | float]) None [source]#
Adds configuration for a local oscillator required for a specific output channel to the device configs.
- _add_wave_nodes(device_type: quantify_scheduler.backends.types.zhinst.DeviceType, awg_index: int, wf_id_mapping: dict[str, int], numerical_wf_dict: dict[str, numpy.ndarray], settings_builder: quantify_scheduler.backends.zhinst.settings.ZISettingsBuilder) quantify_scheduler.backends.zhinst.settings.ZISettingsBuilder [source]#
- _compile_for_hdawg(device: quantify_scheduler.backends.types.zhinst.Device, timing_table: pandas.DataFrame, numerical_wf_dict: dict[str, numpy.ndarray], repetitions: int) quantify_scheduler.backends.zhinst.settings.ZISettingsBuilder [source]#
- Parameters:
device –
timing_table –
numerical_wf_dict –
repetitions –
- Raises:
- _assemble_hdawg_sequence(instructions: list[quantify_scheduler.backends.types.zhinst.Instruction], wf_id_mapping: dict[str, int], numerical_wf_dict: dict[str, numpy.ndarray], repetitions: int, schedule_duration: float, markers: str | int | None = None, trigger: int = None) tuple[str, str] [source]#
- _compile_for_uhfqa(device: quantify_scheduler.backends.types.zhinst.Device, timing_table: pandas.DataFrame, numerical_wf_dict: dict[str, numpy.ndarray], repetitions: int, operations: dict[str, quantify_scheduler.operations.operation.Operation], bin_mode: quantify_scheduler.enums.BinMode) tuple[quantify_scheduler.backends.zhinst.settings.ZISettingsBuilder, ZIAcquisitionConfig] [source]#
Initialize programming the UHFQA ZI Instrument.
Creates a sequence program and converts schedule pulses to waveforms for the UHFQA.
- Parameters:
device –
timing_table –
numerical_wf_dict –
repetitions –
operations –
- _assemble_uhfqa_sequence(instructions: list[quantify_scheduler.backends.types.zhinst.Instruction], wf_id_mapping: dict[str, int], repetitions: int, device_name: str, trigger: int = 2) str [source]#
- construct_waveform_table(timing_table: pandas.DataFrame, operations_dict: dict[str, quantify_scheduler.operations.operation.Operation], device_dict: dict[str, quantify_scheduler.backends.types.zhinst.Device]) dict[str, numpy.ndarray] [source]#
Iterates over all unique waveforms in a timing_table dataframe to calculate the numerical waveforms.
- Parameters:
timing_table – A timing table for which the waveform_id has been determined
operations_dict – The Operations contained in a Schedule.
device_dict – A dictionary containing the
Device
objects describing the devicesin the hardware configuration.
- Returns:
numerical_waveform dict, a dictionary containing the complex valued waveforms that will be uploaded to the control hardware.