3.3.1. qupulse.hardware.awgs

class qupulse.hardware.awgs.HDAWGChannelGroup(identifier: str, timeout: float)[source]

Bases: qupulse.hardware.awgs.base.AWG

MIN_WAVEFORM_LEN = 192
WAVEFORM_LEN_QUANTUM = 16
arm(name: Optional[str]) None[source]

Load the program ‘name’ and arm the device for running it. If name is None the awg will “dearm” its current program.

Currently hardware triggering is not implemented. The HDAWGProgramManager needs to emit code that calls waitDigTrigger to do that.

abstract property awg_group_index: int
property awg_module: zhinst.core.AwgModule

Each AWG channel group has its own awg module to manage program compilation and upload.

clear() None[source]

Removes all programs and waveforms from the AWG.

Caution: This affects all programs and waveforms on the AWG, not only those uploaded using qupulse!

connect_group(hdawg_device: qupulse.hardware.awgs.zihdawg.HDAWGRepresentation)[source]
disconnect_group()[source]

Disconnect this group from device so groups of another size can be used

is_connected() bool[source]
property master_device: qupulse.hardware.awgs.zihdawg.HDAWGRepresentation

Reference to HDAWG representation.

property num_markers: int

Number of marker channels

property programs: Set[str]

The set of program names that can currently be executed on the hardware AWG.

remove(name: str) None[source]

Remove a program from the AWG.

Also discards all waveforms referenced only by the program identified by name.

Parameters

name – The name of the program to remove.

run_current_program() None[source]

Run armed program.

property sample_rate: qupulse.utils.types.TimeType

The default sample rate of the AWG channel group.

set_volatile_parameters(program_name: str, parameters: Mapping[str, numbers.Real])[source]

Set the values of parameters which were marked as volatile on program creation.

upload(name: str, program: qupulse.program.loop.Loop, channels: Tuple[Optional[Union[str, int]], ...], markers: Tuple[Optional[Union[str, int]], ...], voltage_transformation: Tuple[Callable, ...], force: bool = False) None[source]

Upload a program to the AWG.

Physically uploads all waveforms required by the program - excluding those already present - to the device and sets up playback sequences accordingly. This method should be cheap for program already on the device and can therefore be used for syncing. Programs that are uploaded should be fast(~1 sec) to arm.

Parameters
  • name – A name for the program on the AWG.

  • program – The program (a sequence of instructions) to upload.

  • channels – Tuple of length num_channels that ChannelIDs of in the program to use. Position in the list

  • channel (in the list corresponds to the AWG) –

  • markers – List of channels in the program to use. Position in the List in the list corresponds to

  • channel

  • voltage_transformation – transformations applied to the waveforms extracted rom the program. Position

  • channel

  • force – If a different sequence is already present with the same name, it is overwritten if force is set to True. (default = False)

Known programs are handled in host memory most of the time. Only when uploading the device memory is touched at all.

Returning from setting user register in seqc can take from 50ms to 60 ms. Fluctuates heavily. Not a good way to have deterministic behaviour “setUserReg(PROG_SEL, PROG_IDLE);”.

user_register(reg: qupulse._program.seqc.UserRegister, value: Optional[int] = None) int[source]

Query user registers (1-16) and optionally set it.

Parameters
  • reg – User register. If it is an int, a warning is raised and it is interpreted as a one based index

  • value – Value to set

Returns

User Register value after setting it

was_current_program_finished() bool[source]

Return true if the current program has finished at least once

class qupulse.hardware.awgs.HDAWGRepresentation(device_serial: Optional[str] = None, device_interface: str = '1GbE', data_server_addr: str = 'localhost', data_server_port: int = 8004, api_level_number: int = 6, reset: bool = False, timeout: float = 20, grouping: Optional[qupulse.hardware.awgs.zihdawg.HDAWGChannelGrouping] = None)[source]

Bases: object

HDAWGRepresentation represents an HDAWG8 instruments and manages a LabOne data server api session. A data server must be running and the device be discoverable. Channels are per default grouped into pairs.

Parameters
  • device_serial – Device serial that uniquely identifies this device to the LabOne data server

  • device_interface – Either ‘1GbE’ for ethernet or ‘USB’

  • data_server_addr – Data server address. Must be already running. Default: localhost

  • data_server_port – Data server port. Default: 8004 for HDAWG, MF and UHF devices

  • api_level_number – Version of API to use for the session, higher number, newer. Default: 6 most recent

  • reset – Reset device before initialization

  • timeout – Timeout in seconds for uploading

__init__(device_serial: Optional[str] = None, device_interface: str = '1GbE', data_server_addr: str = 'localhost', data_server_port: int = 8004, api_level_number: int = 6, reset: bool = False, timeout: float = 20, grouping: Optional[qupulse.hardware.awgs.zihdawg.HDAWGChannelGrouping] = None) None[source]
Parameters
  • device_serial – Device serial that uniquely identifies this device to the LabOne data server

  • device_interface – Either ‘1GbE’ for ethernet or ‘USB’

  • data_server_addr – Data server address. Must be already running. Default: localhost

  • data_server_port – Data server port. Default: 8004 for HDAWG, MF and UHF devices

  • api_level_number – Version of API to use for the session, higher number, newer. Default: 6 most recent

  • reset – Reset device before initialization

  • timeout – Timeout in seconds for uploading

property api_session: zhinst.core.ziDAQServer
property channel_grouping: qupulse.hardware.awgs.zihdawg.HDAWGChannelGrouping
property channel_pair_AB: qupulse.hardware.awgs.zihdawg.HDAWGChannelGroup
property channel_pair_CD: qupulse.hardware.awgs.zihdawg.HDAWGChannelGroup
property channel_pair_EF: qupulse.hardware.awgs.zihdawg.HDAWGChannelGroup
property channel_pair_GH: qupulse.hardware.awgs.zihdawg.HDAWGChannelGroup
property channel_tuples: Tuple[qupulse.hardware.awgs.zihdawg.HDAWGChannelGroup, ...]
get_status_table()[source]

Return node tree of instrument with all important settings, as well as each channel group as tuple.

group_name(group_idx, group_size) str[source]
offset(channel: int, voltage: float = None) float[source]

Query channel offset voltage and optionally set it.

output(channel: int, status: bool = None) bool[source]

Query channel signal output status (enabled/disabled) and optionally set it. Corresponds to front LED.

range(channel: int, voltage: float = None) float[source]

Query channel voltage range and optionally set it. The instruments selects the next higher available range. This is the one-sided range Vp. Total range: -Vp…Vp

reset() None[source]
property serial: str
property waveform_file_system: qupulse._program.seqc.WaveformFileSystem
class qupulse.hardware.awgs.TaborAWGRepresentation(instr_addr=None, paranoia_level=1, external_trigger=False, reset=False, mirror_addresses=())[source]

Bases: object

Parameters
  • instr_addr – Instrument address that is forwarded to tabor_control

  • paranoia_level – Paranoia level that is forwarded to tabor_control

  • external_trigger – Not supported yet

  • reset

  • mirror_addresses

__init__(instr_addr=None, paranoia_level=1, external_trigger=False, reset=False, mirror_addresses=())[source]
Parameters
  • instr_addr – Instrument address that is forwarded to tabor_control

  • paranoia_level – Paranoia level that is forwarded to tabor_control

  • external_trigger – Not supported yet

  • reset

  • mirror_addresses

abort() None[source]
property all_devices: Sequence[tabor_control.device.TEWXAwg]
amplitude(channel) float[source]
property channel_pair_AB: qupulse.hardware.awgs.tabor.TaborChannelPair
property channel_pair_CD: qupulse.hardware.awgs.tabor.TaborChannelPair
property dev_properties: dict
download_adv_seq_table(seq_table, pref=':ASEQ:DATA', paranoia_level=None)[source]
download_segment_lengths(seg_len_list, pref=':SEGM:DATA', paranoia_level=None)[source]
download_sequencer_table(seq_table, pref=':SEQ:DATA', paranoia_level=None)[source]
enable() None[source]
get_readable_device(simulator=True) tabor_control.device.TEWXAwg[source]
get_status_table() Dict[str, Union[str, float, int]][source]

Send a lot of queries to the AWG about its settings. A good way to visualize is using pandas.DataFrame

Returns

An ordered dictionary with the results

initialize() None[source]
is_coupled() bool[source]
property is_open: bool
property main_instrument: tabor_control.device.TEWXAwg
property mirrored_instruments: Sequence[tabor_control.device.TEWXAwg]
offset(channel: int) float[source]
property paranoia_level: int
reset() None[source]
sample_rate(channel) int[source]
select_channel(channel) None[source]
select_marker(marker: int) None[source]

Select marker 1 or 2 of the currently active channel pair.

send_binary_data(pref, bin_dat, paranoia_level=None)[source]
send_cmd(cmd_str, paranoia_level=None)[source]
send_query(query_str, query_mirrors=False) Any[source]
trigger() None[source]
class qupulse.hardware.awgs.TaborChannelPair(tabor_device: qupulse.hardware.awgs.tabor.TaborAWGRepresentation, channels: Tuple[int, int], identifier: str)[source]

Bases: qupulse.hardware.awgs.base.AWG

CONFIG_MODE_PARANOIA_LEVEL = None
arm(name: str) None[source]

Implements arm().

change_armed_program(name: Optional[str]) None[source]
cleanup() None[source]

Discard all segments after the last which is still referenced

clear() None[source]

Delete all segments and clear memory

property device: qupulse.hardware.awgs.tabor.TaborAWGRepresentation
free_program(name: str) qupulse.hardware.awgs.tabor.TaborProgramMemory[source]
property internal_paranoia_level: Optional[int]
property logger
property num_channels: int

Implements num_channels.

property num_markers: int

Implements num_markers.

property programs: Set[str]

The set of program names that can currently be executed on the hardware AWG.

read_advanced_sequencer_table() Tuple[numpy.ndarray, numpy.ndarray, numpy.ndarray][source]
read_complete_program() qupulse._program.tabor.PlottableProgram[source]
read_sequence_tables() List[Tuple[numpy.ndarray, numpy.ndarray, numpy.ndarray]][source]
read_waveforms() List[numpy.ndarray][source]
remove(name: str) None[source]

Remove a program from the AWG.

Also discards all waveforms referenced only by the program identified by name.

Parameters

name (str) – The name of the program to remove.

run_current_program() None[source]
property sample_rate: float

Implements sample_rate.

select() None[source]
set_channel_state(channel, active) None[source]
set_marker_state(marker: int, active: bool) None[source]

Sets the marker state of this channel pair. According to the manual one cannot turn them off/on separately.

set_program_advanced_sequence_table(name, new_advanced_sequence_table)[source]
set_program_sequence_table(name, new_sequence_table)[source]
set_volatile_parameters(program_name: str, parameters: Mapping[str, numbers.Number]) None[source]

Set the values of parameters which were marked as volatile on program creation. Sets volatile parameters in program memory and device’s (adv.) sequence tables if program is current program.

If set_volatile_parameters needs to run faster, set CONFIG_MODE_PARANOIA_LEVEL to 0 which causes the device to enter the configuration mode with paranoia level 0 (Note: paranoia level 0 does not work for the simulator) and set device._is_coupled.

Parameters
  • program_name – Name of program which should be changed.

  • parameters – Names of volatile parameters and respective values to which they should be set.

property total_capacity: int
upload(name: str, program: qupulse.program.loop.Loop, channels: Tuple[Optional[Union[str, int]], Optional[Union[str, int]]], markers: Tuple[Optional[Union[str, int]], Optional[Union[str, int]]], voltage_transformation: Tuple[Callable, Callable], force: bool = False) None[source]

Upload a program to the AWG.

The policy is to prefer amending the unknown waveforms to overwriting old ones.

class qupulse.hardware.awgs.TektronixAWG(device: tek_awg.TekAwg, synchronize: str, identifier='Tektronix', logger=None, default_program_repetition_mode='once', idle_waveform_length=250)[source]

Bases: qupulse.hardware.awgs.base.AWG

Driver for Tektronix AWG object (5000/7000 series).

Special characteristics:
  • Changing the run mode to ‘running’ takes a lot of time (depending on the sequence)

  • To keep the “arm” time low each program is uploaded to the sequence table! This reduces the number of programs drastically but allows very fast switching with arm IF the awg runs.

  • Arm starts the awg if it does not run. The first call to arm after uploading new programs is therefore slow. This guarantees that subsequent calls to arm and run_current_program are always fast.

  • Uploading while the awg runs is VERY slow. The private properties _allow_upload_while_running and _auto_stop_on_upload control the behaviour in this case (stopping the awg or raising an exception). These properties are currently not a stable interface to that functionality hence the privateness.

This driver implements an interface for changing the program repetition mode consisting of:
  • the property default_program_repetition_mode

  • set_program_repetition_mode(program_name, mode)

  • get_program_repetition_mode(program_name)

Synchronization: The driver relies on the fact that internal variables correspond to the device state: _sequence_entries and _waveforms We do not aim to detect user manipulation but want to make sure invalidate the internal state on upload errors. To do this the attribute _synchronized is set to False. Methods that rely on the synchronization state to correctly modify the awg check that attribute.

All private functions assume that the error queue is empty when called.

TODO: Move logger and repetition mode functionality to AWG interface

Parameters
  • device – Instance of the underlying driver from tek_awg package

  • synchronize – Either ‘read’ or ‘clear’.

  • identifier – Some identifier

  • logger – Logging will happen here (defaults to ‘qupulse.tektronix’ otherwise)

  • default_program_repetition_mode – ‘once’ or ‘infinite’

  • idle_waveform_length – length of the idle_waveform in samples

__init__(device: tek_awg.TekAwg, synchronize: str, identifier='Tektronix', logger=None, default_program_repetition_mode='once', idle_waveform_length=250)[source]
Parameters
  • device – Instance of the underlying driver from tek_awg package

  • synchronize – Either ‘read’ or ‘clear’.

  • identifier – Some identifier

  • logger – Logging will happen here (defaults to ‘qupulse.tektronix’ otherwise)

  • default_program_repetition_mode – ‘once’ or ‘infinite’

  • idle_waveform_length – length of the idle_waveform in samples

arm(name: Optional[str])[source]

Arming starts the awg

property armed_program: Optional[str]
assert_synchronized()[source]
cleanup()[source]

Delete all waveforms not used anymore and rewrite sequence entries if they are fragmented

clear()[source]

Clear all waveforms, the sequence table and program registry and initialize the idle program.

property default_program_repetition_mode: str

repetition mode for newly uploaded programs. Valid values are ‘once’ and ‘infinite’. You can use set_program_repetition_mode to change the repetition mode of an existing program

property device: tek_awg.TekAwg
get_program_information() Dict[str, dict][source]
get_program_repetition_mode(program_name: str) str[source]

This function uses cached data and does not talk to the awg

static idle_pulse_name(idle_length: int) str[source]
initialize_idle_program()[source]

Make sure we can arm the idle program which plays the idle waveform(default 0V) on all channels.

make_idle_waveform(length) tek_awg.Waveform[source]
property num_channels: int

Implements num_channels.

property num_markers: int

Implements num_markers.

property programs: Set[str]

Implements programs.

read_waveforms()[source]

Read all waveform data from the device (including binary data).

remove(name: str)[source]

Implements remove().

run_current_program(channel_states: Optional[Tuple[bool, bool, bool, bool]] = None)[source]

Runs the currentlz armed program

Parameters

channel_states – If given the channel states are set to these values

Returns:

property sample_rate: float

Implements sample_rate.

set_program_repetition_mode(program_name: str, mode: str)[source]
set_volatile_parameters(program_name: str, parameters)[source]

Implements set_volatile_parameters().

synchronize()[source]

Read waveforms from device and re-upload all programs

property synchronized: bool
upload(*args, **kwargs)[source]

Implements upload().

warn_if_errors_are_present()[source]

Emit a warning with present errors.

Modules

qupulse.hardware.awgs.base

This module defines the common interface for arbitrary waveform generators.

qupulse.hardware.awgs.tabor

qupulse.hardware.awgs.tektronix

qupulse.hardware.awgs.zihdawg