Skip to content

Python Utils Feedback Model

zhinst.utils.feedback_model

Feedback Data Latency model for PQSC, SHF- and HDAWG systems.

Typical usage example:

model = QCCSFeedbackModel(
    description=get_feedback_system_description(
        generator_type=SGType.HDAWG,
        analyzer_type=QAType.SHFQA,
        pqsc_mode=PQSCMode.DECODER
    )
)

AlignmentSettings(playzero_samples=0, sigout_delay=0.0) dataclass

Device settings to allow output alignment in a QCCS system.

playzero_samples: int = 0 class-attribute instance-attribute

The delay in seconds to apply to the signal output in the corresponding node.

sigout_delay: float = 0.0 class-attribute instance-attribute

FeedbackPath

Bases: IntEnum

Different handling of feedback data from the PQSC.

.. versionadded:: 0.3

INTERNAL = 3 class-attribute instance-attribute

ZSYNC = 1 class-attribute instance-attribute

HDAWGChannelModel()

Bases: _DeviceChannelOutputModel

HDAWG channel output latency model.

Initialize the HDAWG channel output latency model.

_BSC_LATENCY = 32 class-attribute instance-attribute

_EXP_LATENCY = 88 class-attribute instance-attribute

_FIR_LATENCY = 136 class-attribute instance-attribute

_HPC_LATENCY = 96 class-attribute instance-attribute

_PRECOMP_LATENCY = 72 class-attribute instance-attribute

_SIGOUT_DELAY_MAX_LIMIT = 62 / SAMPLE_FREQUENCY class-attribute instance-attribute

get_latency(precompensation_enabled=0, precompensation_conf=None, direct_enabled=0)

Return the output latency of the instrument for the given configuration.

Parameters:

Name Type Description Default
precompensation_enabled int

'1' when precompensation is enabled. Defaults to '0'.

0
precompensation_conf PrecompensationConf

The Precompensation configuration.

None
direct_enabled int

'1' when direct output is enabled. Defaults to '0'.

0

Returns:

Name Type Description
int int

The expected latency in samples.

get_sigout_delay_limit()

Return the maximum allowed signal output delay.

PQSCMode

Bases: IntEnum

Different handling of feedback data from the PQSC.

DECODER = 2 class-attribute instance-attribute

REGISTER_FORWARD = 1 class-attribute instance-attribute

PrecompensationConf(highpass_enable=False, exponentials_count=0, bounces_enable=False, fir_enable=False) dataclass

HDAWG Precompensation configuration.

bounces_enable: bool = False class-attribute instance-attribute

FIR filter enabled

exponentials_count: int = 0 class-attribute instance-attribute

Bounce compensation enabled

fir_enable: bool = False class-attribute instance-attribute

highpass_enable: bool = False class-attribute instance-attribute

Number of exponential filters used

QAChannelOutModel()

Bases: _DeviceChannelOutputModel

SHFQA channel output latency model.

Initialize the SHFQA channel output latency model.

_SIGOUT_DELAY_MAX_LIMIT = 1.24e-07 class-attribute instance-attribute

get_latency(rflfpath='rf', trigger=TriggerSource.ZSYNC)

Return the output latency of the instrument for the given configuration.

Parameters:

Name Type Description Default
rflfpath str | int

Specifies the path type. Use "rf" for RF path or "lf" for LF path. Defaults to "rf". When used as bool, '1' corresponds to "rf" and '0'' to "lf".

'rf'
trigger TriggerSource

The trigger source. Defaults to TriggerSource.ZSYNC.

ZSYNC

Raises:

Type Description
ValueError

If the trigger is not an instance of TriggerSource.

Returns:

Name Type Description
int int

The calculated latency in samples.

get_sigout_delay_limit()

Return the maximum allowed signal output delay.

QAType

Bases: IntEnum

Different quantum analyzer types used in a QCCS setup.

SHFQA = 1 class-attribute instance-attribute

SHFQC = 2 class-attribute instance-attribute

QCCSFeedbackModel(description) dataclass

A model that calculates the latency of feedback data.

Estimates are provided for the selected Signal Generator. The 'start trigger' from the PQSC is used as starting point for the latency estimate.

Parameters:

Name Type Description Default
description QCCSSystemDescription

The QCCS system configuration description as returned from get_feedback_system_description()

required

description: QCCSSystemDescription instance-attribute

get_latency(samples=20, length=None)

Provide the expected latency relative to the integration length.

Parameters:

Name Type Description Default
samples int

The number of samples from the trigger to the completion of the integration. This includes the samples up to the startQA() command, plus the integration length and delay.

20
length int | None

Deprecated

None

Returns:

Type Description
int

The expected latency in AWG clock cycles

QCCSSystemDescription(initial_latency_cycles, initial_steps, pattern, period_steps=50, latency_in_period_cycles=25, rtlogger_correction=0) dataclass

Describe the behavior of a QCCS system with respect to feedback latency.

initial_latency_cycles: int instance-attribute

[clock cycles] Minimum latency for the smallest amount of integration length.

initial_steps: int instance-attribute

[steps] Integration length increment steps, until the first latency increment.

latency_in_period_cycles: int = 25 class-attribute instance-attribute

[clock cycles] Latency increment for a full period.

pattern: list[tuple[int, int]] instance-attribute

[(clock cycles, steps),...] The pattern of periodic latency increments with respect to integration length increments

period_steps: int = 50 class-attribute instance-attribute

[steps] Period of the latency increment pattern.

rtlogger_correction: int = 0 class-attribute instance-attribute

[clock cycles] Correction needed on top of the RTLogger recorded latency, to match the latency seen by the sequencer

SGChannelModel()

Bases: _DeviceChannelOutputModel

SHFSG channel output latency model.

Initialize the SHFSG channel output latency model.

_MAX_ROUTER_PATHS_PER_CHANNEL = 3 class-attribute instance-attribute

_SIGOUT_DELAY_MAX_LIMIT = 1.24e-07 class-attribute instance-attribute

get_latency(*, rflfpath='rf', outputrouter_enable=0, trigger=TriggerSource.ZSYNC)

Return the output latency of the instrument for the given configuration.

Parameters:

Name Type Description Default
rflfpath str | int

Specifies the path type. Use "rf" for RF path or "lf" for LF path. Defaults to "rf". When used as int, '1' corresponds to "rf" and '0' to "lf".

'rf'
outputrouter_enable int

'1' when the output router is enabled. Defaults to '0'.

0
trigger TriggerSource

The trigger source. Defaults to TriggerSource.ZSYNC.

ZSYNC

Raises:

Type Description
TypeError

If the trigger is not an instance of TriggerSource.

ValueError

If rtr_c is not within the valid range.

Returns:

Name Type Description
int int

The calculated latency in samples.

get_sigout_delay_limit()

Return the maximum allowed signal output delay.

SGType

Bases: IntEnum

Different signal generator types used in a QCCS setup.

HDAWG = 1 class-attribute instance-attribute

SHFQC = 3 class-attribute instance-attribute

SHFSG = 2 class-attribute instance-attribute

TriggerSource

Bases: IntEnum

QCCS system trigger sources.

INTERNAL = 2 class-attribute instance-attribute

ZSYNC = 1 class-attribute instance-attribute

equalize_playzero_samples(alignment_settings, maximum_sigout_delay=None)

Equalizes the number of playzero samples for channels that require it.

This is needed for
  • SG channels of the same instruments that use the output router and different rflfpath settings.
  • HDAWG channels that share the same sequencer and different 'direct_enable' setting

Parameters:

Name Type Description Default
alignment_settings list[tuple[int, int]]

A list of tuples containing the playzero samples and delay seconds for each affected channel.

required
maximum_sigout_delay float

The maximum allowed value signal delay that is supported from the output delay node, for the type of instrument used. Defaults to None.

None

Returns:

Type Description
list[AlignmentSettings]

list[AlignmentSettings]: The updated alignment settings in the same order.

get_feedback_system_description(generator_type, analyzer_type, pqsc_mode=None, trigger_source=TriggerSource.ZSYNC, feedback_path=FeedbackPath.ZSYNC, automatic_triggerdelays=True)

Returns a QCCSSysDescription object for a given configuration.

Parameters:

Name Type Description Default
generator_type SGType

Signal generator used (SHFSG/HDAWG).

required
analyzer_type QAType

Quantum analyzer used.

required
pqsc_mode PQSCMode | None

Mode of operation for the PQSC.

None
trigger_source TriggerSource

Select between ZSync via PQSC or internal trigger for the SHFQC.

ZSYNC
feedback_path FeedbackPath

Used only when the generator type is SHFQC to select between local feedback or through PQSC

ZSYNC
automatic_triggerdelays bool

Set to false if the automatic alignment for the instruments is disabled.

True

Returns:

Type Description
QCCSSystemDescription

A QCCS system description object to be used in a QCCSFeedbackModel object.

Raises:

Type Description
ValueError

Incorrect values for 'generator_type', 'analyzer_type', 'pqsc_mode' or 'feedback_path'.

.. versionchanged:: 0.3

Added `feedback_path` argument.