AWG Core Module

class zhinst.toolkit.control.drivers.base.AWGCore(parent: zhinst.toolkit.control.drivers.base.base.BaseInstrument, index: int)

Implements an AWG Core representation.

The AWGCore class implements basic functionality of the AWG sequencer without the need for the user to write their own ‘.seqC’ code. The AWGCore holds a SequenceProgram object whose parameters can be set using the set_sequence_params(…) method of the AWG.

This module takes over the functionality of configuring the seuqence program and compiling it on the instrument. Given the ‘Simple’ sequence type, sample-defined waveforms can be queued and uploaded to the AWG.

This base class AWGCore is inherited by device-specific AWGs for the HDAWG or the UHFQA/UHFLI. The device-specific AWGs add certain zhinst-toolkit Parameters and apply certain instrument settings, depending on the sequence_type and the trigger_mode (sending out a trigger signal or waiting for a trigger) of the sequence program.

For example, a predefined Rabi sequence with a sweep over 101 different amplitudes could be programmed like this:

>>> awg = hdawg.awgs[0]
>>> awg.set_sequence_params(
>>>     sequence_type="Rabi",
>>>     trigger_mode="None",
>>>     repetitions=1e3,
>>>     period=20e-6,
>>>     pulse_amplitudes=np.linspace(0, 1.0, 101),
>>>     pulse_width=20e-9,
>>>     pulse_truncation=4,
>>> )
>>> awg.compile()
>>> ...
>>> awg.run()
>>> awg.wait_done()

The sequence type ‘Simple’ allows the user to upload sample-defined waveforms as numpy arrays. The waveforms in the queue are played one after the other with a specified period and alignment/delay to a time origin.

>>> awg.set_sequence_params(
>>>     sequence_type="Simple",
>>>     trigger_mode="Send Trigger",
>>>     repetitions=1e3,
>>>     period=20e-6,
>>> )
>>> for amp in np.linspace(-1, 1, 101):
>>>     wave = amp * np.linspace(-1.0, 1.0, 800)
>>>     awg.queue_waveform(wave, -wave)
Current length of queue: 1
Current length of queue: 2
Current length of queue: 3
Current length of queue: 4
...
>>> awg.compile_and_upload_waveforms()
Compilation successful
hd1-0: Sequencer status: ELF file uploaded
Upload of 101 waveforms took 0.20005226135253906 s
>>> awg.run()
>>> awg.wait_done()
parent

The parent instrument that this AWGCore is associated to.

Type

BaseInstrument

index

An integer specifying the index in the parent instrument.

Type

int

waveforms

A list of Waveforms that represent the queued up waveforms in for a ‘Simple’ sequence.

Type

list

program

A SequenceProgram object used to program predefined ‘.seqC’ sequences on the device.

Type

SequenceProgram

name

The name of the AWG Core.

Type

str

is_running

A flag that shows if the AWG Core is currently running or not.

Type

bool

sequence_params

A dictionary of all the sequence parameters currently set on the SequenceProgram.

Type

dict

compile() → None

Compiles the current SequenceProgram on the AWG Core.

Raises
  • ToolkitError – If the AWG Core has not been set up yet.

  • ToolkitError – If the compilation has failed.

  • Warning – If the compilation has finished with a warning.

compile_and_upload_waveforms() → None

Compiles the Sequence Program and uploads the queued waveforms.

Simply combines the two methods to make sure the sequence is compiled before the waveform queue is uplaoded.

queue_waveform(wave1: Union[List, numpy.array], wave2: Union[List, numpy.array], delay: float = 0) → None

Adds a new waveform to the queue.

Parameters
  • wave1 (array) – The waveform to be queued for Channel 1 as a 1D numpy array.

  • wave2 (array) – The waveform to be queued for Channel 2 as a 1D numpy array.

Keyword Arguments

delay (int) – An individual delay in seconds for this waveform w.r.t. the time origin of the sequence. (default: 0)

Raises

Exception – If the sequence is not of type ‘Simple’.

replace_waveform(wave1: Union[List, numpy.array], wave2: Union[List, numpy.array], i: int = 0, delay: float = 0) → None

Replaces a waveform in the queue at a given index.

Parameters
  • wave1 (array) – Waveform to replace current wave for Channel 1.

  • wave2 (array) – Waveform to replace current wave for Channel 2.

Keyword Arguments
  • i (int) – The index of the waveform in the queue to be replaced.

  • delay (int) – An individual delay in seconds for this waveform w.r.t. the time origin of the sequence. (default: 0)

Raises

ToolkitError – If the given index is out of range.

reset_queue() → None

Resets the waveform queue to an empty list.

run() → None

Runs the AWG Core.

set_sequence_params(**kwargs) → None

Sets the parameters of the Sequence Program.

Passes all the keyword arguments to the set_param(…) method of the Sequence Program. The available sequence parameters may vary between different sequences. For a list of all current sequence parameters see the property sequence_params.

They include ‘sequence_type’, ‘period’, ‘repetitions’, ‘trigger_mode’, ‘trigger_delay’, …

>>> hdawg.awgs[0]
<zhinst.toolkit.hdawg.AWG object at 0x0000021E467D3320>
    parent  : <zhinst.toolkit.hdawg.HDAWG object at 0x0000021E467D3198>
    index   : 0
    sequence:
            type: None
            ('target', 'hdawg')
            ('clock_rate', 2400000000.0)
            ('period', 0.0001)
            ('trigger_mode', 'None')
            ('repetitions', 1)
            ('alignment', 'End with Trigger')
            ...
>>> hdawg.awgs[0].set_sequence_params(
>>>     sequence_type="Simple",
>>>     trigger_mode="Send Trigger",
>>>     repetitions=1e6,
>>>     alignemnt="Start with Trigger"
>>> )
stop() → None

Stops the AWG Core.

upload_waveforms() → None

Uploads all waveforms in the queue to the AWG Core.

This method only works as expected if the Sequence Program is in ‘Simple’ mode and has been compiled beforehand. See compile_and_upload_waveforms(...)().

wait_done(timeout: float = 10) → None

Waits until the AWG Core is finished.

Keyword Arguments

timeout (int) – The maximum waiting time in seconds for the AWG Core. (default: 10)

Sequence Programs

Base Sequence

class zhinst.toolkit.helpers.sequences.Sequence(target=<DeviceTypes.HDAWG: 'hdawg'>, clock_rate=2400000000.0, period=0.0001, trigger_mode=<TriggerMode.SEND_TRIGGER: 'Send Trigger'>, repetitions=1, alignment=<Alignment.END_WITH_TRIGGER: 'End with Trigger'>, n_HW_loop=1, dead_time=5e-06, trigger_delay=0, latency=1.6e-07, trigger_cmd_1='//', trigger_cmd_2='//', wait_cycles=0, dead_cycles=1500, reset_phase=False)

Base class for an AWG sequence to be programmed on a AWGCore .

period

Period in seconds at which the experiment is repeated.

Type

double

trigger_mode

The trigger mode of the sequence, i.e if the AWG Core is used to send out the triger signal (‘Send Triger’ or TriggerMode.SEND_TRIGGER) or to wait for an external trigger signal (‘External Triger’ or TriggerMode.EXTERNAL_TRIGGER). (default: TriggerMode.NONE)

Type

str or TriggerMode enum

repetitions

The number of repetitions of the experiment.

Type

int

alignment

The alignment of the played waveform with the trigger signal, i.e. if the waveform should start with the trigger (or the time origin t=0 of the sequence). Waveforms can either ‘Start with Trigger’ (Alignment.START_WITH_TRIGGER) or ‘End with Trigger’ (Alignment.END_WITH_TRIGGER).

Type

str

dead_time

The dead time of a sequence is the time in seconds after the time origin of the sequence before the next trigger signal is sent / expected. This time defines the maximum length of a waveform played after the time origin, otherwise triggers can be missed. (default: 5 us)

Type

double

trigger_delay

The trigger delay is an addittional delay in seconds that shifts the time origin t=0 with respect to the trigger signal. (default: 0)

Type

double

latency

The latency is a time in seconds that compensated for different trigger latencies of different instruments. It works as a constant trigger_delay.

Type

double

reset_phase

A flag that specifies if the phase of the modulation oscillator should be reset to 0 for every repetition of the experiment before the waveform is played. This value only applies for AWG Cores of the HDAWG when IQ Modulation is enabled.

Type

bool

Simple Sequence

class zhinst.toolkit.helpers.sequences.SimpleSequence(target=<DeviceTypes.HDAWG: 'hdawg'>, clock_rate=2400000000.0, period=0.0001, trigger_mode=<TriggerMode.SEND_TRIGGER: 'Send Trigger'>, repetitions=1, alignment=<Alignment.END_WITH_TRIGGER: 'End with Trigger'>, n_HW_loop=1, dead_time=5e-06, trigger_delay=0, latency=1.6e-07, trigger_cmd_1='//', trigger_cmd_2='//', wait_cycles=0, dead_cycles=1500, reset_phase=False, buffer_lengths=[800], delay_times=[0])

Bases: zhinst.toolkit.helpers.sequences.Sequence

Sequence for simple playback of waveform arrays.

Initializes placeholders (randomUniform(…)) of the correct length for the waveforms in the queue of the AWG Core. The data of the waveform placeholders is then replaced in memory when uploading the waveform using upload_waveforms(). The waveforms are played sequentially within the main loop of the sequence program.

>>> awg.set_sequence_params(sequence_type="Simple")
>>> awg.queue_waveform(np.ones(800), np.oenes(800))
>>> awg.compile_and_upload_waveforms()
>>> ...
buffer_lengths

A list of integers with the required lengths of the waveform buffers. These values will be taken from the waveforms in the queue of the AWG Core.

Type

list

delay_times

A list of delay times for each fo the individual waveform w.r.t. the time origin of the period. These values will be taken from the waveform queue of the AWG Core.

Type

list

Rabi Sequence

class zhinst.toolkit.helpers.sequences.RabiSequence(target=<DeviceTypes.HDAWG: 'hdawg'>, clock_rate=2400000000.0, period=0.0001, trigger_mode=<TriggerMode.SEND_TRIGGER: 'Send Trigger'>, repetitions=1, alignment=<Alignment.END_WITH_TRIGGER: 'End with Trigger'>, n_HW_loop=1, dead_time=5e-06, trigger_delay=0, latency=1.6e-07, trigger_cmd_1='//', trigger_cmd_2='//', wait_cycles=0, dead_cycles=1500, reset_phase=False, pulse_amplitudes=[1.0], pulse_width=5e-08, pulse_truncation=3)

Bases: zhinst.toolkit.helpers.sequences.Sequence

Predefined Rabi Sequence.

This sequence plays a Gaussian pulse with width pulse_width and varies its amplitude. The values for the amplitude sweep are defined in the array parameter pulse_amplitudes. For each value in the array, one pulse of that amplitude is played in the main loop of the seuence program in the same order as in the array.

>>> awg.set_sequence_params(
>>>     sequence_type="Rabi",
>>>     pulse_width=50e-9,
>>>     pulse_amplitudes=np.linspace(0, 1.0, 101),
>>> )
pulse_amplitudes

A list of pulse amplitudes for each point in the Rabi sequence. The pulse amplitudes have to be within -1.0 and 1.0.

Type

list

pulse_width

The width of the gaussian pulse (sigma) in seconds.

Type

double

pulse_truncation

The truncation of the gaussian pulse as multiples of the width.

Type

double

T1 Sequence

class zhinst.toolkit.helpers.sequences.T1Sequence(target=<DeviceTypes.HDAWG: 'hdawg'>, clock_rate=2400000000.0, period=0.0001, trigger_mode=<TriggerMode.SEND_TRIGGER: 'Send Trigger'>, repetitions=1, alignment=<Alignment.END_WITH_TRIGGER: 'End with Trigger'>, n_HW_loop=1, dead_time=5e-06, trigger_delay=0, latency=1.6e-07, trigger_cmd_1='//', trigger_cmd_2='//', wait_cycles=0, dead_cycles=1500, reset_phase=False, pulse_amplitude=1, pulse_width=5e-08, pulse_truncation=3, delay_times=[1e-06])

Bases: zhinst.toolkit.helpers.sequences.Sequence

Predefined T1 Sequence.

This sequence plays a Gaussian pulse with width pulse_width and amplitude pulse_amplitude. The shift of the waveform with respect to the period’s time origin t=0 is defined in the array parameter time_delays. For each value in the array, one pulse is shifted by the given value (in seconds) forward in time is played in the main loop of the seuence program.

>>> awg.set_sequence_params(
>>>     sequence_type="T1",
>>>     pulse_amplitude=0.876,
>>>     pulse_width=50e-9,
>>>     delay_times=np.linspace(0.1e-6, 10e-6, 100),
>>> )
pulse_amplitude

The amplitude of the Gaussian pulse (pi-pulse). Must be between -1.0 and 1.0.

Type

double

pulse_width

The width of the gaussian pulse (sigma) in seconds.

Type

double

pulse_truncation

The truncation of the gaussian pulse as multiples of the width.

Type

double

delay_times

The time shifts in seconds of the waveforms forward in time with respect to the period’s time origin t=0.

Type

array

T2 Ramsey Sequence

class zhinst.toolkit.helpers.sequences.T2Sequence(target=<DeviceTypes.HDAWG: 'hdawg'>, clock_rate=2400000000.0, period=0.0001, trigger_mode=<TriggerMode.SEND_TRIGGER: 'Send Trigger'>, repetitions=1, alignment=<Alignment.END_WITH_TRIGGER: 'End with Trigger'>, n_HW_loop=1, dead_time=5e-06, trigger_delay=0, latency=1.6e-07, trigger_cmd_1='//', trigger_cmd_2='//', wait_cycles=0, dead_cycles=1500, reset_phase=False, pulse_amplitude=1, pulse_width=5e-08, pulse_truncation=3, delay_times=[1e-06])

Bases: zhinst.toolkit.helpers.sequences.T1Sequence

Predefined T2 Ramsey sequence.

This sequence plays two Gaussian pulses with width pulse_width and amplitude 1/2 * pulse_amplitude. The shift between the waveforms is defined in the array parameter time_delays. For each value in the array, the first pulse is shifted forward in time by the given value (in seconds) before the second pulse is played.

>>> awg.set_sequence_params(
>>>     sequence_type="T1",
>>>     pulse_amplitude=0.876,
>>>     pulse_width=50e-9,
>>>     delay_times=np.linspace(0.1e-6, 10e-6, 100),
>>> )
pulse_amplitude

Twice the amplitude of the Gaussian pulse (pi-half pulse). Must be between -1.0 and 1.0.

Type

double

pulse_width

The width of the gaussian pulse (sigma) in seconds.

Type

double

pulse_truncation

The truncation of the gaussian pulse as multiples of the width.

Type

double

delay_times

The time shifts in seconds of the waveforms forward in time with respect to the period’s time origin t=0.

Type

array

Readout Sequence

class zhinst.toolkit.helpers.sequences.ReadoutSequence(target=<DeviceTypes.HDAWG: 'hdawg'>, clock_rate=2400000000.0, period=0.0001, trigger_mode=<TriggerMode.SEND_TRIGGER: 'Send Trigger'>, repetitions=1, alignment=<Alignment.END_WITH_TRIGGER: 'End with Trigger'>, n_HW_loop=1, dead_time=5e-06, trigger_delay=0, latency=1.6e-07, trigger_cmd_1='//', trigger_cmd_2='//', wait_cycles=0, dead_cycles=1500, reset_phase=False, readout_length=2e-06, readout_amplitudes=[1], readout_frequencies=[100000000.0], phase_shifts=[0])

Bases: zhinst.toolkit.helpers.sequences.Sequence

Predefined sequence for Multiplexed Qubit Readout.

The Readout sequence is designed for multiplexed qubit readout. It is made to work together with the Readout Channels of the UHFQA. The sequence generates a readout pulse as the sum of readout tones at different readout frequencies. The readout frequencies are given in the list parameter readout_frequencies, their amplitudes in readout_amplitudes. If the Readout sequence is configured, the integration mode is automatically set to Standard (weighted integration).

For the UHFQA the values for readout frequencies and readout amplitudes can be taken from the respective Readout Channel. If the AWG Core is configured to use the Readout sequence, upon compilation the sequence takes the values from all enabled channels. This ensures that for all channels for which a readout tone is generated, the weighted integration is also a demodulation at that readout frequency. The transfer of the corresponding values from channels to the sequence program is done before compilation or manually using update_readout_params().

>>> frequencies = [34e6, 56e6, 78e6, 90e6]
>>> amplitudes = [0.4, 0.5, 0.6, 0.7]
>>> for i, ch in enumerate(uhfqa.channels[:4]):
>>>     ch.enable()
>>>     ch.readout_frequency(frequencies[i])
>>>     ch.readout_amplitude(amplitudes[i])
>>>
>>> uhfqa.awg.set_sequence_params(
>>>     sequence_type="Readout",
>>>     readout_length=1e-6,
>>> )
>>> uhfqa.awg.update_readout_params()
>>> uhfqa.awg
qa: <zhinst.toolkit.control.drivers.uhfqa.AWG object at 0x000001BA34D978D0>
    parent  : <zhinst.toolkit.control.drivers.uhfqa.UHFQA object at 0x000001BA34D97B38>
    index   : 0
    sequence:
        type: Readout
            ('target', <DeviceTypes.UHFQA: 'uhfqa'>)
            ('clock_rate', 1800000000.0)
            ('period', 0.0001)
            ('trigger_mode', 'None')
            ('repetitions', 1)
            ('alignment', 'End with Trigger')
            ...
            ('readout_length', 2e-06)
            ('readout_amplitudes', [0.4, 0.5, 0.6, 0.7])
            ('readout_frequencies', [34000000.0, 56000000.0, 78000000.0, 90000000.0])
            ('phase_shifts', [0, 0, 0, 0])
readout_length

The duration in seconds of the readout pulse. Note that the maximum integration time for weighted integration is 4096 samples or roughly 2.3 us. (default: 2 us)

Type

double

readout_freqencies

A list of readout frequencies in Hz. These values are typically taken from the Readout Channels of the UHFQA.

Type

list

readout_amplitudes

A list of readout amplitudes (-1.0 to 1.0). These values are typically taken from the Readout Channels of the UHFQA. Note that the amplitude of each tone is always divided by the number of tones.

Type

list

phase_shifts

A list of additional phase shifts (in degrees) between the generated I and Q quadratures of each individual readout tone.

Type

list

Pulsed Spectroscopy Sequence

class zhinst.toolkit.helpers.sequences.PulsedSpectroscopySequence(target=<DeviceTypes.HDAWG: 'hdawg'>, clock_rate=2400000000.0, period=0.0001, trigger_mode=<TriggerMode.SEND_TRIGGER: 'Send Trigger'>, repetitions=1, alignment=<Alignment.END_WITH_TRIGGER: 'End with Trigger'>, n_HW_loop=1, dead_time=5e-06, trigger_delay=0, latency=1.6e-07, trigger_cmd_1='//', trigger_cmd_2='//', wait_cycles=0, dead_cycles=1500, reset_phase=False, pulse_length=2e-06, pulse_amplitude=1)

Bases: zhinst.toolkit.helpers.sequences.Sequence

Predefined Sequence for Pulsed Spectroscopy.

This sequence plays a rectangular pulse of duration pulse_length (in seconds). When this sequence is configured, the AWG output modulation of the UHFQA is enabled and the two output channels are modualted with the sine and cosine of the internal oscillator. The oscillators frequency can be set with the Parameter uhfqa.nodetree.osc.freq.

Similarly, the integration mode of the UHFQA is set to Spectroscopy to demodulate the input signals with the sine and cosine of the same internal oscillator. Note that when modulating the AWG output, the value for integration time has to be set to at least as long as the pulse duration of the modulated pulse.

>>> awg.set_sequence_params(
>>>     sequence_type="Pulsed Spectroscopy",
>>>     pulse_length=5e-6,
>>>     pulse_amplitude=0.567,
>>> )
pulse_length

The duration of the spectroscopy pulse in seconds.

Type

double

pulse_amplitude

The amplitude of the generated rectangular pulse.

Type

double

CW Spectroscopy Sequence

class zhinst.toolkit.helpers.sequences.CWSpectroscopySequence(target=<DeviceTypes.HDAWG: 'hdawg'>, clock_rate=2400000000.0, period=0.0001, trigger_mode=<TriggerMode.SEND_TRIGGER: 'Send Trigger'>, repetitions=1, alignment=<Alignment.END_WITH_TRIGGER: 'End with Trigger'>, n_HW_loop=1, dead_time=5e-06, trigger_delay=0, latency=1.6e-07, trigger_cmd_1='//', trigger_cmd_2='//', wait_cycles=0, dead_cycles=1500, reset_phase=False)

Bases: zhinst.toolkit.helpers.sequences.Sequence

Predefined sequence for Continuous-Wave Spectroscopy.

The sequence configures the direct output of the oscillator signal. There are no actual waveforms payed within the seuqence program, however, the data acquisition of the QA Results is triggered.

Trigger Sequence

class zhinst.toolkit.helpers.sequences.TriggerSequence(target=<DeviceTypes.HDAWG: 'hdawg'>, clock_rate=2400000000.0, period=0.0001, trigger_mode=<TriggerMode.SEND_TRIGGER: 'Send Trigger'>, repetitions=1, alignment=<Alignment.END_WITH_TRIGGER: 'End with Trigger'>, n_HW_loop=1, dead_time=5e-06, trigger_delay=0, latency=1.6e-07, trigger_cmd_1='//', trigger_cmd_2='//', wait_cycles=0, dead_cycles=1500, reset_phase=False)

Bases: zhinst.toolkit.helpers.sequences.Sequence

Predefined sequence for Master Trigger.

This sequence does not play any waveforms but only sends the trigger signal at the start of every period. The trigger_mode parameter will be overwritten to be ‘Send Trigger’. The trigger signal will be played on the Mark output of the lower channel.

>>> awg.set_sequence_params(
>>>     sequence_type="Trigger",
>>>     period=50e-6,
>>>     repetitions=1e3,
>>> )

Custom Sequence

class zhinst.toolkit.helpers.sequences.CustomSequence(target=<DeviceTypes.HDAWG: 'hdawg'>, clock_rate=2400000000.0, period=0.0001, trigger_mode=<TriggerMode.SEND_TRIGGER: 'Send Trigger'>, repetitions=1, alignment=<Alignment.END_WITH_TRIGGER: 'End with Trigger'>, n_HW_loop=1, dead_time=5e-06, trigger_delay=0, latency=1.6e-07, trigger_cmd_1='//', trigger_cmd_2='//', wait_cycles=0, dead_cycles=1500, reset_phase=False, path='', program='', custom_params=[])

Bases: zhinst.toolkit.helpers.sequences.Sequence

A Custom Sequence for compiling an existing .seqC program.

The Custom Sequence allows the user to specify the file path to an existing .seqC program. It needs to be located in the folder “…/Zurich Instruments/LabOne/WebServer/awg/src”.

Additionally, the Custom Sequence gives the user the ability to define variable placeholders in their .seqC program. So parameter custom_params expects a list of values that replace placeholders in the program. The placeholders are specified as special in the format “$param{i}$” where i is the index of the value in the custom_params list.

>>> awg.set_sequence_params(
>>>    path="...\Zurich Instruments\LabOne\WebServerwg\src\myProgram.seqC",
>>>    custom_params=[1000, 99, 1],
>>> )

If the specified ‘myProgram.seqC’ sequence program has placeholders “$param0$”, “$param1$”, “$param2$”, they will be replaced by “1000”, “99”, “1”.

path

The file path to a preexisting .seqC program.

Type

str

custom_params

A list of parameter values to replace placeholders in the program.

Type

list