qmi.instruments.tektronix.awg5014

QMI Instrument driver for the Tektronix’s AWG 5014 arbitrary waveform generator.

Classes

Tektronix_Awg5014(context, name, transport)

QMI Instrument driver for the Tektronix AWG5014 Arbitrary Waveform Generator.

class qmi.instruments.tektronix.awg5014.Tektronix_Awg5014(context: QMI_Context, name: str, transport: str)

QMI Instrument driver for the Tektronix AWG5014 Arbitrary Waveform Generator.

open() None

Open the connection to the instrument.

close() None

Close the connection to the instrument.

wait_and_clear() None

Wait and clear (responses of) previous command(s).

wait_command_completion() None

Wait completion of previous command.

reset() None

Resets the instrument to default values. In practise, it was seen that *CLS does not clear the memory as intended for stale responses. By making this as a query with discarding data in transport buffer, it clears up possible delayed response(s) from the scpi_protocol.

get_error() None

Allow client to poll for errors. Any errors will be raised as exceptions.

Raises:

QMI_InstrumentException with any error code other than 0.

get_state() str

Queries the instrument state. Possible responses are 0: IDLE, 1: WAIT_FOR_TRIGGER, 2: RUNNING.

Returns:

Instrument state translated from dictionary.

get_setup_file_name() Tuple[str, str]
Returns the current setup file name of the arbitrary waveform generator.

The response contains the full path for the file including the disk drive. Example: ‘”myprojectawgsetupa1.awg”,”D:”’

Returns:

File path and name, e.g. (”UsersOEMDocuments”, “newAWGfile.awg”).

Return type:

tuple

get_file_names() List[str]

Get a string with a list of file names from instrument.

Returns:

List [<file name>,<file type>,<file size>]*n for n files.

get_directories() List[str]

Return the directory contents from memory.

Returns:

List [<dir name>]*n for n directories.

get_current_directory_name() str

Return the current directory name from memory.

Returns:

Current directory name.

change_directory(cd: str) None

Change the current directory.

Parameters:

cd – The new directory to cd to, in form “DIR1DIR2” or “C:DIR1DIR2” or “..” etc.

cd_to_root() None

Change directory to root.

create_directory(new_dir: str) None

Create a new subdirectory in the current directory.

Parameters:

new_dir – The new directory name

remove_directory(del_dir: str) None

Remove a subdirectory in the current directory.

Parameters:

del_dir – The deletable directory name

send_awg_file(file_name: str, awg_file_block_data: bytes) None

This command creates a file on the AWG from the input block data. The file is created with the given name into the current directory the AWG files system is on. The waveform data should be in integers (-1, 0, 1) as only this format is currently supported. Floats could be needed when one needs to have correct waveform when waveform contains more than (-1, 0, 1) (+/-peak and 0) values. Using integer format is faster. Note that the “MMEM[ory]:DATA has a limit of 650 000 000 bytes of data.

From the “AWG5000 and AWG7000 Series Arbitrary Waveform Generators Programmer Manual”, table 2-4, data block is explained as string:

#512234xxxxx… where 5 indicates that the following 5 digits (12234) specify the length of the data in bytes; xxxxx… indicates actual data or #0xxxxx…<LF><&EOI>.

As this command is slow with large AWG files, successive command calls without waiting for the sending to complete can cause errors. Therefore, it is recommended to call wait_command_completion after this command.

Parameters:
  • file_name – The file name, e.g. “newAWGfile.awg”.

  • awg_file_block_data – Block data for the file in bytes, should be sum of values of io.BytesIO objects headers + channel records + waveform records + sequence records. Currently only integer format.

load_awg_file(file_name: str) None

This command shall load the given .awg file into the AWG memory. Note that it will also overwrite all the current instrument settings with the values in the file.

As this command is slow with large AWG files, successive command calls without waiting for the upload to complete can cause errors. Therefore, it is recommended to call wait_command_completion after this command.

Parameters:

file_name – The file name, e.g. “newAWGfile.awg”.

remove_file(del_file: str) None

Remove a file in the current directory.

Parameters:

del_file – The deletable file name

clear_waveforms() None

Clears the waveforms on all channels by settings the waveform files to be ‘’ (empty string).

delete_all_waveforms_from_list() None

Deletes all waveforms from memory list.

start() None

Initiates the output of a waveform or a sequence.

As this command can run for a relatively long time, successive command calls can cause errors. Therefore, it is recommended to call wait_command_completion after this command.

stop() None

Stops the output of a waveform or a sequence.

get_clock_source() str

Query the AWG whether the 10MHz is set to the internal or external source.

Returns:

“INT” or “EXT”

set_clock_to_internal() None

Set the clock source to be internal.

set_clock_to_external() None

Set the clock source to be external.

get_reference_oscillator_source() str

Query the AWG whether the 10MHz reference is set to the internal or external source.

Returns:

“INT” or “EXT”

set_reference_oscillator_to_internal() None

Set the 10MHz reference source to be internal.

set_reference_oscillator_to_external() None

Set the 10MHz reference source to be external.

get_reference_oscillator_type() str

Query the type of the reference oscillator.

Returns:

Reference oscillator type.

set_reference_oscillator_type(type: str) None

Set the reference oscillator type to fixed or variable.

Parameters:

"VAR"] (Reference oscillator type ["FIX" or)

get_reference_clock_frequency() float

Query the reference clock frequency.

Returns:

The reference clock frequency in Hertz. Possible values 1E7, 2E7, 1E8.

set_reference_clock_frequency(frequency: float) None

Set the reference clock frequency. The possible values are 10, 20 and 100 MHz.

Parameters:

frequency – The new reference clock frequency in Hertz.

get_source_clock_frequency() float

Query the source clock frequency.

Returns:

The source clock frequency in Hertz.

set_source_clock_frequency(frequency: float) None

Set the source clock frequency. This will work either if “INT” is selected as reference source or reference source is set as “EXT” and reference type as “FIX”.

Parameters:

frequency – The new source clock frequency in Hertz.

get_amplitude(channel: int) float

Get the signal amplitude of a waveform associated with specific channel.

Parameters:

channel – The channel number [1-4].

Returns:

The peak-to-peak signal amplitude in Volts.

set_amplitude(channel: int, amplitude: float) None

Set the signal amplitude for a waveform associated with specific channel.

Parameters:
  • channel – The channel number [1-4].

  • amplitude – The target amplitude voltage (peak-to-peak).

get_offset(channel: int) float

Get the offset of a specific source channel.

Parameters:

channel – The channel number [1-4].

Returns:

The offset in Volts.

set_offset(channel: int, offset: float) None

Set the offset of a specific source channel.

Parameters:
  • channel – The channel number [1-4].

  • offset – The offset in Volts

get_dc_output_state() int

Query if DC output state is ‘on’ or ‘off’. The state is equal to all four DC outputs.

Returns:

DC state with 0 as ‘off’ and 1 as ‘on’.

set_dc_output_state(state: int) None

Set DC state as ‘on’ or ‘off’. The command sets the same state for all four DC outputs.

Parameters:

state – DC state with 0 as ‘off’ and 1 as ‘on’.

get_dc_output_offset(output: int) float

Get a DC output voltage offset.

Parameters:

output – DC output number in range [1-4].

Returns:

The offset in Volts.

set_dc_output_offset(output: int, offset: float) None

Set a DC output voltage offset.

Parameters:
  • output – DC output number in range [1-4].

  • offset – The offset in Volts, should be between [-3.0V-+5.0V].

get_raw_dac_waveform_output(channel: int) int

Get raw DAC waveform output channel state.

Parameters:

channel – DAC output channel number in range [1-4].

Returns:

Channel state with 0 as ‘disabled’ and 1 as ‘enabled’.

set_raw_dac_waveform_output(channel: int, state: int) None

Set raw DAC waveform output channel state. Channel state with 0 as ‘disabled’ and 1 as ‘enabled’.

Parameters:
  • channel – DAC output channel number in range [1-4].

  • state – Channel state with 0 as ‘disabled’ and 1 as ‘enabled’.

get_run_mode() str

Get the current run mode.

Returns:

The run mode.

Return type:

mode

set_run_mode_to_triggered() None

Set the run mode to TRIGgered.

set_run_mode_to_continuous() None

Set the run mode to CONTinuous.

set_run_mode(run_mode: str) None

Set new run mode.

Parameters:

run_mode – new run mode. Must be one of ‘CONT’, ‘TRIG’, ‘SEQ’ or ‘GAT’. Also ‘ENH’ is possible for compatibility reasons with other model series. ‘ENH’ is equal to ‘SEQ’.

get_signal_addition() str

Query the signal addition from external input state.

Returns:

The signal addition state. “ESIG” for enabled, “” for disabled.

set_signal_addition(state: str) None

Set the signal addition from external input state.

Parameters:

state – The signal addition state. “ESIG” for enabled, “” for disabled.

get_trigger_source() str

Query the current trigger source.

set_trigger_source_to_internal() None

Set the trigger source to INTernal.

set_trigger_source_to_external() None

Set the trigger source to EXTernal.

get_trigger_impedance() int

Get the current external trigger impedance in Ohm.

Returns:

Trigger impedance value.

set_trigger_impedance(impedance: int = 1000) None

Sets the EXTERNAL trigger impedance to given value. Default value is 1000 Ohm. 50 Ohm is for the external trigger input.

Parameters:

impedance – The trigger impedance in Ohm. Possible values are 50 and 1000.

get_trigger_level() float

Get current trigger level in Volts.

Returns:

Current trigger level.

set_trigger_level(trigger_level: float) None

Set a new trigger level. The value is rounded to 3 significant decimals.

Parameters:

trigger_level – The new trigger level in Volts.

get_trigger_slope() str

Get trigger slope sign.

Returns:

Trigger slope sign as “POS” or “NEG”.

set_trigger_slope(slope: str) None

Set trigger slope sign.

Parameters:
  • for (Trigger slope sign as string "POS" or "POSitive" for positive slope and "NEG" or "NEGative")

  • slope. (negative)

get_trigger_polarity() str

Get trigger polarity sign.

Returns:

Trigger polarity sign as “POS” or “NEG”.

set_trigger_polarity(polarity: str) None

Set trigger polarity sign.

Parameters:

polarity – Trigger polarity sign as string “POS” or “POSitive” for positive polarity and “NEG” or “NEGative” for negative polarity.

get_waveform_output_data_position() str

Query The output data position of a waveform while the instrument is in the waiting-for-trigger state. This is valid only when Run Mode is Triggered or Gated.

Returns:

Waveform output data position as “FIRS” or “LAST”.

set_waveform_output_data_position(position: str) None

This command sets the output data position of a waveform. This is valid only when Run Mode is Triggered or Gated.

Parameters:

position – Sets a position of a waveform as the output level. Possible values are “FIRS[t]” and “LAST”.

force_trigger_event() None

Generate a trigger event.

get_channel_state(channel: int) bool

Query if a channel is ‘on’ or ‘off.

Parameters:

channel – Channel number in range [1-4].

Returns:

The channel state with False if ‘off’ and True if ‘on’.

set_channel_state(channel: int, state: bool) None

Set a channel state ‘on’ or ‘off.

Parameters:
  • channel – Channel number in range [1-4].

  • state – The new channel state with False if ‘off’ and True if ‘on’.

get_low_pass_filter_frequency(channel: int) float

Query low-pass filter frequency of an output channel.

Parameters:

channel – Channel number in range [1-4].

Returns:

The output channel filter frequency in MHz (9.9e37 at INFinity).

set_low_pass_filter_frequency(channel: int, frequency: float | str) None

Set a low-pass filter frequency of an output channel frequency.

Parameters:
  • channel – Channel number in range [1-4].

  • frequency – The new channel frequency in Hertz. Or “INF”.

get_sequence_length() int

Get sequence length.

Returns:

The sequence length.

set_sequence_length(length: int) None

Set sequence length. Note: length 0 will delete the sequence.

Parameters:

length – The sequence length.

get_sequencer_type() str

Get the sequencer type to see if instrument is in hardware or software sequencer mode.

Returns:

Sequencer type, either “HARD” or “SOFT”.

get_sequencer_position() int

Get the sequencer position.

Returns:

Sequencer position.

set_sequence_element_goto_target_index(element_no: int, index_no: int) None

Set target ‘GOTO’ index of a sequencer element. Note: First element is 1:

Parameters:
  • element_no – Element number.

  • index_no – Target goto index number.

set_sequence_element_goto_state(element_no: int, goto_state: int) None

Set ‘GOTO’ state for a sequencer element.

Parameters:
  • element_no – Element number.

  • goto_state – New ‘GOTO’ state. 0 is ‘off’ and 1 is ‘on’.

get_sequence_element_loop_count_infinite_state(element_no: int) bool

Query the loop count infinity state of a sequencer element.

Parameters:

element_no – Element number.

Returns:

boolean, if the loop count to inf is ‘on’ = True or ‘off’ = False.

set_sequence_element_loop_count_infinite_state(element_no: int, on: bool = True) None

Set the loop count to infinity state for a sequencer element. Can be ‘on’ or ‘off’.

Parameters:
  • element_no – Element number.

  • on – boolean to set loop count to inf ‘on’ (True) or ‘off’ (False).

get_sequence_element_loop_count(element_no: int) int

Get the loop count from a sequencer element.

Parameters:

element_no – Element number.

Returns:

Sequence element loop count.

set_sequence_element_loop_count(element_no: int, loop_count: int) None

Set the loop count to given value for a sequencer element.

Parameters:
  • element_no – Element number.

  • loop_count – The new loop count value in the range of [1, 65536]

get_sequence_element_trigger_wait_state(element_no: int) int

Get trigger wait state from a sequence element.

Parameters:

element_no – Element number.

Returns:

The sequence element trigger wait state. 0 for ‘off’, 1 for ‘on’.

set_sequence_element_trigger_wait_state(element_no: int, state: int) None

Set trigger wait value state for a sequence element.

Parameters:
  • element_no – Element number.

  • state – Trigger wait state. 0 for ‘off’, 1 for ‘on’.

get_sequence_element_waveform(element_no: int, channel: int) str

Get waveform from a sequence element channel.

Parameters:
  • element_no – Element number.

  • channel – Channel number.

Returns:

The waveform type of the sequence element channel.

set_sequence_element_waveform(element_no: int, channel: int, waveform: str) None

Set waveform for a sequence element channel.

Parameters:
  • element_no – Element number.

  • channel – Channel number.

  • waveform – Waveform type.

force_sequence_jump_to_index(jump_index_no: int) None

Force sequence to jump to given index immediately.

Parameters:

jump_index_no – Target index number to jump to.

set_sequence_element_jump_target_index(element_no: int, jump_target_index: int) None

Set sequence element event jump target index.

Parameters:
  • element_no – Element number.

  • jump_target_index – The target index number.

get_sequence_element_jump_type(element_no: int) str

Get sequence element event jump type.

Parameters:

element_no – Element number.

Returns:

The jump type.

set_sequence_element_jump_type(element_no: int, jump_type: str) None

Set sequence element event jump type.

Parameters:
  • element_no – Element number.

  • jump_type – The new jump type. Valid values are ‘IND’, ‘NEXT’, and ‘OFF’.

get_sequence_jump_mode() str

Queries the sequence jump mode.

Returns:

Jump mode.

set_sequence_jump_mode(jump_mode: str) None

Set the sequence jump mode.

Parameters:

jump_mode – The jump mode, valid values are “LOG”, “TABL” and “SOFT”.

get_jump_target_definition(pattern: int) int

Queries the dynamic jump target associated to specified event pattern.

Parameters:

pattern – The event pattern in range [0-511].

Returns:

The sequence index number associated to the event pattern.

set_jump_target_definition(pattern: int, jump_target: int) str

Queries the dynamic jump target associated to specified event pattern.

Parameters:
  • pattern – The event pattern in range [0-511].

  • jump_target – The target sequence index value, allowed values are [-1-511].

Returns:

The dynamic jump target associated to the event pattern.

get_event_jump_mode() str

Get event jump mode.

Returns:

The event jump mode.

set_event_jump_mode(jump_mode: str) None

Set the event jump mode.

Parameters:

jump_mode – The event jump mode, e.g. DJUMP, EJUMP.

get_event_jump_timing_mode() str

Get event jump timing mode.

Returns:

Event jump timing mode.

set_event_jump_timing_mode(mode: str) None

Set event jump timing mode to synchronous or to asynchronous.

Parameters:

"ASYN" (Event jump timing mode. Valid modes are "SYNC" and)

get_event_input_impedance() int

Get external event input impedance.

Returns:

Impedance in Ohm. Possible values are 50 and 1000.

set_event_input_impedance(impedance: int) None

Set external event input impedance.

Parameters:

1000. (Impedance in Ohm. Possible values are 50 and)

get_event_input_polarity() str

Get event input polarity sign.

Returns:

Event input polarity sign as “POS” or “NEG”.

set_event_input_polarity(polarity: str) None

Set event input polarity sign.

Parameters:
  • for (Event input polarity sign as string "POS" or "POSitive" for positive polarity and "NEG" or "NEGative")

  • polarity. (negative)

get_event_level() float

Get the event level voltage.

Returns:

The event level in Volts.

set_event_level(level: float) None

Set the event level voltage.

Parameters:

level – The target level voltage.

get_marker_low(channel: int, marker: int) float

Get the low level for a marker of a specific source channel.

Parameters:
  • channel – The channel number [1-4].

  • marker – The marker number [1-2].

Returns:

The low level in Volts.

set_marker_low(channel: int, marker: int, low_level: float) None

Set the low level for a marker of a specific source channel.

Parameters:
  • channel – The channel number [1-4].

  • marker – The marker number [1-2].

  • low_level – The low level in Volts.

get_marker_high(channel: int, marker: int) float

Get the high level for a marker of a specific source channel.

Parameters:
  • channel – The channel number [1-4].

  • marker – The marker number [1-2].

Returns:

The high level in Volts.

set_marker_high(channel: int, marker: int, high_level: float) None

Set the high level for a marker of a specific source channel.

Parameters:
  • channel – The channel number [1-4].

  • marker – The marker number [1-2].

  • high_level – The high level in Volts.

get_marker_delay(channel: int, marker: int) float

Query a marker delay of a specific source channel.

Parameters:
  • channel – The channel number [1-4].

  • marker – The marker number [1-2].

Returns:

The delay in seconds.

set_marker_delay(channel: int, marker: int, delay: float) None

Set a marker delay of a specific source channel.

Parameters:
  • channel – The channel number [1-4].

  • marker – The marker number [1-2].

  • delay – The delay in seconds.

force_unlock() None

Forcefully unlock the remote object.

This unlocks the object, regardless of who owns the lock. This allows you to unlock an object if the locking proxy has been destroyed without unlocking.

Use this with care.

Do not override this stub method in subclasses. It has already been implemented in QMI_RpcProxy.

classmethod get_category() str | None

Return the optional name of the category this object belongs to.

A category name is a free-form string that has no special significance. Its purpose is to distinguish between groups of RPC objects that fulfill similar roles.

get_name() str

Return the name of this object.

Returns:

name attribute.

get_signals() list[SignalDescription]

Return a list of signals that can be published by this object.

Returns:

List consisting of qmi_signals attributes.

is_locked() bool

Query if the remote object is locked.

Do not override this stub method in subclasses. It has already been implemented in QMI_RpcProxy.

is_open() bool

Return True if the instrument is open (ready for interaction).

lock(timeout: float = 0.0, lock_token: str | None = None) bool

Lock the remote object. If timeout is given, try every 0.1s within the given timeout value. The remote object can be locked with an optional custom lock token by giving a string into lock_token keyword argument.

If successful, this proxy is the only proxy that can invoke RPC methods on the remote object; other proxies will receive an “object is locked” response. The return value indicates if the lock was granted; a denied lock means the object was already locked by another proxy.

Do not override this stub method in subclasses. It has already been implemented in QMI_RpcProxy.

release_rpc_object() None

Give a warning if the instrument is removed while still open.

unlock(lock_token: str | None = None) bool

Unlock the remote object.

Without optional parameters, this is only allowed by the proxy that initially locked the object. By giving the lock token as an input parameter, the specific object locked by this token can be unlocked. The return value indicates if the unlocking was successful.

Do not override this stub method in subclasses. It has already been implemented in QMI_RpcProxy.