qcodes.instrument_drivers.tektronix package

Submodules

qcodes.instrument_drivers.tektronix.AWG5014 module

class qcodes.instrument_drivers.tektronix.AWG5014.Tektronix_AWG5014(name: str, address: str, timeout: int = 180, num_channels: int = 4, **kwargs: Any)[source]

Bases: qcodes.instrument.visa.VisaInstrument

This is the QCoDeS driver for the Tektronix AWG5014 Arbitrary Waveform Generator.

The driver makes some assumptions on the settings of the instrument:

  • The output channels are always in Amplitude/Offset mode

  • The output markers are always in High/Low mode

Todo

  • Implement support for cable transfer function compensation

  • Implement more instrument functionality in the driver

  • Remove double functionality

  • Remove inconsistensies between the name of a parameter and the name of the same variable in the tektronix manual

In the future, we should consider the following:

  • Removing test_send??

  • That sequence element (SQEL) parameter functions exist but no corresponding parameters.

Initializes the AWG5014.

Parameters
  • name – name of the instrument

  • address – GPIB or ethernet address as used by VISA

  • timeout – visa timeout, in secs. long default (180) to accommodate large waveforms

  • num_channels – number of channels on the device

AWG_FILE_FORMAT_HEAD = {'CLOCK_SOURCE': 'h', 'COUPLING': 'h', 'DIVIDER_RATE': 'h', 'EVENT_INPUT_IMPEDANCE': 'h', 'EVENT_INPUT_POLARITY': 'h', 'EVENT_INPUT_THRESHOLD': 'd', 'EXTERNAL_REFERENCE_TYPE': 'h', 'HOLD_REPETITION_RATE': 'h', 'INTERLEAVE': 'h', 'INTERLEAVE_ADJ_AMPLITUDE': 'd', 'INTERLEAVE_ADJ_PHASE': 'd', 'INTERNAL_TRIGGER_RATE': 'd', 'JUMP_TIMING': 'h', 'REFERENCE_CLOCK_FREQUENCY_SELECTION': 'h', 'REFERENCE_MULTIPLIER_RATE': 'h', 'REFERENCE_SOURCE': 'h', 'REPETITION_RATE': 'd', 'RUN_MODE': 'h', 'RUN_STATE': 'h', 'SAMPLING_RATE': 'd', 'TRIGGER_INPUT_IMPEDANCE': 'h', 'TRIGGER_INPUT_POLARITY': 'h', 'TRIGGER_INPUT_SLOPE': 'h', 'TRIGGER_INPUT_THRESHOLD': 'd', 'TRIGGER_SOURCE': 'h', 'WAIT_VALUE': 'h', 'ZEROING': 'h'}
AWG_FILE_FORMAT_CHANNEL = {'ANALOG_AMPLITUDE_N': 'd', 'ANALOG_DIRECT_OUTPUT_N': 'h', 'ANALOG_FILTER_N': 'h', 'ANALOG_HIGH_N': 'd', 'ANALOG_LOW_N': 'd', 'ANALOG_METHOD_N': 'h', 'ANALOG_OFFSET_N': 'd', 'CHANNEL_SKEW_N': 'd', 'CHANNEL_STATE_N': 'h', 'DC_OUTPUT_LEVEL_N': 'd', 'DELAY_IN_POINTS_N': 'd', 'DELAY_IN_TIME_N': 'd', 'DIGITAL_AMPLITUDE_N': 'd', 'DIGITAL_HIGH_N': 'd', 'DIGITAL_LOW_N': 'd', 'DIGITAL_METHOD_N': 'h', 'DIGITAL_OFFSET_N': 'd', 'EXTERNAL_ADD_N': 'h', 'MARKER1_AMPLITUDE_N': 'd', 'MARKER1_HIGH_N': 'd', 'MARKER1_LOW_N': 'd', 'MARKER1_METHOD_N': 'h', 'MARKER1_OFFSET_N': 'd', 'MARKER1_SKEW_N': 'd', 'MARKER2_AMPLITUDE_N': 'd', 'MARKER2_HIGH_N': 'd', 'MARKER2_LOW_N': 'd', 'MARKER2_METHOD_N': 'h', 'MARKER2_OFFSET_N': 'd', 'MARKER2_SKEW_N': 'd', 'OUTPUT_WAVEFORM_NAME_N': 's', 'PHASE_DELAY_INPUT_METHOD_N': 'h', 'PHASE_N': 'd'}
newlinestripper(string: str) str[source]
get_state() typing_extensions.Literal[Idle, Waiting for trigger, Running][source]

This query returns the run state of the arbitrary waveform generator or the sequencer.

Returns

Either ‘Idle’, ‘Waiting for trigger’, or ‘Running’.

Raises

ValueError – if none of the three states above apply.

start() str[source]

Convenience function, identical to self.run()

run() str[source]

This command initiates the output of a waveform or a sequence. This is equivalent to pressing Run/Stop button on the front panel. The instrument can be put in the run state only when output waveforms are assigned to channels.

Returns

The output of self.get_state()

stop() None[source]

This command stops the output of a waveform or a sequence.

force_trigger() None[source]

This command generates a trigger event. This is equivalent to pressing the Force Trigger button on front panel.

get_folder_contents(print_contents: bool = True) str[source]

This query returns the current contents and state of the mass storage media (on the AWG Windows machine).

Parameters

print_contents – If True, the folder name and the query output are printed. Default: True.

Returns

A comma-seperated string of the folder contents.

Return type

str

get_current_folder_name() str[source]

This query returns the current directory of the file system on the arbitrary waveform generator. The current directory for the programmatic interface is different from the currently selected directory in the Windows Explorer on the instrument.

Returns

A string with the full path of the current folder.

set_current_folder_name(file_path: str) int[source]

Set the current directory of the file system on the arbitrary waveform generator. The current directory for the programmatic interface is different from the currently selected directory in the Windows Explorer on the instrument.

Parameters

file_path – The full path.

Returns

The number of bytes written to instrument

change_folder(folder: str) int[source]

Duplicate of self.set_current_folder_name

goto_root() None[source]

Set the current directory of the file system on the arbitrary waveform generator to C: (the ‘root’ location in Windows).

create_and_goto_dir(folder: str) str[source]

Set the current directory of the file system on the arbitrary waveform generator. Creates the directory if if doesn’t exist. Queries the resulting folder for its contents.

Parameters

folder – The path of the directory to set as current. Note: this function expects only root level directories.

Returns

A comma-seperated string of the folder contents.

all_channels_on() None[source]

Set the state of all channels to be ON. Note: only channels with defined waveforms can be ON.

all_channels_off() None[source]

Set the state of all channels to be OFF.

force_trigger_event() None[source]

This command generates a trigger event. Equivalent to self.force_trigger.

force_event() None[source]

This command generates a forced event. This is used to generate the event when the sequence is waiting for an event jump. This is equivalent to pressing the Force Event button on the front panel of the instrument.

set_sqel_event_target_index(element_no: int, index: int) None[source]

This command sets the target index for the sequencer’s event jump operation. Note that this will take effect only when the event jump target type is set to INDEX.

Parameters
  • element_no – The sequence element number

  • index – The index to set the target to

set_sqel_goto_target_index(element_no: int, goto_to_index_no: int) None[source]

This command sets the target index for the GOTO command of the sequencer. After generating the waveform specified in a sequence element, the sequencer jumps to the element specified as GOTO target. This is an unconditional jump. If GOTO target is not specified, the sequencer simply moves on to the next element. If the Loop Count is Infinite, the GOTO target which is specified in the element is not used. For this command to work, the goto state of the squencer must be ON and the sequence element must exist. Note that the first element of a sequence is taken to be 1 not 0.

Parameters
  • element_no – The sequence element number

  • goto_to_index_no – The target index number

set_sqel_goto_state(element_no: int, goto_state: int) None[source]

This command sets the GOTO state of the sequencer for the specified sequence element.

Parameters
  • element_no – The sequence element number

  • goto_state – The GOTO state of the sequencer. Must be either 0 (OFF) or 1 (ON).

set_sqel_loopcnt_to_inf(element_no: int, state: int = 1) None[source]

This command sets the infinite looping state for a sequence element. When an infinite loop is set on an element, the sequencer continuously executes that element. To break the infinite loop, issue self.stop()

Parameters
  • element_no (int) – The sequence element number

  • state (int) – The infinite loop state. Must be either 0 (OFF) or 1 (ON).

get_sqel_loopcnt(element_no: int = 1) str[source]

This query returns the loop count (number of repetitions) of a sequence element. Loop count setting for an element is ignored if the infinite looping state is set to ON.

Parameters

element_no – The sequence element number. Default: 1.

set_sqel_loopcnt(loopcount: int, element_no: int = 1) None[source]

This command sets the loop count. Loop count setting for an element is ignored if the infinite looping state is set to ON.

Parameters
  • loopcount – The number of times the sequence is being output. The maximal possible number is 65536, beyond that: infinity.

  • element_no – The sequence element number. Default: 1.

set_sqel_waveform(waveform_name: str, channel: int, element_no: int = 1) None[source]

This command sets the waveform for a sequence element on the specified channel.

Parameters
  • waveform_name – Name of the waveform. Must be in the waveform list (either User Defined or Predefined).

  • channel – The output channel (1-4)

  • element_no – The sequence element number. Default: 1.

get_sqel_waveform(channel: int, element_no: int = 1) str[source]

This query returns the waveform for a sequence element on the specified channel.

Parameters
  • channel – The output channel (1-4)

  • element_no – The sequence element number. Default: 1.

Returns

The name of the waveform.

set_sqel_trigger_wait(element_no: int, state: int = 1) str[source]

This command sets the wait trigger state for an element. Send a trigger signal in one of the following ways:

  • By using an external trigger signal.

  • By pressing the “Force Trigger” button on the front panel

  • By using self.force_trigger or self.force_trigger_event

Parameters
  • element_no – The sequence element number.

  • state – The wait trigger state. Must be either 0 (OFF) or 1 (ON). Default: 1.

Returns

The current state (after setting it).

get_sqel_trigger_wait(element_no: int) str[source]

This query returns the wait trigger state for an element. Send a trigger signal in one of the following ways:

  • By using an external trigger signal.

  • By pressing the “Force Trigger” button on the front panel

  • By using self.force_trigger or self.force_trigger_event

Parameters

element_no – The sequence element number.

Returns

‘1’.

Return type

The current state. Example

set_sqel_event_jump_target_index(element_no: int, jtar_index_no: int) None[source]

Duplicate of set_sqel_event_target_index

set_sqel_event_jump_type(element_no: int, jtar_state: str) None[source]

This command sets the event jump target type for the jump for the specified sequence element. Generate an event in one of the following ways:

  • By connecting an external cable to instrument rear panel for external event.

  • By pressing the Force Event button on the front panel.

  • By using self.force_event

Parameters
  • element_no – The sequence element number

  • jtar_state – The jump target type. Must be either ‘INDEX’, ‘NEXT’, or ‘OFF’.

get_sq_mode() str[source]

This query returns the type of the arbitrary waveform generator’s sequencer. The sequence is executed by the hardware sequencer whenever possible.

Returns

Either ‘HARD’ or ‘SOFT’ indicating that the instrument is in either hardware or software sequencer mode.

Return type

str

generate_sequence_cfg() Dict[str, float][source]

This function is used to generate a config file, that is used when generating sequence files, from existing settings in the awg. Querying the AWG for these settings takes ~0.7 seconds

generate_channel_cfg() Dict[str, Optional[float]][source]

Function to query if the current channel settings that have been changed from their default value and put them in a dictionary that can easily be written into an awg file, so as to prevent said awg file from falling back to default values. (See make_awg_file() and AWG_FILE_FORMAT_CHANNEL()) NOTE: This only works for settings changed via the corresponding QCoDeS parameter.

Returns

A dict with the current setting for each entry in AWG_FILE_FORMAT_HEAD iff this entry applies to the AWG5014 AND has been changed from its default value.

static parse_marker_channel_name(name: str) qcodes.instrument_drivers.tektronix.AWG5014._MarkerDescriptor[source]

returns from the channel index and marker index from a marker descriptor string e.g. ‘1M1’->(1,1)

make_send_and_load_awg_file_from_forged_sequence(seq: Dict[Any, Any], filename: str = 'customawgfile.awg', preservechannelsettings: bool = True) None[source]

Makes an awg file form a forged sequence as produced by broadbean.sequence.Sequence.forge. The forged sequence is a dictionary (see fs_schmea) that does not need to be created by broadbean.

Parameters
send_awg_file(filename: str, awg_file: bytes, verbose: bool = False) None[source]

Writes an .awg-file onto the disk of the AWG. Overwrites existing files.

Parameters
  • filename – The name that the file will get on the AWG.

  • awg_file – A byte sequence containing the awg_file. Usually the output of self.make_awg_file.

  • verbose – A boolean to allow/suppress printing of messages about the status of the filw writing. Default: False.

load_awg_file(filename: str) None[source]

Loads an .awg-file from the disc of the AWG into the AWG memory. This may overwrite all instrument settings, the waveform list, and the sequence in the sequencer.

Parameters

filename – The filename of the .awg-file to load.

make_awg_file(waveforms: Union[Sequence[Sequence[numpy.ndarray]], Sequence[numpy.ndarray]], m1s: Union[Sequence[Sequence[numpy.ndarray]], Sequence[numpy.ndarray]], m2s: Union[Sequence[Sequence[numpy.ndarray]], Sequence[numpy.ndarray]], nreps: Sequence[int], trig_waits: Sequence[int], goto_states: Sequence[int], jump_tos: Sequence[int], channels: Optional[Sequence[int]] = None, preservechannelsettings: bool = True) bytes[source]
Parameters
  • waveforms – A list of the waveforms to be packed. The list should be filled like so: [[wfm1ch1, wfm2ch1, …], [wfm1ch2, wfm2ch2], …] Each waveform should be a numpy array with values in the range -1 to 1 (inclusive). If you do not wish to send waveforms to channels 1 and 2, use the channels parameter.

  • m1s – A list of marker 1’s. The list should be filled like so: [[elem1m1ch1, elem2m1ch1, …], [elem1m1ch2, elem2m1ch2], …] Each marker should be a numpy array containing only 0’s and 1’s

  • m2s – A list of marker 2’s. The list should be filled like so: [[elem1m2ch1, elem2m2ch1, …], [elem1m2ch2, elem2m2ch2], …] Each marker should be a numpy array containing only 0’s and 1’s

  • nreps – List of integers specifying the no. of repetitions per sequence element. Allowed values: 0 to 65536. O corresponds to Infinite repetitions.

  • trig_waits – List of len(segments) of integers specifying the trigger wait state of each sequence element. Allowed values: 0 (OFF) or 1 (ON).

  • goto_states – List of len(segments) of integers specifying the goto state of each sequence element. Allowed values: 0 to 65536 (0 means next)

  • jump_tos – List of len(segments) of integers specifying the logic jump state for each sequence element. Allowed values: 0 (OFF) or 1 (ON).

  • channels (list) – List of channels to send the waveforms to. Example: [1, 3, 2]

  • preservechannelsettings (bool) – If True, the current channel settings are found from the parameter history and added to the .awg file. Else, channel settings are not written in the file and will be reset to factory default when the file is loaded. Default: True.

make_send_and_load_awg_file(waveforms: Sequence[Sequence[numpy.ndarray]], m1s: Sequence[Sequence[numpy.ndarray]], m2s: Sequence[Sequence[numpy.ndarray]], nreps: Sequence[int], trig_waits: Sequence[int], goto_states: Sequence[int], jump_tos: Sequence[int], channels: Optional[Sequence[int]] = None, filename: str = 'customawgfile.awg', preservechannelsettings: bool = True) None[source]

Makes an .awg-file, sends it to the AWG and loads it. The .awg-file is uploaded to C:\Users\OEM\Documents. The waveforms appear in the user defined waveform list with names wfm001ch1, wfm002ch1, …

Parameters
  • waveforms – A list of the waveforms to upload. The list should be filled like so: [[wfm1ch1, wfm2ch1, …], [wfm1ch2, wfm2ch2], …] Each waveform should be a numpy array with values in the range -1 to 1 (inclusive). If you do not wish to send waveforms to channels 1 and 2, use the channels parameter.

  • m1s – A list of marker 1’s. The list should be filled like so: [[elem1m1ch1, elem2m1ch1, …], [elem1m1ch2, elem2m1ch2], …] Each marker should be a numpy array containing only 0’s and 1’s

  • m2s – A list of marker 2’s. The list should be filled like so: [[elem1m2ch1, elem2m2ch1, …], [elem1m2ch2, elem2m2ch2], …] Each marker should be a numpy array containing only 0’s and 1’s

  • nreps – List of integers specifying the no. of repetions per sequence element. Allowed values: 0 to 65536. 0 corresponds to Infinite repetions.

  • trig_waits – List of len(segments) of integers specifying the trigger wait state of each sequence element. Allowed values: 0 (OFF) or 1 (ON).

  • goto_states – List of len(segments) of integers specifying the goto state of each sequence element. Allowed values: 0 to 65536 (0 means next)

  • jump_tos – List of len(segments) of integers specifying the logic jump state for each sequence element. Allowed values: 0 (OFF) or 1 (ON).

  • channels – List of channels to send the waveforms to. Example: [1, 3, 2]

  • filename – The name of the .awg-file. Should end with the .awg extension. Default: ‘customawgfile.awg’

  • preservechannelsettings – If True, the current channel settings are found from the parameter history and added to the .awg file. Else, channel settings are reset to the factory default values. Default: True.

make_and_save_awg_file(waveforms: Sequence[Sequence[numpy.ndarray]], m1s: Sequence[Sequence[numpy.ndarray]], m2s: Sequence[Sequence[numpy.ndarray]], nreps: Sequence[int], trig_waits: Sequence[int], goto_states: Sequence[int], jump_tos: Sequence[int], channels: Optional[Sequence[int]] = None, filename: str = 'customawgfile.awg', preservechannelsettings: bool = True) None[source]

Makes an .awg-file and saves it locally.

Parameters
  • waveforms – A list of the waveforms to upload. The list should be filled like so: [[wfm1ch1, wfm2ch1, …], [wfm1ch2, wfm2ch2], …] Each waveform should be a numpy array with values in the range -1 to 1 (inclusive). If you do not wish to send waveforms to channels 1 and 2, use the channels parameter.

  • m1s – A list of marker 1’s. The list should be filled like so: [[elem1m1ch1, elem2m1ch1, …], [elem1m1ch2, elem2m1ch2], …] Each marker should be a numpy array containing only 0’s and 1’s

  • m2s – A list of marker 2’s. The list should be filled like so: [[elem1m2ch1, elem2m2ch1, …], [elem1m2ch2, elem2m2ch2], …] Each marker should be a numpy array containing only 0’s and 1’s

  • nreps – List of integers specifying the no. of repetions per sequence element. Allowed values: 0 to 65536. O corresponds to Infinite repetions.

  • trig_waits – List of len(segments) of integers specifying the trigger wait state of each sequence element. Allowed values: 0 (OFF) or 1 (ON).

  • goto_states – List of len(segments) of integers specifying the goto state of each sequence element. Allowed values: 0 to 65536 (0 means next)

  • jump_tos – List of len(segments) of integers specifying the logic jump state for each sequence element. Allowed values: 0 (OFF) or 1 (ON).

  • channels – List of channels to send the waveforms to. Example: [1, 3, 2]

  • preservechannelsettings – If True, the current channel settings are found from the parameter history and added to the .awg file. Else, channel settings are not written in the file and will be reset to factory default when the file is loaded. Default: True.

  • filename – The full path of the .awg-file. Should end with the .awg extension. Default: ‘customawgfile.awg’

get_error() str[source]

This function retrieves and returns data from the error and event queues.

Returns

String containing the error/event number, the error/event description.

delete_all_waveforms_from_list() None[source]

Delete all user-defined waveforms in the list in a single action. Note that there is no “UNDO” action once the waveforms are deleted. Use caution before issuing this command.

If the deleted waveform(s) is (are) currently loaded into waveform memory, it (they) is (are) unloaded. If the RUN state of the instrument is ON, the state is turned OFF. If the channel is on, it will be switched off.

get_filenames() str[source]

Duplicate of self.get_folder_contents

send_DC_pulse(DC_channel_number: int, set_level: float, length: float) None[source]

Sets the DC level on the specified channel, waits a while and then resets it to what it was before.

Note: Make sure that the output DC state is ON.

Parameters
  • DC_channel_number (int) – The channel number (1-4).

  • set_level (float) – The voltage level to set to (V).

  • length (float) – The time to wait before resetting (s).

is_awg_ready() bool[source]

Assert if the AWG is ready.

Returns

True, irrespective of anything.

send_waveform_to_list(w: numpy.ndarray, m1: numpy.ndarray, m2: numpy.ndarray, wfmname: str) None[source]

Send a single complete waveform directly to the “User defined” waveform list (prepend it). The data type of the input arrays is unimportant, but the marker arrays must contain only 1’s and 0’s.

Parameters
  • w – The waveform

  • m1 – Marker1

  • m2 – Marker2

  • wfmname – waveform name

Raises
  • Exception – if the lengths of w, m1, and m2 don’t match

  • TypeError – if the waveform contains values outside (-1, 1)

  • TypeError – if the markers contain values that are not 0 or 1

clear_message_queue(verbose: bool = False) None[source]

Function to clear up (flush) the VISA message queue of the AWG instrument. Reads all messages in the the queue.

Parameters

verbose – If True, the read messages are printed. Default: False.

__del__() None

Close the instrument and remove its instance record.

__getitem__(key: str) Union[Callable[[...], Any], qcodes.instrument.parameter.Parameter]

Delegate instrument[‘name’] to parameter or function ‘name’.

__getstate__() None

Prevent pickling instruments, and give a nice error message.

__repr__() str

Simplified repr giving just the class and name.

add_function(name: str, **kwargs: Any) None

Bind one Function to this instrument.

Instrument subclasses can call this repeatedly in their __init__ for every real function of the instrument.

This functionality is meant for simple cases, principally things that map to simple commands like *RST (reset) or those with just a few arguments. It requires a fixed argument count, and positional args only. If your case is more complicated, you’re probably better off simply making a new method in your Instrument subclass definition.

Parameters
  • name – How the Function will be stored within instrument.Functions and also how you address it using the shortcut methods: instrument.call(func_name, *args) etc.

  • **kwargs – constructor kwargs for Function

Raises

KeyError – If this instrument already has a function with this name.

add_parameter(name: str, parameter_class: type = <class 'qcodes.instrument.parameter.Parameter'>, **kwargs: Any) None

Bind one Parameter to this instrument.

Instrument subclasses can call this repeatedly in their __init__ for every real parameter of the instrument.

In this sense, parameters are the state variables of the instrument, anything the user can set and/or get.

Parameters
  • name – How the parameter will be stored within instrument.parameters and also how you address it using the shortcut methods: instrument.set(param_name, value) etc.

  • parameter_class – You can construct the parameter out of any class. Default parameter.Parameter.

  • **kwargs – Constructor arguments for parameter_class.

Raises
  • KeyError – If this instrument already has a parameter with this name and the parameter being replaced is not an abstract parameter.

  • ValueError – If there is an existing abstract parameter and the unit of the new parameter is inconsistent with the existing one.

add_submodule(name: str, submodule: Union[InstrumentBase, ChannelList]) None

Bind one submodule to this instrument.

Instrument subclasses can call this repeatedly in their __init__ method for every submodule of the instrument.

Submodules can effectively be considered as instruments within the main instrument, and should at minimum be snapshottable. For example, they can be used to either store logical groupings of parameters, which may or may not be repeated, or channel lists.

Parameters
  • name – How the submodule will be stored within instrument.submodules and also how it can be addressed.

  • submodule – The submodule to be stored.

Raises
  • KeyError – If this instrument already contains a submodule with this name.

  • TypeError – If the submodule that we are trying to add is not an instance of an Metadatable object.

property ancestors: List[qcodes.instrument.base.InstrumentBase]

Returns a list of instruments, starting from the current instrument and following to the parent instrument and the parents parent instrument until the root instrument is reached.

ask(cmd: str) str

Write a command string to the hardware and return a response.

Subclasses that transform cmd should override this method, and in it call super().ask(new_cmd). Subclasses that define a new hardware communication should instead override ask_raw.

Parameters

cmd – The string to send to the instrument.

Returns

response

Raises

Exception – Wraps any underlying exception with extra context, including the command and the instrument.

ask_raw(cmd: str) str

Low-level interface to visa_handle.ask.

Parameters

cmd – The command to send to the instrument.

Returns

The instrument’s response.

Return type

str

call(func_name: str, *args: Any) Any

Shortcut for calling a function from its name.

Parameters
  • func_name – The name of a function of this instrument.

  • *args – any arguments to the function.

Returns

The return value of the function.

check_error(ret_code: int) None

Default error checking, raises an error if return code !=0. Does not differentiate between warnings or specific error messages. Override this function in your driver if you want to add specific error messages.

Parameters

ret_code – A Visa error code. See eg: https://github.com/hgrecco/pyvisa/blob/master/pyvisa/errors.py

Raises

visa.VisaIOError – if ret_code indicates a communication problem.

close() None

Disconnect and irreversibly tear down the instrument.

classmethod close_all() None

Try to close all instruments registered in _all_instruments This is handy for use with atexit to ensure that all instruments are closed when a python session is closed.

Examples

>>> atexit.register(qc.Instrument.close_all())
connect_message(idn_param: str = 'IDN', begin_time: Optional[float] = None) None

Print a standard message on initial connection to an instrument.

Parameters
  • idn_param – Name of parameter that returns ID dict. Default IDN.

  • begin_timetime.time() when init started. Default is self._t0, set at start of Instrument.__init__.

delegate_attr_dicts: List[str] = ['parameters', 'functions', 'submodules']

A list of names (strings) of dictionaries which are (or will be) attributes of self, whose keys should be treated as attributes of self.

delegate_attr_objects: List[str] = []

A list of names (strings) of objects which are (or will be) attributes of self, whose attributes should be passed through to self.

device_clear() None

Clear the buffers of the device

static exist(name: str, instrument_class: Optional[type] = None) bool

Check if an instrument with a given names exists (i.e. is already instantiated).

Parameters
  • name – Name of the instrument.

  • instrument_class – The type of instrument you are looking for.

classmethod find_instrument(name: str, instrument_class: Optional[type] = None) qcodes.instrument.base.Instrument

Find an existing instrument by name.

Parameters
  • name – Name of the instrument.

  • instrument_class – The type of instrument you are looking for.

Returns

The instrument found.

Raises
  • KeyError – If no instrument of that name was found, or if its reference is invalid (dead).

  • TypeError – If a specific class was requested but a different type was found.

property full_name: str
get(param_name: str) Any

Shortcut for getting a parameter from its name.

Parameters

param_name – The name of a parameter of this instrument.

Returns

The current value of the parameter.

get_idn() Dict[str, Optional[str]]

Parse a standard VISA *IDN? response into an ID dict.

Even though this is the VISA standard, it applies to various other types as well, such as IPInstruments, so it is included here in the Instrument base class.

Override this if your instrument does not support *IDN? or returns a nonstandard IDN string. This string is supposed to be a comma-separated list of vendor, model, serial, and firmware, but semicolon and colon are also common separators so we accept them here as well.

Returns

A dict containing vendor, model, serial, and firmware.

classmethod instances() List[qcodes.instrument.base.Instrument]

Get all currently defined instances of this instrument class.

You can use this to get the objects back if you lose track of them, and it’s also used by the test system to find objects to test against.

Returns

A list of instances.

static is_valid(instr_instance: qcodes.instrument.base.Instrument) bool

Check if a given instance of an instrument is valid: if an instrument has been closed, its instance is not longer a “valid” instrument.

Parameters

instr_instance – Instance of an Instrument class or its subclass.

load_metadata(metadata: Dict[Any, Any]) None

Load metadata into this classes metadata dictionary.

Parameters

metadata – Metadata to load.

property name: str

Name of the instrument

property name_parts: List[str]
omit_delegate_attrs: List[str] = []

A list of attribute names (strings) to not delegate to any other dictionary or object.

property parent: Optional[qcodes.instrument.base.InstrumentBase]

Returns the parent instrument. By default this is None. Any SubInstrument should subclass this to return the parent instrument.

print_readable_snapshot(update: bool = False, max_chars: int = 80) None

Prints a readable version of the snapshot. The readable snapshot includes the name, value and unit of each parameter. A convenience function to quickly get an overview of the status of an instrument.

Parameters
  • update – If True, update the state by querying the instrument. If False, just use the latest values in memory. This argument gets passed to the snapshot function.

  • max_chars – the maximum number of characters per line. The readable snapshot will be cropped if this value is exceeded. Defaults to 80 to be consistent with default terminal width.

classmethod record_instance(instance: qcodes.instrument.base.Instrument) None

Record (a weak ref to) an instance in a class’s instance list.

Also records the instance in list of all instruments, and verifies that there are no other instruments with the same name.

Parameters

instance – Instance to record.

Raises

KeyError – If another instance with the same name is already present.

classmethod remove_instance(instance: qcodes.instrument.base.Instrument) None

Remove a particular instance from the record.

Parameters

instance – The instance to remove

property root_instrument: qcodes.instrument.base.InstrumentBase
set(param_name: str, value: Any) None

Shortcut for setting a parameter from its name and new value.

Parameters
  • param_name – The name of a parameter of this instrument.

  • value – The new value to set.

set_address(address: str) None

Set the address for this instrument.

Parameters

address – The visa resource name to use to connect. The address should be the actual address and just that. If you wish to change the backend for VISA, use the self.visalib attribute (and then call this function).

set_terminator(terminator: str) None

Change the read terminator to use.

Parameters

terminator – Character(s) to look for at the end of a read. eg. \r\n.

shared_kwargs = ()
property short_name: str

Short name of the instrument

snapshot(update: Optional[bool] = False) Dict[Any, Any]

Decorate a snapshot dictionary with metadata. DO NOT override this method if you want metadata in the snapshot instead, override snapshot_base().

Parameters

update – Passed to snapshot_base.

Returns

Base snapshot.

snapshot_base(update: Optional[bool] = True, params_to_skip_update: Optional[Sequence[str]] = None) Dict[Any, Any]

State of the instrument as a JSON-compatible dict (everything that the custom JSON encoder class qcodes.utils.helpers.NumpyJSONEncoder supports).

Parameters
  • update – If True, update the state by querying the instrument. If None only update if the state is known to be invalid. If False, just use the latest values in memory and never update.

  • params_to_skip_update – List of parameter names that will be skipped in update even if update is True. This is useful if you have parameters that are slow to update but can be updated in a different way (as in the qdac). If you want to skip the update of certain parameters in all snapshots, use the snapshot_get attribute of those parameters instead.

Returns

base snapshot

Return type

dict

validate_status(verbose: bool = False) None

Validate the values of all gettable parameters

The validation is done for all parameters that have both a get and set method.

Parameters

verbose – If True, then information about the parameters that are being check is printed.

write(cmd: str) None

Write a command string with NO response to the hardware.

Subclasses that transform cmd should override this method, and in it call super().write(new_cmd). Subclasses that define a new hardware communication should instead override write_raw.

Parameters

cmd – The string to send to the instrument.

Raises

Exception – Wraps any underlying exception with extra context, including the command and the instrument.

write_raw(cmd: str) None

Low-level interface to visa_handle.write.

Parameters

cmd – The command to send to the instrument.

parameters: Dict[str, _BaseParameter] = {}

All the parameters supported by this instrument. Usually populated via add_parameter().

functions: Dict[str, Function] = {}

All the functions supported by this instrument. Usually populated via add_function().

submodules: Dict[str, Union['InstrumentBase', 'ChannelList']] = {}

All the submodules of this instrument such as channel lists or logical groupings of parameters. Usually populated via add_submodule().

log: InstrumentLoggerAdapter = get_instrument_logger(self, __name__)
qcodes.instrument_drivers.tektronix.AWG5014.parsestr(v: str) str[source]

qcodes.instrument_drivers.tektronix.AWG5208 module

class qcodes.instrument_drivers.tektronix.AWG5208.AWG5208(name: str, address: str, timeout: float = 10, **kwargs: Any)[source]

Bases: qcodes.instrument_drivers.tektronix.AWG70000A.AWG70000A

The QCoDeS driver for Tektronix AWG5208

Parameters
  • name – The name used internally by QCoDeS in the DataSet

  • address – The VISA resource name of the instrument

  • timeout – The VISA timeout time (in seconds).

__del__() None

Close the instrument and remove its instance record.

__getitem__(key: str) Union[Callable[[...], Any], qcodes.instrument.parameter.Parameter]

Delegate instrument[‘name’] to parameter or function ‘name’.

__getstate__() None

Prevent pickling instruments, and give a nice error message.

__repr__() str

Simplified repr giving just the class and name.

add_function(name: str, **kwargs: Any) None

Bind one Function to this instrument.

Instrument subclasses can call this repeatedly in their __init__ for every real function of the instrument.

This functionality is meant for simple cases, principally things that map to simple commands like *RST (reset) or those with just a few arguments. It requires a fixed argument count, and positional args only. If your case is more complicated, you’re probably better off simply making a new method in your Instrument subclass definition.

Parameters
  • name – How the Function will be stored within instrument.Functions and also how you address it using the shortcut methods: instrument.call(func_name, *args) etc.

  • **kwargs – constructor kwargs for Function

Raises

KeyError – If this instrument already has a function with this name.

add_parameter(name: str, parameter_class: type = <class 'qcodes.instrument.parameter.Parameter'>, **kwargs: Any) None

Bind one Parameter to this instrument.

Instrument subclasses can call this repeatedly in their __init__ for every real parameter of the instrument.

In this sense, parameters are the state variables of the instrument, anything the user can set and/or get.

Parameters
  • name – How the parameter will be stored within instrument.parameters and also how you address it using the shortcut methods: instrument.set(param_name, value) etc.

  • parameter_class – You can construct the parameter out of any class. Default parameter.Parameter.

  • **kwargs – Constructor arguments for parameter_class.

Raises
  • KeyError – If this instrument already has a parameter with this name and the parameter being replaced is not an abstract parameter.

  • ValueError – If there is an existing abstract parameter and the unit of the new parameter is inconsistent with the existing one.

add_submodule(name: str, submodule: Union[InstrumentBase, ChannelList]) None

Bind one submodule to this instrument.

Instrument subclasses can call this repeatedly in their __init__ method for every submodule of the instrument.

Submodules can effectively be considered as instruments within the main instrument, and should at minimum be snapshottable. For example, they can be used to either store logical groupings of parameters, which may or may not be repeated, or channel lists.

Parameters
  • name – How the submodule will be stored within instrument.submodules and also how it can be addressed.

  • submodule – The submodule to be stored.

Raises
  • KeyError – If this instrument already contains a submodule with this name.

  • TypeError – If the submodule that we are trying to add is not an instance of an Metadatable object.

property ancestors: List[qcodes.instrument.base.InstrumentBase]

Returns a list of instruments, starting from the current instrument and following to the parent instrument and the parents parent instrument until the root instrument is reached.

ask(cmd: str) str

Write a command string to the hardware and return a response.

Subclasses that transform cmd should override this method, and in it call super().ask(new_cmd). Subclasses that define a new hardware communication should instead override ask_raw.

Parameters

cmd – The string to send to the instrument.

Returns

response

Raises

Exception – Wraps any underlying exception with extra context, including the command and the instrument.

ask_raw(cmd: str) str

Low-level interface to visa_handle.ask.

Parameters

cmd – The command to send to the instrument.

Returns

The instrument’s response.

Return type

str

call(func_name: str, *args: Any) Any

Shortcut for calling a function from its name.

Parameters
  • func_name – The name of a function of this instrument.

  • *args – any arguments to the function.

Returns

The return value of the function.

check_error(ret_code: int) None

Default error checking, raises an error if return code !=0. Does not differentiate between warnings or specific error messages. Override this function in your driver if you want to add specific error messages.

Parameters

ret_code – A Visa error code. See eg: https://github.com/hgrecco/pyvisa/blob/master/pyvisa/errors.py

Raises

visa.VisaIOError – if ret_code indicates a communication problem.

clearSequenceList() None

Clear the sequence list

clearWaveformList() None

Clear the waveform list

close() None

Disconnect and irreversibly tear down the instrument.

classmethod close_all() None

Try to close all instruments registered in _all_instruments This is handy for use with atexit to ensure that all instruments are closed when a python session is closed.

Examples

>>> atexit.register(qc.Instrument.close_all())
connect_message(idn_param: str = 'IDN', begin_time: Optional[float] = None) None

Print a standard message on initial connection to an instrument.

Parameters
  • idn_param – Name of parameter that returns ID dict. Default IDN.

  • begin_timetime.time() when init started. Default is self._t0, set at start of Instrument.__init__.

delegate_attr_dicts: List[str] = ['parameters', 'functions', 'submodules']

A list of names (strings) of dictionaries which are (or will be) attributes of self, whose keys should be treated as attributes of self.

delegate_attr_objects: List[str] = []

A list of names (strings) of objects which are (or will be) attributes of self, whose attributes should be passed through to self.

delete_sequence_from_list(seqname: str) None

Delete the specified sequence from the sequence list

Parameters

seqname – The name of the sequence (as it appears in the sequence list, not the file name) to delete

device_clear() None

Clear the buffers of the device

static exist(name: str, instrument_class: Optional[type] = None) bool

Check if an instrument with a given names exists (i.e. is already instantiated).

Parameters
  • name – Name of the instrument.

  • instrument_class – The type of instrument you are looking for.

classmethod find_instrument(name: str, instrument_class: Optional[type] = None) qcodes.instrument.base.Instrument

Find an existing instrument by name.

Parameters
  • name – Name of the instrument.

  • instrument_class – The type of instrument you are looking for.

Returns

The instrument found.

Raises
  • KeyError – If no instrument of that name was found, or if its reference is invalid (dead).

  • TypeError – If a specific class was requested but a different type was found.

force_triggerA() None

Force a trigger A event

force_triggerB() None

Force a trigger B event

property full_name: str
get(param_name: str) Any

Shortcut for getting a parameter from its name.

Parameters

param_name – The name of a parameter of this instrument.

Returns

The current value of the parameter.

get_idn() Dict[str, Optional[str]]

Parse a standard VISA *IDN? response into an ID dict.

Even though this is the VISA standard, it applies to various other types as well, such as IPInstruments, so it is included here in the Instrument base class.

Override this if your instrument does not support *IDN? or returns a nonstandard IDN string. This string is supposed to be a comma-separated list of vendor, model, serial, and firmware, but semicolon and colon are also common separators so we accept them here as well.

Returns

A dict containing vendor, model, serial, and firmware.

classmethod instances() List[qcodes.instrument.base.Instrument]

Get all currently defined instances of this instrument class.

You can use this to get the objects back if you lose track of them, and it’s also used by the test system to find objects to test against.

Returns

A list of instances.

static is_valid(instr_instance: qcodes.instrument.base.Instrument) bool

Check if a given instance of an instrument is valid: if an instrument has been closed, its instance is not longer a “valid” instrument.

Parameters

instr_instance – Instance of an Instrument class or its subclass.

loadSEQXFile(filename: str, path: Optional[str] = None) None

Load a seqx file from instrument disk memory. All sequences in the file are loaded into the sequence list.

Parameters
  • filename – The name of the sequence file INCLUDING the extension

  • path – Path to load from. If omitted, the default path (self.seqxFileFolder) is used.

loadWFMXFile(filename: str, path: Optional[str] = None) None

Loads a wfmx from memory into the waveform list Only loading from the C: drive is supported

Parameters
  • filename – Name of the file (with extension)

  • path – Path to load from. If omitted, the default path (self.wfmxFileFolder) is used.

load_metadata(metadata: Dict[Any, Any]) None

Load metadata into this classes metadata dictionary.

Parameters

metadata – Metadata to load.

static makeSEQXFile(trig_waits: Sequence[int], nreps: Sequence[int], event_jumps: Sequence[int], event_jump_to: Sequence[int], go_to: Sequence[int], wfms: Sequence[Sequence[numpy.ndarray]], amplitudes: Sequence[float], seqname: str) bytes

Make a full .seqx file (bundle) A .seqx file can presumably hold several sequences, but for now we support only packing a single sequence

For a single sequence, a .seqx file is a bundle of two files and two folders:

/Sequences

sequence.sml

/Waveforms

wfm1.wfmx wfm2.wfmx …

setup.xml userNotes.txt

Parameters
  • trig_waits – Wait for a trigger? If yes, you must specify the trigger input. 0 for off, 1 for ‘TrigA’, 2 for ‘TrigB’, 3 for ‘Internal’.

  • nreps – No. of repetitions. 0 corresponds to infinite.

  • event_jumps – Jump when event triggered? If yes, you must specify the trigger input. 0 for off, 1 for ‘TrigA’, 2 for ‘TrigB’, 3 for ‘Internal’.

  • event_jump_to – Jump target in case of event. 1-indexed, 0 means next. Must be specified for all elements.

  • go_to – Which element to play next. 1-indexed, 0 means next.

  • wfms – numpy arrays describing each waveform plus two markers, packed like np.array([wfm, m1, m2]). These numpy arrays are then again packed in lists according to: [[wfmch1pos1, wfmch1pos2, …], [wfmch2pos1, …], …]

  • amplitudes – The peak-to-peak amplitude in V of the channels, i.e. a list [ch1_amp, ch2_amp].

  • seqname – The name of the sequence. This name will appear in the sequence list. Note that all spaces are converted to ‘_’

Returns

The binary .seqx file, ready to be sent to the instrument.

static makeWFMXFile(data: numpy.ndarray, amplitude: float) bytes

Compose a WFMX file

Parameters
  • data – A numpy array holding the data. Markers can be included.

  • amplitude – The peak-to-peak amplitude (V) assumed to be set on the channel that will play this waveform. This information is needed as the waveform must be rescaled to (-1, 1) where -1 will correspond to the channel’s min. voltage and 1 to the channel’s max. voltage.

Returns

The binary .wfmx file, ready to be sent to the instrument.

static make_SEQX_from_forged_sequence(seq: Dict[int, Dict[Any, Any]], amplitudes: List[float], seqname: str, channel_mapping: Optional[Dict[Union[str, int], int]] = None) bytes

Make a .seqx from a forged broadbean sequence. Supports subsequences.

Parameters
  • seq – The output of broadbean’s Sequence.forge()

  • amplitudes – A list of the AWG channels’ voltage amplitudes. The first entry is ch1 etc.

  • channel_mapping – A mapping from what the channel is called in the broadbean sequence to the integer describing the physical channel it should be assigned to.

  • seqname – The name that the sequence will have in the AWG’s sequence list. Used for loading the sequence.

Returns

The binary .seqx file contents. Can be sent directly to the

instrument or saved on disk.

property name: str

Name of the instrument

property name_parts: List[str]
omit_delegate_attrs: List[str] = []

A list of attribute names (strings) to not delegate to any other dictionary or object.

property parent: Optional[qcodes.instrument.base.InstrumentBase]

Returns the parent instrument. By default this is None. Any SubInstrument should subclass this to return the parent instrument.

play(wait_for_running: bool = True, timeout: float = 10) None

Run the AWG/Func. Gen. This command is equivalent to pressing the play button on the front panel.

Parameters
  • wait_for_running – If True, this command is blocking while the instrument is getting ready to play

  • timeout – The maximal time to wait for the instrument to play. Raises an exception is this time is reached.

print_readable_snapshot(update: bool = False, max_chars: int = 80) None

Prints a readable version of the snapshot. The readable snapshot includes the name, value and unit of each parameter. A convenience function to quickly get an overview of the status of an instrument.

Parameters
  • update – If True, update the state by querying the instrument. If False, just use the latest values in memory. This argument gets passed to the snapshot function.

  • max_chars – the maximum number of characters per line. The readable snapshot will be cropped if this value is exceeded. Defaults to 80 to be consistent with default terminal width.

classmethod record_instance(instance: qcodes.instrument.base.Instrument) None

Record (a weak ref to) an instance in a class’s instance list.

Also records the instance in list of all instruments, and verifies that there are no other instruments with the same name.

Parameters

instance – Instance to record.

Raises

KeyError – If another instance with the same name is already present.

classmethod remove_instance(instance: qcodes.instrument.base.Instrument) None

Remove a particular instance from the record.

Parameters

instance – The instance to remove

property root_instrument: qcodes.instrument.base.InstrumentBase
sendSEQXFile(seqx: bytes, filename: str, path: Optional[str] = None) None

Send a binary seqx file to the AWG’s memory

Parameters
  • seqx – The binary seqx file, preferably the output of makeSEQXFile.

  • filename – The name of the file on the AWG disk, including the extension.

  • path – The path to the directory where the file should be saved. If omitted, seqxFileFolder will be used.

sendWFMXFile(wfmx: bytes, filename: str, path: Optional[str] = None) None

Send a binary wfmx file to the AWG’s memory

Parameters
  • wfmx – The binary wfmx file, preferably the output of makeWFMXFile.

  • filename – The name of the file on the AWG disk, including the extension.

  • path – The path to the directory where the file should be saved. If omitted, seqxFileFolder will be used.

property sequenceList: List[str]

Return the sequence list as a list of strings

set(param_name: str, value: Any) None

Shortcut for setting a parameter from its name and new value.

Parameters
  • param_name – The name of a parameter of this instrument.

  • value – The new value to set.

set_address(address: str) None

Set the address for this instrument.

Parameters

address – The visa resource name to use to connect. The address should be the actual address and just that. If you wish to change the backend for VISA, use the self.visalib attribute (and then call this function).

set_terminator(terminator: str) None

Change the read terminator to use.

Parameters

terminator – Character(s) to look for at the end of a read. eg. \r\n.

shared_kwargs = ()
property short_name: str

Short name of the instrument

snapshot(update: Optional[bool] = False) Dict[Any, Any]

Decorate a snapshot dictionary with metadata. DO NOT override this method if you want metadata in the snapshot instead, override snapshot_base().

Parameters

update – Passed to snapshot_base.

Returns

Base snapshot.

snapshot_base(update: Optional[bool] = True, params_to_skip_update: Optional[Sequence[str]] = None) Dict[Any, Any]

State of the instrument as a JSON-compatible dict (everything that the custom JSON encoder class qcodes.utils.helpers.NumpyJSONEncoder supports).

Parameters
  • update – If True, update the state by querying the instrument. If None only update if the state is known to be invalid. If False, just use the latest values in memory and never update.

  • params_to_skip_update – List of parameter names that will be skipped in update even if update is True. This is useful if you have parameters that are slow to update but can be updated in a different way (as in the qdac). If you want to skip the update of certain parameters in all snapshots, use the snapshot_get attribute of those parameters instead.

Returns

base snapshot

Return type

dict

stop() None

Stop the output of the instrument. This command is equivalent to pressing the stop button on the front panel.

validate_status(verbose: bool = False) None

Validate the values of all gettable parameters

The validation is done for all parameters that have both a get and set method.

Parameters

verbose – If True, then information about the parameters that are being check is printed.

wait_for_operation_to_complete() None

Waits for the latest issued overlapping command to finish

property waveformList: List[str]

Return the waveform list as a list of strings

write(cmd: str) None

Write a command string with NO response to the hardware.

Subclasses that transform cmd should override this method, and in it call super().write(new_cmd). Subclasses that define a new hardware communication should instead override write_raw.

Parameters

cmd – The string to send to the instrument.

Raises

Exception – Wraps any underlying exception with extra context, including the command and the instrument.

write_raw(cmd: str) None

Low-level interface to visa_handle.write.

Parameters

cmd – The command to send to the instrument.

parameters: Dict[str, _BaseParameter] = {}

All the parameters supported by this instrument. Usually populated via add_parameter().

functions: Dict[str, Function] = {}

All the functions supported by this instrument. Usually populated via add_function().

submodules: Dict[str, Union['InstrumentBase', 'ChannelList']] = {}

All the submodules of this instrument such as channel lists or logical groupings of parameters. Usually populated via add_submodule().

log: InstrumentLoggerAdapter = get_instrument_logger(self, __name__)

qcodes.instrument_drivers.tektronix.AWG70000A module

class qcodes.instrument_drivers.tektronix.AWG70000A.AWG70000A(name: str, address: str, num_channels: int, timeout: float = 10, **kwargs: Any)[source]

Bases: qcodes.instrument.visa.VisaInstrument

The QCoDeS driver for Tektronix AWG70000A series AWG’s.

The drivers for AWG70001A and AWG70002A should be subclasses of this general class.

Parameters
  • name – The name used internally by QCoDeS in the DataSet

  • address – The VISA resource name of the instrument

  • timeout – The VISA timeout time (in seconds)

  • num_channels – Number of channels on the AWG

force_triggerA() None[source]

Force a trigger A event

force_triggerB() None[source]

Force a trigger B event

wait_for_operation_to_complete() None[source]

Waits for the latest issued overlapping command to finish

play(wait_for_running: bool = True, timeout: float = 10) None[source]

Run the AWG/Func. Gen. This command is equivalent to pressing the play button on the front panel.

Parameters
  • wait_for_running – If True, this command is blocking while the instrument is getting ready to play

  • timeout – The maximal time to wait for the instrument to play. Raises an exception is this time is reached.

stop() None[source]

Stop the output of the instrument. This command is equivalent to pressing the stop button on the front panel.

property sequenceList: List[str]

Return the sequence list as a list of strings

property waveformList: List[str]

Return the waveform list as a list of strings

delete_sequence_from_list(seqname: str) None[source]

Delete the specified sequence from the sequence list

Parameters

seqname – The name of the sequence (as it appears in the sequence list, not the file name) to delete

clearSequenceList() None[source]

Clear the sequence list

clearWaveformList() None[source]

Clear the waveform list

static makeWFMXFile(data: numpy.ndarray, amplitude: float) bytes[source]

Compose a WFMX file

Parameters
  • data – A numpy array holding the data. Markers can be included.

  • amplitude – The peak-to-peak amplitude (V) assumed to be set on the channel that will play this waveform. This information is needed as the waveform must be rescaled to (-1, 1) where -1 will correspond to the channel’s min. voltage and 1 to the channel’s max. voltage.

Returns

The binary .wfmx file, ready to be sent to the instrument.

sendSEQXFile(seqx: bytes, filename: str, path: Optional[str] = None) None[source]

Send a binary seqx file to the AWG’s memory

Parameters
  • seqx – The binary seqx file, preferably the output of makeSEQXFile.

  • filename – The name of the file on the AWG disk, including the extension.

  • path – The path to the directory where the file should be saved. If omitted, seqxFileFolder will be used.

sendWFMXFile(wfmx: bytes, filename: str, path: Optional[str] = None) None[source]

Send a binary wfmx file to the AWG’s memory

Parameters
  • wfmx – The binary wfmx file, preferably the output of makeWFMXFile.

  • filename – The name of the file on the AWG disk, including the extension.

  • path – The path to the directory where the file should be saved. If omitted, seqxFileFolder will be used.

loadWFMXFile(filename: str, path: Optional[str] = None) None[source]

Loads a wfmx from memory into the waveform list Only loading from the C: drive is supported

Parameters
  • filename – Name of the file (with extension)

  • path – Path to load from. If omitted, the default path (self.wfmxFileFolder) is used.

loadSEQXFile(filename: str, path: Optional[str] = None) None[source]

Load a seqx file from instrument disk memory. All sequences in the file are loaded into the sequence list.

Parameters
  • filename – The name of the sequence file INCLUDING the extension

  • path – Path to load from. If omitted, the default path (self.seqxFileFolder) is used.

static make_SEQX_from_forged_sequence(seq: Dict[int, Dict[Any, Any]], amplitudes: List[float], seqname: str, channel_mapping: Optional[Dict[Union[str, int], int]] = None) bytes[source]

Make a .seqx from a forged broadbean sequence. Supports subsequences.

Parameters
  • seq – The output of broadbean’s Sequence.forge()

  • amplitudes – A list of the AWG channels’ voltage amplitudes. The first entry is ch1 etc.

  • channel_mapping – A mapping from what the channel is called in the broadbean sequence to the integer describing the physical channel it should be assigned to.

  • seqname – The name that the sequence will have in the AWG’s sequence list. Used for loading the sequence.

Returns

The binary .seqx file contents. Can be sent directly to the

instrument or saved on disk.

__del__() None

Close the instrument and remove its instance record.

__getitem__(key: str) Union[Callable[[...], Any], qcodes.instrument.parameter.Parameter]

Delegate instrument[‘name’] to parameter or function ‘name’.

__getstate__() None

Prevent pickling instruments, and give a nice error message.

__repr__() str

Simplified repr giving just the class and name.

add_function(name: str, **kwargs: Any) None

Bind one Function to this instrument.

Instrument subclasses can call this repeatedly in their __init__ for every real function of the instrument.

This functionality is meant for simple cases, principally things that map to simple commands like *RST (reset) or those with just a few arguments. It requires a fixed argument count, and positional args only. If your case is more complicated, you’re probably better off simply making a new method in your Instrument subclass definition.

Parameters
  • name – How the Function will be stored within instrument.Functions and also how you address it using the shortcut methods: instrument.call(func_name, *args) etc.

  • **kwargs – constructor kwargs for Function

Raises

KeyError – If this instrument already has a function with this name.

add_parameter(name: str, parameter_class: type = <class 'qcodes.instrument.parameter.Parameter'>, **kwargs: Any) None

Bind one Parameter to this instrument.

Instrument subclasses can call this repeatedly in their __init__ for every real parameter of the instrument.

In this sense, parameters are the state variables of the instrument, anything the user can set and/or get.

Parameters
  • name – How the parameter will be stored within instrument.parameters and also how you address it using the shortcut methods: instrument.set(param_name, value) etc.

  • parameter_class – You can construct the parameter out of any class. Default parameter.Parameter.

  • **kwargs – Constructor arguments for parameter_class.

Raises
  • KeyError – If this instrument already has a parameter with this name and the parameter being replaced is not an abstract parameter.

  • ValueError – If there is an existing abstract parameter and the unit of the new parameter is inconsistent with the existing one.

add_submodule(name: str, submodule: Union[InstrumentBase, ChannelList]) None

Bind one submodule to this instrument.

Instrument subclasses can call this repeatedly in their __init__ method for every submodule of the instrument.

Submodules can effectively be considered as instruments within the main instrument, and should at minimum be snapshottable. For example, they can be used to either store logical groupings of parameters, which may or may not be repeated, or channel lists.

Parameters
  • name – How the submodule will be stored within instrument.submodules and also how it can be addressed.

  • submodule – The submodule to be stored.

Raises
  • KeyError – If this instrument already contains a submodule with this name.

  • TypeError – If the submodule that we are trying to add is not an instance of an Metadatable object.

property ancestors: List[qcodes.instrument.base.InstrumentBase]

Returns a list of instruments, starting from the current instrument and following to the parent instrument and the parents parent instrument until the root instrument is reached.

ask(cmd: str) str

Write a command string to the hardware and return a response.

Subclasses that transform cmd should override this method, and in it call super().ask(new_cmd). Subclasses that define a new hardware communication should instead override ask_raw.

Parameters

cmd – The string to send to the instrument.

Returns

response

Raises

Exception – Wraps any underlying exception with extra context, including the command and the instrument.

ask_raw(cmd: str) str

Low-level interface to visa_handle.ask.

Parameters

cmd – The command to send to the instrument.

Returns

The instrument’s response.

Return type

str

call(func_name: str, *args: Any) Any

Shortcut for calling a function from its name.

Parameters
  • func_name – The name of a function of this instrument.

  • *args – any arguments to the function.

Returns

The return value of the function.

check_error(ret_code: int) None

Default error checking, raises an error if return code !=0. Does not differentiate between warnings or specific error messages. Override this function in your driver if you want to add specific error messages.

Parameters

ret_code – A Visa error code. See eg: https://github.com/hgrecco/pyvisa/blob/master/pyvisa/errors.py

Raises

visa.VisaIOError – if ret_code indicates a communication problem.

close() None

Disconnect and irreversibly tear down the instrument.

classmethod close_all() None

Try to close all instruments registered in _all_instruments This is handy for use with atexit to ensure that all instruments are closed when a python session is closed.

Examples

>>> atexit.register(qc.Instrument.close_all())
connect_message(idn_param: str = 'IDN', begin_time: Optional[float] = None) None

Print a standard message on initial connection to an instrument.

Parameters
  • idn_param – Name of parameter that returns ID dict. Default IDN.

  • begin_timetime.time() when init started. Default is self._t0, set at start of Instrument.__init__.

delegate_attr_dicts: List[str] = ['parameters', 'functions', 'submodules']

A list of names (strings) of dictionaries which are (or will be) attributes of self, whose keys should be treated as attributes of self.

delegate_attr_objects: List[str] = []

A list of names (strings) of objects which are (or will be) attributes of self, whose attributes should be passed through to self.

device_clear() None

Clear the buffers of the device

static exist(name: str, instrument_class: Optional[type] = None) bool

Check if an instrument with a given names exists (i.e. is already instantiated).

Parameters
  • name – Name of the instrument.

  • instrument_class – The type of instrument you are looking for.

classmethod find_instrument(name: str, instrument_class: Optional[type] = None) qcodes.instrument.base.Instrument

Find an existing instrument by name.

Parameters
  • name – Name of the instrument.

  • instrument_class – The type of instrument you are looking for.

Returns

The instrument found.

Raises
  • KeyError – If no instrument of that name was found, or if its reference is invalid (dead).

  • TypeError – If a specific class was requested but a different type was found.

property full_name: str
get(param_name: str) Any

Shortcut for getting a parameter from its name.

Parameters

param_name – The name of a parameter of this instrument.

Returns

The current value of the parameter.

get_idn() Dict[str, Optional[str]]

Parse a standard VISA *IDN? response into an ID dict.

Even though this is the VISA standard, it applies to various other types as well, such as IPInstruments, so it is included here in the Instrument base class.

Override this if your instrument does not support *IDN? or returns a nonstandard IDN string. This string is supposed to be a comma-separated list of vendor, model, serial, and firmware, but semicolon and colon are also common separators so we accept them here as well.

Returns

A dict containing vendor, model, serial, and firmware.

classmethod instances() List[qcodes.instrument.base.Instrument]

Get all currently defined instances of this instrument class.

You can use this to get the objects back if you lose track of them, and it’s also used by the test system to find objects to test against.

Returns

A list of instances.

static is_valid(instr_instance: qcodes.instrument.base.Instrument) bool

Check if a given instance of an instrument is valid: if an instrument has been closed, its instance is not longer a “valid” instrument.

Parameters

instr_instance – Instance of an Instrument class or its subclass.

load_metadata(metadata: Dict[Any, Any]) None

Load metadata into this classes metadata dictionary.

Parameters

metadata – Metadata to load.

static makeSEQXFile(trig_waits: Sequence[int], nreps: Sequence[int], event_jumps: Sequence[int], event_jump_to: Sequence[int], go_to: Sequence[int], wfms: Sequence[Sequence[numpy.ndarray]], amplitudes: Sequence[float], seqname: str) bytes[source]

Make a full .seqx file (bundle) A .seqx file can presumably hold several sequences, but for now we support only packing a single sequence

For a single sequence, a .seqx file is a bundle of two files and two folders:

/Sequences

sequence.sml

/Waveforms

wfm1.wfmx wfm2.wfmx …

setup.xml userNotes.txt

Parameters
  • trig_waits – Wait for a trigger? If yes, you must specify the trigger input. 0 for off, 1 for ‘TrigA’, 2 for ‘TrigB’, 3 for ‘Internal’.

  • nreps – No. of repetitions. 0 corresponds to infinite.

  • event_jumps – Jump when event triggered? If yes, you must specify the trigger input. 0 for off, 1 for ‘TrigA’, 2 for ‘TrigB’, 3 for ‘Internal’.

  • event_jump_to – Jump target in case of event. 1-indexed, 0 means next. Must be specified for all elements.

  • go_to – Which element to play next. 1-indexed, 0 means next.

  • wfms – numpy arrays describing each waveform plus two markers, packed like np.array([wfm, m1, m2]). These numpy arrays are then again packed in lists according to: [[wfmch1pos1, wfmch1pos2, …], [wfmch2pos1, …], …]

  • amplitudes – The peak-to-peak amplitude in V of the channels, i.e. a list [ch1_amp, ch2_amp].

  • seqname – The name of the sequence. This name will appear in the sequence list. Note that all spaces are converted to ‘_’

Returns

The binary .seqx file, ready to be sent to the instrument.

property name: str

Name of the instrument

property name_parts: List[str]
omit_delegate_attrs: List[str] = []

A list of attribute names (strings) to not delegate to any other dictionary or object.

property parent: Optional[qcodes.instrument.base.InstrumentBase]

Returns the parent instrument. By default this is None. Any SubInstrument should subclass this to return the parent instrument.

print_readable_snapshot(update: bool = False, max_chars: int = 80) None

Prints a readable version of the snapshot. The readable snapshot includes the name, value and unit of each parameter. A convenience function to quickly get an overview of the status of an instrument.

Parameters
  • update – If True, update the state by querying the instrument. If False, just use the latest values in memory. This argument gets passed to the snapshot function.

  • max_chars – the maximum number of characters per line. The readable snapshot will be cropped if this value is exceeded. Defaults to 80 to be consistent with default terminal width.

classmethod record_instance(instance: qcodes.instrument.base.Instrument) None

Record (a weak ref to) an instance in a class’s instance list.

Also records the instance in list of all instruments, and verifies that there are no other instruments with the same name.

Parameters

instance – Instance to record.

Raises

KeyError – If another instance with the same name is already present.

classmethod remove_instance(instance: qcodes.instrument.base.Instrument) None

Remove a particular instance from the record.

Parameters

instance – The instance to remove

property root_instrument: qcodes.instrument.base.InstrumentBase
set(param_name: str, value: Any) None

Shortcut for setting a parameter from its name and new value.

Parameters
  • param_name – The name of a parameter of this instrument.

  • value – The new value to set.

set_address(address: str) None

Set the address for this instrument.

Parameters

address – The visa resource name to use to connect. The address should be the actual address and just that. If you wish to change the backend for VISA, use the self.visalib attribute (and then call this function).

set_terminator(terminator: str) None

Change the read terminator to use.

Parameters

terminator – Character(s) to look for at the end of a read. eg. \r\n.

shared_kwargs = ()
property short_name: str

Short name of the instrument

snapshot(update: Optional[bool] = False) Dict[Any, Any]

Decorate a snapshot dictionary with metadata. DO NOT override this method if you want metadata in the snapshot instead, override snapshot_base().

Parameters

update – Passed to snapshot_base.

Returns

Base snapshot.

snapshot_base(update: Optional[bool] = True, params_to_skip_update: Optional[Sequence[str]] = None) Dict[Any, Any]

State of the instrument as a JSON-compatible dict (everything that the custom JSON encoder class qcodes.utils.helpers.NumpyJSONEncoder supports).

Parameters
  • update – If True, update the state by querying the instrument. If None only update if the state is known to be invalid. If False, just use the latest values in memory and never update.

  • params_to_skip_update – List of parameter names that will be skipped in update even if update is True. This is useful if you have parameters that are slow to update but can be updated in a different way (as in the qdac). If you want to skip the update of certain parameters in all snapshots, use the snapshot_get attribute of those parameters instead.

Returns

base snapshot

Return type

dict

validate_status(verbose: bool = False) None

Validate the values of all gettable parameters

The validation is done for all parameters that have both a get and set method.

Parameters

verbose – If True, then information about the parameters that are being check is printed.

write(cmd: str) None

Write a command string with NO response to the hardware.

Subclasses that transform cmd should override this method, and in it call super().write(new_cmd). Subclasses that define a new hardware communication should instead override write_raw.

Parameters

cmd – The string to send to the instrument.

Raises

Exception – Wraps any underlying exception with extra context, including the command and the instrument.

write_raw(cmd: str) None

Low-level interface to visa_handle.write.

Parameters

cmd – The command to send to the instrument.

parameters: Dict[str, _BaseParameter] = {}

All the parameters supported by this instrument. Usually populated via add_parameter().

functions: Dict[str, Function] = {}

All the functions supported by this instrument. Usually populated via add_function().

submodules: Dict[str, Union['InstrumentBase', 'ChannelList']] = {}

All the submodules of this instrument such as channel lists or logical groupings of parameters. Usually populated via add_submodule().

log: InstrumentLoggerAdapter = get_instrument_logger(self, __name__)
class qcodes.instrument_drivers.tektronix.AWG70000A.AWGChannel(parent: qcodes.instrument.base.Instrument, name: str, channel: int)[source]

Bases: qcodes.instrument.channel.InstrumentChannel

Class to hold a channel of the AWG.

Parameters
  • parent – The Instrument instance to which the channel is to be attached.

  • name – The name used in the DataSet

  • channel – The channel number, either 1 or 2.

setWaveform(name: str) None[source]

Select a waveform from the waveform list to output on this channel

Parameters

name – The name of the waveform

setSequenceTrack(seqname: str, tracknr: int) None[source]

Assign a track from a sequence to this channel.

Parameters
  • seqname – Name of the sequence in the sequence list

  • tracknr – Which track to use (1 or 2)

__getitem__(key: str) Union[Callable[[...], Any], qcodes.instrument.parameter.Parameter]

Delegate instrument[‘name’] to parameter or function ‘name’.

__getstate__() None

Prevent pickling instruments, and give a nice error message.

__repr__() str

Custom repr to give parent information

add_function(name: str, **kwargs: Any) None

Bind one Function to this instrument.

Instrument subclasses can call this repeatedly in their __init__ for every real function of the instrument.

This functionality is meant for simple cases, principally things that map to simple commands like *RST (reset) or those with just a few arguments. It requires a fixed argument count, and positional args only. If your case is more complicated, you’re probably better off simply making a new method in your Instrument subclass definition.

Parameters
  • name – How the Function will be stored within instrument.Functions and also how you address it using the shortcut methods: instrument.call(func_name, *args) etc.

  • **kwargs – constructor kwargs for Function

Raises

KeyError – If this instrument already has a function with this name.

add_parameter(name: str, parameter_class: type = <class 'qcodes.instrument.parameter.Parameter'>, **kwargs: Any) None

Bind one Parameter to this instrument.

Instrument subclasses can call this repeatedly in their __init__ for every real parameter of the instrument.

In this sense, parameters are the state variables of the instrument, anything the user can set and/or get.

Parameters
  • name – How the parameter will be stored within instrument.parameters and also how you address it using the shortcut methods: instrument.set(param_name, value) etc.

  • parameter_class – You can construct the parameter out of any class. Default parameter.Parameter.

  • **kwargs – Constructor arguments for parameter_class.

Raises
  • KeyError – If this instrument already has a parameter with this name and the parameter being replaced is not an abstract parameter.

  • ValueError – If there is an existing abstract parameter and the unit of the new parameter is inconsistent with the existing one.

add_submodule(name: str, submodule: Union[InstrumentBase, ChannelList]) None

Bind one submodule to this instrument.

Instrument subclasses can call this repeatedly in their __init__ method for every submodule of the instrument.

Submodules can effectively be considered as instruments within the main instrument, and should at minimum be snapshottable. For example, they can be used to either store logical groupings of parameters, which may or may not be repeated, or channel lists.

Parameters
  • name – How the submodule will be stored within instrument.submodules and also how it can be addressed.

  • submodule – The submodule to be stored.

Raises
  • KeyError – If this instrument already contains a submodule with this name.

  • TypeError – If the submodule that we are trying to add is not an instance of an Metadatable object.

property ancestors: List[qcodes.instrument.base.InstrumentBase]

Returns a list of instruments, starting from the current instrument and following to the parent instrument and the parents parent instrument until the root instrument is reached.

ask(cmd: str) str
ask_raw(cmd: str) str
call(func_name: str, *args: Any) Any

Shortcut for calling a function from its name.

Parameters
  • func_name – The name of a function of this instrument.

  • *args – any arguments to the function.

Returns

The return value of the function.

delegate_attr_dicts: List[str] = ['parameters', 'functions', 'submodules']

A list of names (strings) of dictionaries which are (or will be) attributes of self, whose keys should be treated as attributes of self.

delegate_attr_objects: List[str] = []

A list of names (strings) of objects which are (or will be) attributes of self, whose attributes should be passed through to self.

property full_name: str
get(param_name: str) Any

Shortcut for getting a parameter from its name.

Parameters

param_name – The name of a parameter of this instrument.

Returns

The current value of the parameter.

load_metadata(metadata: Dict[Any, Any]) None

Load metadata into this classes metadata dictionary.

Parameters

metadata – Metadata to load.

property name: str

Name of the instrument

property name_parts: List[str]
omit_delegate_attrs: List[str] = []

A list of attribute names (strings) to not delegate to any other dictionary or object.

property parent: qcodes.instrument.base.InstrumentBase

Returns the parent instrument. By default this is None. Any SubInstrument should subclass this to return the parent instrument.

print_readable_snapshot(update: bool = False, max_chars: int = 80) None

Prints a readable version of the snapshot. The readable snapshot includes the name, value and unit of each parameter. A convenience function to quickly get an overview of the status of an instrument.

Parameters
  • update – If True, update the state by querying the instrument. If False, just use the latest values in memory. This argument gets passed to the snapshot function.

  • max_chars – the maximum number of characters per line. The readable snapshot will be cropped if this value is exceeded. Defaults to 80 to be consistent with default terminal width.

property root_instrument: qcodes.instrument.base.InstrumentBase
set(param_name: str, value: Any) None

Shortcut for setting a parameter from its name and new value.

Parameters
  • param_name – The name of a parameter of this instrument.

  • value – The new value to set.

property short_name: str

Short name of the instrument

snapshot(update: Optional[bool] = False) Dict[Any, Any]

Decorate a snapshot dictionary with metadata. DO NOT override this method if you want metadata in the snapshot instead, override snapshot_base().

Parameters

update – Passed to snapshot_base.

Returns

Base snapshot.

snapshot_base(update: Optional[bool] = False, params_to_skip_update: Optional[Sequence[str]] = None) Dict[Any, Any]

State of the instrument as a JSON-compatible dict (everything that the custom JSON encoder class qcodes.utils.helpers.NumpyJSONEncoder supports).

Parameters
  • update – If True, update the state by querying the instrument. If None update the state if known to be invalid. If False, just use the latest values in memory and never update state.

  • params_to_skip_update – List of parameter names that will be skipped in update even if update is True. This is useful if you have parameters that are slow to update but can be updated in a different way (as in the qdac). If you want to skip the update of certain parameters in all snapshots, use the snapshot_get attribute of those parameters instead.

Returns

base snapshot

Return type

dict

validate_status(verbose: bool = False) None

Validate the values of all gettable parameters

The validation is done for all parameters that have both a get and set method.

Parameters

verbose – If True, then information about the parameters that are being check is printed.

write(cmd: str) None
write_raw(cmd: str) None
parameters: Dict[str, _BaseParameter] = {}

All the parameters supported by this instrument. Usually populated via add_parameter().

functions: Dict[str, Function] = {}

All the functions supported by this instrument. Usually populated via add_function().

submodules: Dict[str, Union['InstrumentBase', 'ChannelList']] = {}

All the submodules of this instrument such as channel lists or logical groupings of parameters. Usually populated via add_submodule().

class qcodes.instrument_drivers.tektronix.AWG70000A.SRValidator(awg: qcodes.instrument_drivers.tektronix.AWG70000A.AWG70000A)[source]

Bases: qcodes.utils.validators.Validator[float]

Validator to validate the AWG clock sample rate

Parameters

awg – The parent instrument instance. We need this since sample rate validation depends on many clock settings

validate(value: float, context: str = '') None[source]
is_numeric = False
property valid_values: Tuple[qcodes.utils.validators.T, ...]

qcodes.instrument_drivers.tektronix.AWG70002A module

class qcodes.instrument_drivers.tektronix.AWG70002A.AWG70002A(name: str, address: str, timeout: float = 10, **kwargs: Any)[source]

Bases: qcodes.instrument_drivers.tektronix.AWG70000A.AWG70000A

The QCoDeS driver for Tektronix AWG70002A series AWG’s.

All the actual driver meat is in the superclass AWG70000A.

Parameters
  • name – The name used internally by QCoDeS in the DataSet

  • address – The VISA resource name of the instrument

  • timeout – The VISA timeout time (in seconds).

__del__() None

Close the instrument and remove its instance record.

__getitem__(key: str) Union[Callable[[...], Any], qcodes.instrument.parameter.Parameter]

Delegate instrument[‘name’] to parameter or function ‘name’.

__getstate__() None

Prevent pickling instruments, and give a nice error message.

__repr__() str

Simplified repr giving just the class and name.

add_function(name: str, **kwargs: Any) None

Bind one Function to this instrument.

Instrument subclasses can call this repeatedly in their __init__ for every real function of the instrument.

This functionality is meant for simple cases, principally things that map to simple commands like *RST (reset) or those with just a few arguments. It requires a fixed argument count, and positional args only. If your case is more complicated, you’re probably better off simply making a new method in your Instrument subclass definition.

Parameters
  • name – How the Function will be stored within instrument.Functions and also how you address it using the shortcut methods: instrument.call(func_name, *args) etc.

  • **kwargs – constructor kwargs for Function

Raises

KeyError – If this instrument already has a function with this name.

add_parameter(name: str, parameter_class: type = <class 'qcodes.instrument.parameter.Parameter'>, **kwargs: Any) None

Bind one Parameter to this instrument.

Instrument subclasses can call this repeatedly in their __init__ for every real parameter of the instrument.

In this sense, parameters are the state variables of the instrument, anything the user can set and/or get.

Parameters
  • name – How the parameter will be stored within instrument.parameters and also how you address it using the shortcut methods: instrument.set(param_name, value) etc.

  • parameter_class – You can construct the parameter out of any class. Default parameter.Parameter.

  • **kwargs – Constructor arguments for parameter_class.

Raises
  • KeyError – If this instrument already has a parameter with this name and the parameter being replaced is not an abstract parameter.

  • ValueError – If there is an existing abstract parameter and the unit of the new parameter is inconsistent with the existing one.

add_submodule(name: str, submodule: Union[InstrumentBase, ChannelList]) None

Bind one submodule to this instrument.

Instrument subclasses can call this repeatedly in their __init__ method for every submodule of the instrument.

Submodules can effectively be considered as instruments within the main instrument, and should at minimum be snapshottable. For example, they can be used to either store logical groupings of parameters, which may or may not be repeated, or channel lists.

Parameters
  • name – How the submodule will be stored within instrument.submodules and also how it can be addressed.

  • submodule – The submodule to be stored.

Raises
  • KeyError – If this instrument already contains a submodule with this name.

  • TypeError – If the submodule that we are trying to add is not an instance of an Metadatable object.

property ancestors: List[qcodes.instrument.base.InstrumentBase]

Returns a list of instruments, starting from the current instrument and following to the parent instrument and the parents parent instrument until the root instrument is reached.

ask(cmd: str) str

Write a command string to the hardware and return a response.

Subclasses that transform cmd should override this method, and in it call super().ask(new_cmd). Subclasses that define a new hardware communication should instead override ask_raw.

Parameters

cmd – The string to send to the instrument.

Returns

response

Raises

Exception – Wraps any underlying exception with extra context, including the command and the instrument.

ask_raw(cmd: str) str

Low-level interface to visa_handle.ask.

Parameters

cmd – The command to send to the instrument.

Returns

The instrument’s response.

Return type

str

call(func_name: str, *args: Any) Any

Shortcut for calling a function from its name.

Parameters
  • func_name – The name of a function of this instrument.

  • *args – any arguments to the function.

Returns

The return value of the function.

check_error(ret_code: int) None

Default error checking, raises an error if return code !=0. Does not differentiate between warnings or specific error messages. Override this function in your driver if you want to add specific error messages.

Parameters

ret_code – A Visa error code. See eg: https://github.com/hgrecco/pyvisa/blob/master/pyvisa/errors.py

Raises

visa.VisaIOError – if ret_code indicates a communication problem.

clearSequenceList() None

Clear the sequence list

clearWaveformList() None

Clear the waveform list

close() None

Disconnect and irreversibly tear down the instrument.

classmethod close_all() None

Try to close all instruments registered in _all_instruments This is handy for use with atexit to ensure that all instruments are closed when a python session is closed.

Examples

>>> atexit.register(qc.Instrument.close_all())
connect_message(idn_param: str = 'IDN', begin_time: Optional[float] = None) None

Print a standard message on initial connection to an instrument.

Parameters
  • idn_param – Name of parameter that returns ID dict. Default IDN.

  • begin_timetime.time() when init started. Default is self._t0, set at start of Instrument.__init__.

delegate_attr_dicts: List[str] = ['parameters', 'functions', 'submodules']

A list of names (strings) of dictionaries which are (or will be) attributes of self, whose keys should be treated as attributes of self.

delegate_attr_objects: List[str] = []

A list of names (strings) of objects which are (or will be) attributes of self, whose attributes should be passed through to self.

delete_sequence_from_list(seqname: str) None

Delete the specified sequence from the sequence list

Parameters

seqname – The name of the sequence (as it appears in the sequence list, not the file name) to delete

device_clear() None

Clear the buffers of the device

static exist(name: str, instrument_class: Optional[type] = None) bool

Check if an instrument with a given names exists (i.e. is already instantiated).

Parameters
  • name – Name of the instrument.

  • instrument_class – The type of instrument you are looking for.

classmethod find_instrument(name: str, instrument_class: Optional[type] = None) qcodes.instrument.base.Instrument

Find an existing instrument by name.

Parameters
  • name – Name of the instrument.

  • instrument_class – The type of instrument you are looking for.

Returns

The instrument found.

Raises
  • KeyError – If no instrument of that name was found, or if its reference is invalid (dead).

  • TypeError – If a specific class was requested but a different type was found.

force_triggerA() None

Force a trigger A event

force_triggerB() None

Force a trigger B event

property full_name: str
get(param_name: str) Any

Shortcut for getting a parameter from its name.

Parameters

param_name – The name of a parameter of this instrument.

Returns

The current value of the parameter.

get_idn() Dict[str, Optional[str]]

Parse a standard VISA *IDN? response into an ID dict.

Even though this is the VISA standard, it applies to various other types as well, such as IPInstruments, so it is included here in the Instrument base class.

Override this if your instrument does not support *IDN? or returns a nonstandard IDN string. This string is supposed to be a comma-separated list of vendor, model, serial, and firmware, but semicolon and colon are also common separators so we accept them here as well.

Returns

A dict containing vendor, model, serial, and firmware.

classmethod instances() List[qcodes.instrument.base.Instrument]

Get all currently defined instances of this instrument class.

You can use this to get the objects back if you lose track of them, and it’s also used by the test system to find objects to test against.

Returns

A list of instances.

static is_valid(instr_instance: qcodes.instrument.base.Instrument) bool

Check if a given instance of an instrument is valid: if an instrument has been closed, its instance is not longer a “valid” instrument.

Parameters

instr_instance – Instance of an Instrument class or its subclass.

loadSEQXFile(filename: str, path: Optional[str] = None) None

Load a seqx file from instrument disk memory. All sequences in the file are loaded into the sequence list.

Parameters
  • filename – The name of the sequence file INCLUDING the extension

  • path – Path to load from. If omitted, the default path (self.seqxFileFolder) is used.

loadWFMXFile(filename: str, path: Optional[str] = None) None

Loads a wfmx from memory into the waveform list Only loading from the C: drive is supported

Parameters
  • filename – Name of the file (with extension)

  • path – Path to load from. If omitted, the default path (self.wfmxFileFolder) is used.

load_metadata(metadata: Dict[Any, Any]) None

Load metadata into this classes metadata dictionary.

Parameters

metadata – Metadata to load.

static makeSEQXFile(trig_waits: Sequence[int], nreps: Sequence[int], event_jumps: Sequence[int], event_jump_to: Sequence[int], go_to: Sequence[int], wfms: Sequence[Sequence[numpy.ndarray]], amplitudes: Sequence[float], seqname: str) bytes

Make a full .seqx file (bundle) A .seqx file can presumably hold several sequences, but for now we support only packing a single sequence

For a single sequence, a .seqx file is a bundle of two files and two folders:

/Sequences

sequence.sml

/Waveforms

wfm1.wfmx wfm2.wfmx …

setup.xml userNotes.txt

Parameters
  • trig_waits – Wait for a trigger? If yes, you must specify the trigger input. 0 for off, 1 for ‘TrigA’, 2 for ‘TrigB’, 3 for ‘Internal’.

  • nreps – No. of repetitions. 0 corresponds to infinite.

  • event_jumps – Jump when event triggered? If yes, you must specify the trigger input. 0 for off, 1 for ‘TrigA’, 2 for ‘TrigB’, 3 for ‘Internal’.

  • event_jump_to – Jump target in case of event. 1-indexed, 0 means next. Must be specified for all elements.

  • go_to – Which element to play next. 1-indexed, 0 means next.

  • wfms – numpy arrays describing each waveform plus two markers, packed like np.array([wfm, m1, m2]). These numpy arrays are then again packed in lists according to: [[wfmch1pos1, wfmch1pos2, …], [wfmch2pos1, …], …]

  • amplitudes – The peak-to-peak amplitude in V of the channels, i.e. a list [ch1_amp, ch2_amp].

  • seqname – The name of the sequence. This name will appear in the sequence list. Note that all spaces are converted to ‘_’

Returns

The binary .seqx file, ready to be sent to the instrument.

static makeWFMXFile(data: numpy.ndarray, amplitude: float) bytes

Compose a WFMX file

Parameters
  • data – A numpy array holding the data. Markers can be included.

  • amplitude – The peak-to-peak amplitude (V) assumed to be set on the channel that will play this waveform. This information is needed as the waveform must be rescaled to (-1, 1) where -1 will correspond to the channel’s min. voltage and 1 to the channel’s max. voltage.

Returns

The binary .wfmx file, ready to be sent to the instrument.

static make_SEQX_from_forged_sequence(seq: Dict[int, Dict[Any, Any]], amplitudes: List[float], seqname: str, channel_mapping: Optional[Dict[Union[str, int], int]] = None) bytes

Make a .seqx from a forged broadbean sequence. Supports subsequences.

Parameters
  • seq – The output of broadbean’s Sequence.forge()

  • amplitudes – A list of the AWG channels’ voltage amplitudes. The first entry is ch1 etc.

  • channel_mapping – A mapping from what the channel is called in the broadbean sequence to the integer describing the physical channel it should be assigned to.

  • seqname – The name that the sequence will have in the AWG’s sequence list. Used for loading the sequence.

Returns

The binary .seqx file contents. Can be sent directly to the

instrument or saved on disk.

property name: str

Name of the instrument

property name_parts: List[str]
omit_delegate_attrs: List[str] = []

A list of attribute names (strings) to not delegate to any other dictionary or object.

property parent: Optional[qcodes.instrument.base.InstrumentBase]

Returns the parent instrument. By default this is None. Any SubInstrument should subclass this to return the parent instrument.

play(wait_for_running: bool = True, timeout: float = 10) None

Run the AWG/Func. Gen. This command is equivalent to pressing the play button on the front panel.

Parameters
  • wait_for_running – If True, this command is blocking while the instrument is getting ready to play

  • timeout – The maximal time to wait for the instrument to play. Raises an exception is this time is reached.

print_readable_snapshot(update: bool = False, max_chars: int = 80) None

Prints a readable version of the snapshot. The readable snapshot includes the name, value and unit of each parameter. A convenience function to quickly get an overview of the status of an instrument.

Parameters
  • update – If True, update the state by querying the instrument. If False, just use the latest values in memory. This argument gets passed to the snapshot function.

  • max_chars – the maximum number of characters per line. The readable snapshot will be cropped if this value is exceeded. Defaults to 80 to be consistent with default terminal width.

classmethod record_instance(instance: qcodes.instrument.base.Instrument) None

Record (a weak ref to) an instance in a class’s instance list.

Also records the instance in list of all instruments, and verifies that there are no other instruments with the same name.

Parameters

instance – Instance to record.

Raises

KeyError – If another instance with the same name is already present.

classmethod remove_instance(instance: qcodes.instrument.base.Instrument) None

Remove a particular instance from the record.

Parameters

instance – The instance to remove

property root_instrument: qcodes.instrument.base.InstrumentBase
sendSEQXFile(seqx: bytes, filename: str, path: Optional[str] = None) None

Send a binary seqx file to the AWG’s memory

Parameters
  • seqx – The binary seqx file, preferably the output of makeSEQXFile.

  • filename – The name of the file on the AWG disk, including the extension.

  • path – The path to the directory where the file should be saved. If omitted, seqxFileFolder will be used.

sendWFMXFile(wfmx: bytes, filename: str, path: Optional[str] = None) None

Send a binary wfmx file to the AWG’s memory

Parameters
  • wfmx – The binary wfmx file, preferably the output of makeWFMXFile.

  • filename – The name of the file on the AWG disk, including the extension.

  • path – The path to the directory where the file should be saved. If omitted, seqxFileFolder will be used.

property sequenceList: List[str]

Return the sequence list as a list of strings

set(param_name: str, value: Any) None

Shortcut for setting a parameter from its name and new value.

Parameters
  • param_name – The name of a parameter of this instrument.

  • value – The new value to set.

set_address(address: str) None

Set the address for this instrument.

Parameters

address – The visa resource name to use to connect. The address should be the actual address and just that. If you wish to change the backend for VISA, use the self.visalib attribute (and then call this function).

set_terminator(terminator: str) None

Change the read terminator to use.

Parameters

terminator – Character(s) to look for at the end of a read. eg. \r\n.

shared_kwargs = ()
property short_name: str

Short name of the instrument

snapshot(update: Optional[bool] = False) Dict[Any, Any]

Decorate a snapshot dictionary with metadata. DO NOT override this method if you want metadata in the snapshot instead, override snapshot_base().

Parameters

update – Passed to snapshot_base.

Returns

Base snapshot.

snapshot_base(update: Optional[bool] = True, params_to_skip_update: Optional[Sequence[str]] = None) Dict[Any, Any]

State of the instrument as a JSON-compatible dict (everything that the custom JSON encoder class qcodes.utils.helpers.NumpyJSONEncoder supports).

Parameters
  • update – If True, update the state by querying the instrument. If None only update if the state is known to be invalid. If False, just use the latest values in memory and never update.

  • params_to_skip_update – List of parameter names that will be skipped in update even if update is True. This is useful if you have parameters that are slow to update but can be updated in a different way (as in the qdac). If you want to skip the update of certain parameters in all snapshots, use the snapshot_get attribute of those parameters instead.

Returns

base snapshot

Return type

dict

stop() None

Stop the output of the instrument. This command is equivalent to pressing the stop button on the front panel.

validate_status(verbose: bool = False) None

Validate the values of all gettable parameters

The validation is done for all parameters that have both a get and set method.

Parameters

verbose – If True, then information about the parameters that are being check is printed.

wait_for_operation_to_complete() None

Waits for the latest issued overlapping command to finish

property waveformList: List[str]

Return the waveform list as a list of strings

write(cmd: str) None

Write a command string with NO response to the hardware.

Subclasses that transform cmd should override this method, and in it call super().write(new_cmd). Subclasses that define a new hardware communication should instead override write_raw.

Parameters

cmd – The string to send to the instrument.

Raises

Exception – Wraps any underlying exception with extra context, including the command and the instrument.

write_raw(cmd: str) None

Low-level interface to visa_handle.write.

Parameters

cmd – The command to send to the instrument.

visabackend: str = str
visa_handle: visa.resources.MessageBasedResource = visa.resources.MessageBasedResource
visalib: Optional[str] = Optional[str]
parameters: Dict[str, _BaseParameter] = {}

All the parameters supported by this instrument. Usually populated via add_parameter().

functions: Dict[str, Function] = {}

All the functions supported by this instrument. Usually populated via add_function().

submodules: Dict[str, Union['InstrumentBase', 'ChannelList']] = {}

All the submodules of this instrument such as channel lists or logical groupings of parameters. Usually populated via add_submodule().

log: InstrumentLoggerAdapter = get_instrument_logger(self, __name__)

qcodes.instrument_drivers.tektronix.AWGFileParser module

qcodes.instrument_drivers.tektronix.AWGFileParser.parse_awg_file(awgfilepath: str) Tuple[Tuple[List[List[Dict[Any, Any]]], List[List[Dict[Any, Any]]], List[List[Dict[Any, Any]]], List[Union[str, int]], List[Union[str, int]], List[Union[str, int]], List[Union[str, int]], List[int]], Dict[str, Union[str, int, Tuple[Any, ...]]]][source]

Parser for a binary .awg file. Returns a tuple matching the call signature of make_send_and_load_awg_file and a dictionary with instrument settings

NOTE: Build-in waveforms are not stored in .awg files. Blame tektronix.

Parameters

awgfilepath – The absolute path to the awg file

Returns

A tuple and a dict, where the tuple is (wfms, m1s, m2s, nreps, trigs, gotos, jumps, channels) and the dict contains all instrument settings from the file

qcodes.instrument_drivers.tektronix.DPO7200xx module

QCoDeS driver for the MSO/DPO5000/B, DPO7000/C, DPO70000/B/C/D/DX/SX, DSA70000/B/C/D, and MSO70000/C/DX Series Digital Oscilloscopes

exception qcodes.instrument_drivers.tektronix.DPO7200xx.ModeError[source]

Bases: Exception

Raise this exception if we are in a wrong mode to perform an action

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

class qcodes.instrument_drivers.tektronix.DPO7200xx.TekronixDPOTrigger(parent: qcodes.instrument.base.Instrument, name: str, delayed_trigger: bool = False)[source]

Bases: qcodes.instrument.channel.InstrumentChannel

Submodule for trigger setup.

You can trigger with the A (Main) trigger system alone or combine the A (Main) trigger with the B (Delayed) trigger to trigger on sequential events. When using sequential triggering, the A trigger event arms the trigger system, and the B trigger event triggers the instrument when the B trigger conditions are met.

A and B triggers can (and typically do) have separate sources. The B trigger condition is based on a time delay or a specified number of events.

See page75, Using A (Main) and B (Delayed) triggers. https://download.tek.com/manual/MSO70000C-DX-DPO70000C-DX-MSO-DPO7000C-MSO-DPO5000B-Oscilloscope-Quick-Start-User-Manual-071298006.pdf

__getitem__(key: str) Union[Callable[[...], Any], qcodes.instrument.parameter.Parameter]

Delegate instrument[‘name’] to parameter or function ‘name’.

__getstate__() None

Prevent pickling instruments, and give a nice error message.

__repr__() str

Custom repr to give parent information

add_function(name: str, **kwargs: Any) None

Bind one Function to this instrument.

Instrument subclasses can call this repeatedly in their __init__ for every real function of the instrument.

This functionality is meant for simple cases, principally things that map to simple commands like *RST (reset) or those with just a few arguments. It requires a fixed argument count, and positional args only. If your case is more complicated, you’re probably better off simply making a new method in your Instrument subclass definition.

Parameters
  • name – How the Function will be stored within instrument.Functions and also how you address it using the shortcut methods: instrument.call(func_name, *args) etc.

  • **kwargs – constructor kwargs for Function

Raises

KeyError – If this instrument already has a function with this name.

add_parameter(name: str, parameter_class: type = <class 'qcodes.instrument.parameter.Parameter'>, **kwargs: Any) None

Bind one Parameter to this instrument.

Instrument subclasses can call this repeatedly in their __init__ for every real parameter of the instrument.

In this sense, parameters are the state variables of the instrument, anything the user can set and/or get.

Parameters
  • name – How the parameter will be stored within instrument.parameters and also how you address it using the shortcut methods: instrument.set(param_name, value) etc.

  • parameter_class – You can construct the parameter out of any class. Default parameter.Parameter.

  • **kwargs – Constructor arguments for parameter_class.

Raises
  • KeyError – If this instrument already has a parameter with this name and the parameter being replaced is not an abstract parameter.

  • ValueError – If there is an existing abstract parameter and the unit of the new parameter is inconsistent with the existing one.

add_submodule(name: str, submodule: Union[InstrumentBase, ChannelList]) None

Bind one submodule to this instrument.

Instrument subclasses can call this repeatedly in their __init__ method for every submodule of the instrument.

Submodules can effectively be considered as instruments within the main instrument, and should at minimum be snapshottable. For example, they can be used to either store logical groupings of parameters, which may or may not be repeated, or channel lists.

Parameters
  • name – How the submodule will be stored within instrument.submodules and also how it can be addressed.

  • submodule – The submodule to be stored.

Raises
  • KeyError – If this instrument already contains a submodule with this name.

  • TypeError – If the submodule that we are trying to add is not an instance of an Metadatable object.

property ancestors: List[qcodes.instrument.base.InstrumentBase]

Returns a list of instruments, starting from the current instrument and following to the parent instrument and the parents parent instrument until the root instrument is reached.

ask(cmd: str) str
ask_raw(cmd: str) str
call(func_name: str, *args: Any) Any

Shortcut for calling a function from its name.

Parameters
  • func_name – The name of a function of this instrument.

  • *args – any arguments to the function.

Returns

The return value of the function.

delegate_attr_dicts: List[str] = ['parameters', 'functions', 'submodules']

A list of names (strings) of dictionaries which are (or will be) attributes of self, whose keys should be treated as attributes of self.

delegate_attr_objects: List[str] = []

A list of names (strings) of objects which are (or will be) attributes of self, whose attributes should be passed through to self.

property full_name: str
get(param_name: str) Any

Shortcut for getting a parameter from its name.

Parameters

param_name – The name of a parameter of this instrument.

Returns

The current value of the parameter.

load_metadata(metadata: Dict[Any, Any]) None

Load metadata into this classes metadata dictionary.

Parameters

metadata – Metadata to load.

property name: str

Name of the instrument

property name_parts: List[str]
omit_delegate_attrs: List[str] = []

A list of attribute names (strings) to not delegate to any other dictionary or object.

property parent: qcodes.instrument.base.InstrumentBase

Returns the parent instrument. By default this is None. Any SubInstrument should subclass this to return the parent instrument.

print_readable_snapshot(update: bool = False, max_chars: int = 80) None

Prints a readable version of the snapshot. The readable snapshot includes the name, value and unit of each parameter. A convenience function to quickly get an overview of the status of an instrument.

Parameters
  • update – If True, update the state by querying the instrument. If False, just use the latest values in memory. This argument gets passed to the snapshot function.

  • max_chars – the maximum number of characters per line. The readable snapshot will be cropped if this value is exceeded. Defaults to 80 to be consistent with default terminal width.

property root_instrument: qcodes.instrument.base.InstrumentBase
set(param_name: str, value: Any) None

Shortcut for setting a parameter from its name and new value.

Parameters
  • param_name – The name of a parameter of this instrument.

  • value – The new value to set.

property short_name: str

Short name of the instrument

snapshot(update: Optional[bool] = False) Dict[Any, Any]

Decorate a snapshot dictionary with metadata. DO NOT override this method if you want metadata in the snapshot instead, override snapshot_base().

Parameters

update – Passed to snapshot_base.

Returns

Base snapshot.

snapshot_base(update: Optional[bool] = False, params_to_skip_update: Optional[Sequence[str]] = None) Dict[Any, Any]

State of the instrument as a JSON-compatible dict (everything that the custom JSON encoder class qcodes.utils.helpers.NumpyJSONEncoder supports).

Parameters
  • update – If True, update the state by querying the instrument. If None update the state if known to be invalid. If False, just use the latest values in memory and never update state.

  • params_to_skip_update – List of parameter names that will be skipped in update even if update is True. This is useful if you have parameters that are slow to update but can be updated in a different way (as in the qdac). If you want to skip the update of certain parameters in all snapshots, use the snapshot_get attribute of those parameters instead.

Returns

base snapshot

Return type

dict

validate_status(verbose: bool = False) None

Validate the values of all gettable parameters

The validation is done for all parameters that have both a get and set method.

Parameters

verbose – If True, then information about the parameters that are being check is printed.

write(cmd: str) None
write_raw(cmd: str) None
parameters: Dict[str, _BaseParameter] = {}

All the parameters supported by this instrument. Usually populated via add_parameter().

functions: Dict[str, Function] = {}

All the functions supported by this instrument. Usually populated via add_function().

submodules: Dict[str, Union['InstrumentBase', 'ChannelList']] = {}

All the submodules of this instrument such as channel lists or logical groupings of parameters. Usually populated via add_submodule().

class qcodes.instrument_drivers.tektronix.DPO7200xx.TekronixDPOWaveform(parent: Union[qcodes.instrument.base.Instrument, qcodes.instrument.channel.InstrumentChannel], name: str, identifier: str)[source]

Bases: qcodes.instrument.channel.InstrumentChannel

This submodule retrieves data from waveform sources, e.g. channels.

valid_identifiers = ['CH1', 'CH2', 'CH3', 'CH4', 'MATH1', 'MATH2', 'MATH3', 'MATH4', 'REF1', 'REF2', 'REF3', 'REF4']
__getitem__(key: str) Union[Callable[[...], Any], qcodes.instrument.parameter.Parameter]

Delegate instrument[‘name’] to parameter or function ‘name’.

__getstate__() None

Prevent pickling instruments, and give a nice error message.

__repr__() str

Custom repr to give parent information

add_function(name: str, **kwargs: Any) None

Bind one Function to this instrument.

Instrument subclasses can call this repeatedly in their __init__ for every real function of the instrument.

This functionality is meant for simple cases, principally things that map to simple commands like *RST (reset) or those with just a few arguments. It requires a fixed argument count, and positional args only. If your case is more complicated, you’re probably better off simply making a new method in your Instrument subclass definition.

Parameters
  • name – How the Function will be stored within instrument.Functions and also how you address it using the shortcut methods: instrument.call(func_name, *args) etc.

  • **kwargs – constructor kwargs for Function

Raises

KeyError – If this instrument already has a function with this name.

add_parameter(name: str, parameter_class: type = <class 'qcodes.instrument.parameter.Parameter'>, **kwargs: Any) None

Bind one Parameter to this instrument.

Instrument subclasses can call this repeatedly in their __init__ for every real parameter of the instrument.

In this sense, parameters are the state variables of the instrument, anything the user can set and/or get.

Parameters
  • name – How the parameter will be stored within instrument.parameters and also how you address it using the shortcut methods: instrument.set(param_name, value) etc.

  • parameter_class – You can construct the parameter out of any class. Default parameter.Parameter.

  • **kwargs – Constructor arguments for parameter_class.

Raises
  • KeyError – If this instrument already has a parameter with this name and the parameter being replaced is not an abstract parameter.

  • ValueError – If there is an existing abstract parameter and the unit of the new parameter is inconsistent with the existing one.

add_submodule(name: str, submodule: Union[InstrumentBase, ChannelList]) None

Bind one submodule to this instrument.

Instrument subclasses can call this repeatedly in their __init__ method for every submodule of the instrument.

Submodules can effectively be considered as instruments within the main instrument, and should at minimum be snapshottable. For example, they can be used to either store logical groupings of parameters, which may or may not be repeated, or channel lists.

Parameters
  • name – How the submodule will be stored within instrument.submodules and also how it can be addressed.

  • submodule – The submodule to be stored.

Raises
  • KeyError – If this instrument already contains a submodule with this name.

  • TypeError – If the submodule that we are trying to add is not an instance of an Metadatable object.

property ancestors: List[qcodes.instrument.base.InstrumentBase]

Returns a list of instruments, starting from the current instrument and following to the parent instrument and the parents parent instrument until the root instrument is reached.

ask(cmd: str) str
ask_raw(cmd: str) str
call(func_name: str, *args: Any) Any

Shortcut for calling a function from its name.

Parameters
  • func_name – The name of a function of this instrument.

  • *args – any arguments to the function.

Returns

The return value of the function.

delegate_attr_dicts: List[str] = ['parameters', 'functions', 'submodules']

A list of names (strings) of dictionaries which are (or will be) attributes of self, whose keys should be treated as attributes of self.

delegate_attr_objects: List[str] = []

A list of names (strings) of objects which are (or will be) attributes of self, whose attributes should be passed through to self.

property full_name: str
get(param_name: str) Any

Shortcut for getting a parameter from its name.

Parameters

param_name – The name of a parameter of this instrument.

Returns

The current value of the parameter.

load_metadata(metadata: Dict[Any, Any]) None

Load metadata into this classes metadata dictionary.

Parameters

metadata – Metadata to load.

property name: str

Name of the instrument

property name_parts: List[str]
omit_delegate_attrs: List[str] = []

A list of attribute names (strings) to not delegate to any other dictionary or object.

property parent: qcodes.instrument.base.InstrumentBase

Returns the parent instrument. By default this is None. Any SubInstrument should subclass this to return the parent instrument.

print_readable_snapshot(update: bool = False, max_chars: int = 80) None

Prints a readable version of the snapshot. The readable snapshot includes the name, value and unit of each parameter. A convenience function to quickly get an overview of the status of an instrument.

Parameters
  • update – If True, update the state by querying the instrument. If False, just use the latest values in memory. This argument gets passed to the snapshot function.

  • max_chars – the maximum number of characters per line. The readable snapshot will be cropped if this value is exceeded. Defaults to 80 to be consistent with default terminal width.

property root_instrument: qcodes.instrument.base.InstrumentBase
set(param_name: str, value: Any) None

Shortcut for setting a parameter from its name and new value.

Parameters
  • param_name – The name of a parameter of this instrument.

  • value – The new value to set.

property short_name: str

Short name of the instrument

snapshot(update: Optional[bool] = False) Dict[Any, Any]

Decorate a snapshot dictionary with metadata. DO NOT override this method if you want metadata in the snapshot instead, override snapshot_base().

Parameters

update – Passed to snapshot_base.

Returns

Base snapshot.

snapshot_base(update: Optional[bool] = False, params_to_skip_update: Optional[Sequence[str]] = None) Dict[Any, Any]

State of the instrument as a JSON-compatible dict (everything that the custom JSON encoder class qcodes.utils.helpers.NumpyJSONEncoder supports).

Parameters
  • update – If True, update the state by querying the instrument. If None update the state if known to be invalid. If False, just use the latest values in memory and never update state.

  • params_to_skip_update – List of parameter names that will be skipped in update even if update is True. This is useful if you have parameters that are slow to update but can be updated in a different way (as in the qdac). If you want to skip the update of certain parameters in all snapshots, use the snapshot_get attribute of those parameters instead.

Returns

base snapshot

Return type

dict

validate_status(verbose: bool = False) None

Validate the values of all gettable parameters

The validation is done for all parameters that have both a get and set method.

Parameters

verbose – If True, then information about the parameters that are being check is printed.

write(cmd: str) None
write_raw(cmd: str) None
parameters: Dict[str, _BaseParameter] = {}

All the parameters supported by this instrument. Usually populated via add_parameter().

functions: Dict[str, Function] = {}

All the functions supported by this instrument. Usually populated via add_function().

submodules: Dict[str, Union['InstrumentBase', 'ChannelList']] = {}

All the submodules of this instrument such as channel lists or logical groupings of parameters. Usually populated via add_submodule().

class qcodes.instrument_drivers.tektronix.DPO7200xx.TektronixDPO7000xx(name: str, address: str, **kwargs: Any)[source]

Bases: qcodes.instrument.visa.VisaInstrument

QCoDeS driver for the MSO/DPO5000/B, DPO7000/C, DPO70000/B/C/D/DX/SX, DSA70000/B/C/D, and MSO70000/C/DX Series Digital Oscilloscopes

number_of_channels = 4
number_of_measurements = 8
ask_raw(cmd: str) str[source]

Sometimes the instrument returns non-ascii characters in response strings manually adjust the encoding to latin-1

__del__() None

Close the instrument and remove its instance record.

__getitem__(key: str) Union[Callable[[...], Any], qcodes.instrument.parameter.Parameter]

Delegate instrument[‘name’] to parameter or function ‘name’.

__getstate__() None

Prevent pickling instruments, and give a nice error message.

__repr__() str

Simplified repr giving just the class and name.

add_function(name: str, **kwargs: Any) None

Bind one Function to this instrument.

Instrument subclasses can call this repeatedly in their __init__ for every real function of the instrument.

This functionality is meant for simple cases, principally things that map to simple commands like *RST (reset) or those with just a few arguments. It requires a fixed argument count, and positional args only. If your case is more complicated, you’re probably better off simply making a new method in your Instrument subclass definition.

Parameters
  • name – How the Function will be stored within instrument.Functions and also how you address it using the shortcut methods: instrument.call(func_name, *args) etc.

  • **kwargs – constructor kwargs for Function

Raises

KeyError – If this instrument already has a function with this name.

add_parameter(name: str, parameter_class: type = <class 'qcodes.instrument.parameter.Parameter'>, **kwargs: Any) None

Bind one Parameter to this instrument.

Instrument subclasses can call this repeatedly in their __init__ for every real parameter of the instrument.

In this sense, parameters are the state variables of the instrument, anything the user can set and/or get.

Parameters
  • name – How the parameter will be stored within instrument.parameters and also how you address it using the shortcut methods: instrument.set(param_name, value) etc.

  • parameter_class – You can construct the parameter out of any class. Default parameter.Parameter.

  • **kwargs – Constructor arguments for parameter_class.

Raises
  • KeyError – If this instrument already has a parameter with this name and the parameter being replaced is not an abstract parameter.

  • ValueError – If there is an existing abstract parameter and the unit of the new parameter is inconsistent with the existing one.

add_submodule(name: str, submodule: Union[InstrumentBase, ChannelList]) None

Bind one submodule to this instrument.

Instrument subclasses can call this repeatedly in their __init__ method for every submodule of the instrument.

Submodules can effectively be considered as instruments within the main instrument, and should at minimum be snapshottable. For example, they can be used to either store logical groupings of parameters, which may or may not be repeated, or channel lists.

Parameters
  • name – How the submodule will be stored within instrument.submodules and also how it can be addressed.

  • submodule – The submodule to be stored.

Raises
  • KeyError – If this instrument already contains a submodule with this name.

  • TypeError – If the submodule that we are trying to add is not an instance of an Metadatable object.

property ancestors: List[qcodes.instrument.base.InstrumentBase]

Returns a list of instruments, starting from the current instrument and following to the parent instrument and the parents parent instrument until the root instrument is reached.

ask(cmd: str) str

Write a command string to the hardware and return a response.

Subclasses that transform cmd should override this method, and in it call super().ask(new_cmd). Subclasses that define a new hardware communication should instead override ask_raw.

Parameters

cmd – The string to send to the instrument.

Returns

response

Raises

Exception – Wraps any underlying exception with extra context, including the command and the instrument.

call(func_name: str, *args: Any) Any

Shortcut for calling a function from its name.

Parameters
  • func_name – The name of a function of this instrument.

  • *args – any arguments to the function.

Returns

The return value of the function.

check_error(ret_code: int) None

Default error checking, raises an error if return code !=0. Does not differentiate between warnings or specific error messages. Override this function in your driver if you want to add specific error messages.

Parameters

ret_code – A Visa error code. See eg: https://github.com/hgrecco/pyvisa/blob/master/pyvisa/errors.py

Raises

visa.VisaIOError – if ret_code indicates a communication problem.

close() None

Disconnect and irreversibly tear down the instrument.

classmethod close_all() None

Try to close all instruments registered in _all_instruments This is handy for use with atexit to ensure that all instruments are closed when a python session is closed.

Examples

>>> atexit.register(qc.Instrument.close_all())
connect_message(idn_param: str = 'IDN', begin_time: Optional[float] = None) None

Print a standard message on initial connection to an instrument.

Parameters
  • idn_param – Name of parameter that returns ID dict. Default IDN.

  • begin_timetime.time() when init started. Default is self._t0, set at start of Instrument.__init__.

delegate_attr_dicts: List[str] = ['parameters', 'functions', 'submodules']

A list of names (strings) of dictionaries which are (or will be) attributes of self, whose keys should be treated as attributes of self.

delegate_attr_objects: List[str] = []

A list of names (strings) of objects which are (or will be) attributes of self, whose attributes should be passed through to self.

device_clear() None

Clear the buffers of the device

static exist(name: str, instrument_class: Optional[type] = None) bool

Check if an instrument with a given names exists (i.e. is already instantiated).

Parameters
  • name – Name of the instrument.

  • instrument_class – The type of instrument you are looking for.

classmethod find_instrument(name: str, instrument_class: Optional[type] = None) qcodes.instrument.base.Instrument

Find an existing instrument by name.

Parameters
  • name – Name of the instrument.

  • instrument_class – The type of instrument you are looking for.

Returns

The instrument found.

Raises
  • KeyError – If no instrument of that name was found, or if its reference is invalid (dead).

  • TypeError – If a specific class was requested but a different type was found.

property full_name: str
get(param_name: str) Any

Shortcut for getting a parameter from its name.

Parameters

param_name – The name of a parameter of this instrument.

Returns

The current value of the parameter.

get_idn() Dict[str, Optional[str]]

Parse a standard VISA *IDN? response into an ID dict.

Even though this is the VISA standard, it applies to various other types as well, such as IPInstruments, so it is included here in the Instrument base class.

Override this if your instrument does not support *IDN? or returns a nonstandard IDN string. This string is supposed to be a comma-separated list of vendor, model, serial, and firmware, but semicolon and colon are also common separators so we accept them here as well.

Returns

A dict containing vendor, model, serial, and firmware.

classmethod instances() List[qcodes.instrument.base.Instrument]

Get all currently defined instances of this instrument class.

You can use this to get the objects back if you lose track of them, and it’s also used by the test system to find objects to test against.

Returns

A list of instances.

static is_valid(instr_instance: qcodes.instrument.base.Instrument) bool

Check if a given instance of an instrument is valid: if an instrument has been closed, its instance is not longer a “valid” instrument.

Parameters

instr_instance – Instance of an Instrument class or its subclass.

load_metadata(metadata: Dict[Any, Any]) None

Load metadata into this classes metadata dictionary.

Parameters

metadata – Metadata to load.

property name: str

Name of the instrument

property name_parts: List[str]
omit_delegate_attrs: List[str] = []

A list of attribute names (strings) to not delegate to any other dictionary or object.

property parent: Optional[qcodes.instrument.base.InstrumentBase]

Returns the parent instrument. By default this is None. Any SubInstrument should subclass this to return the parent instrument.

print_readable_snapshot(update: bool = False, max_chars: int = 80) None

Prints a readable version of the snapshot. The readable snapshot includes the name, value and unit of each parameter. A convenience function to quickly get an overview of the status of an instrument.

Parameters
  • update – If True, update the state by querying the instrument. If False, just use the latest values in memory. This argument gets passed to the snapshot function.

  • max_chars – the maximum number of characters per line. The readable snapshot will be cropped if this value is exceeded. Defaults to 80 to be consistent with default terminal width.

classmethod record_instance(instance: qcodes.instrument.base.Instrument) None

Record (a weak ref to) an instance in a class’s instance list.

Also records the instance in list of all instruments, and verifies that there are no other instruments with the same name.

Parameters

instance – Instance to record.

Raises

KeyError – If another instance with the same name is already present.

classmethod remove_instance(instance: qcodes.instrument.base.Instrument) None

Remove a particular instance from the record.

Parameters

instance – The instance to remove

property root_instrument: qcodes.instrument.base.InstrumentBase
set(param_name: str, value: Any) None

Shortcut for setting a parameter from its name and new value.

Parameters
  • param_name – The name of a parameter of this instrument.

  • value – The new value to set.

set_address(address: str) None

Set the address for this instrument.

Parameters

address – The visa resource name to use to connect. The address should be the actual address and just that. If you wish to change the backend for VISA, use the self.visalib attribute (and then call this function).

set_terminator(terminator: str) None

Change the read terminator to use.

Parameters

terminator – Character(s) to look for at the end of a read. eg. \r\n.

shared_kwargs = ()
property short_name: str

Short name of the instrument

snapshot(update: Optional[bool] = False) Dict[Any, Any]

Decorate a snapshot dictionary with metadata. DO NOT override this method if you want metadata in the snapshot instead, override snapshot_base().

Parameters

update – Passed to snapshot_base.

Returns

Base snapshot.

snapshot_base(update: Optional[bool] = True, params_to_skip_update: Optional[Sequence[str]] = None) Dict[Any, Any]

State of the instrument as a JSON-compatible dict (everything that the custom JSON encoder class qcodes.utils.helpers.NumpyJSONEncoder supports).

Parameters
  • update – If True, update the state by querying the instrument. If None only update if the state is known to be invalid. If False, just use the latest values in memory and never update.

  • params_to_skip_update – List of parameter names that will be skipped in update even if update is True. This is useful if you have parameters that are slow to update but can be updated in a different way (as in the qdac). If you want to skip the update of certain parameters in all snapshots, use the snapshot_get attribute of those parameters instead.

Returns

base snapshot

Return type

dict

validate_status(verbose: bool = False) None

Validate the values of all gettable parameters

The validation is done for all parameters that have both a get and set method.

Parameters

verbose – If True, then information about the parameters that are being check is printed.

write(cmd: str) None

Write a command string with NO response to the hardware.

Subclasses that transform cmd should override this method, and in it call super().write(new_cmd). Subclasses that define a new hardware communication should instead override write_raw.

Parameters

cmd – The string to send to the instrument.

Raises

Exception – Wraps any underlying exception with extra context, including the command and the instrument.

write_raw(cmd: str) None

Low-level interface to visa_handle.write.

Parameters

cmd – The command to send to the instrument.

parameters: Dict[str, _BaseParameter] = {}

All the parameters supported by this instrument. Usually populated via add_parameter().

functions: Dict[str, Function] = {}

All the functions supported by this instrument. Usually populated via add_function().

submodules: Dict[str, Union['InstrumentBase', 'ChannelList']] = {}

All the submodules of this instrument such as channel lists or logical groupings of parameters. Usually populated via add_submodule().

log: InstrumentLoggerAdapter = get_instrument_logger(self, __name__)
class qcodes.instrument_drivers.tektronix.DPO7200xx.TektronixDPOChannel(parent: Union[qcodes.instrument.base.Instrument, qcodes.instrument.channel.InstrumentChannel], name: str, channel_number: int)[source]

Bases: qcodes.instrument.channel.InstrumentChannel

The main channel module for the oscilloscope. The parameters defined here reflect the waveforms as they are displayed on the instrument display.

set_trace_length(value: int) None[source]

Set the trace length when retrieving data through the ‘waveform’ interface

Parameters

value – The requested number of samples in the trace

set_trace_time(value: float) None[source]
Parameters

value – The time over which a trace is desired.

__getitem__(key: str) Union[Callable[[...], Any], qcodes.instrument.parameter.Parameter]

Delegate instrument[‘name’] to parameter or function ‘name’.

__getstate__() None

Prevent pickling instruments, and give a nice error message.

__repr__() str

Custom repr to give parent information

add_function(name: str, **kwargs: Any) None

Bind one Function to this instrument.

Instrument subclasses can call this repeatedly in their __init__ for every real function of the instrument.

This functionality is meant for simple cases, principally things that map to simple commands like *RST (reset) or those with just a few arguments. It requires a fixed argument count, and positional args only. If your case is more complicated, you’re probably better off simply making a new method in your Instrument subclass definition.

Parameters
  • name – How the Function will be stored within instrument.Functions and also how you address it using the shortcut methods: instrument.call(func_name, *args) etc.

  • **kwargs – constructor kwargs for Function

Raises

KeyError – If this instrument already has a function with this name.

add_parameter(name: str, parameter_class: type = <class 'qcodes.instrument.parameter.Parameter'>, **kwargs: Any) None

Bind one Parameter to this instrument.

Instrument subclasses can call this repeatedly in their __init__ for every real parameter of the instrument.

In this sense, parameters are the state variables of the instrument, anything the user can set and/or get.

Parameters
  • name – How the parameter will be stored within instrument.parameters and also how you address it using the shortcut methods: instrument.set(param_name, value) etc.

  • parameter_class – You can construct the parameter out of any class. Default parameter.Parameter.

  • **kwargs – Constructor arguments for parameter_class.

Raises
  • KeyError – If this instrument already has a parameter with this name and the parameter being replaced is not an abstract parameter.

  • ValueError – If there is an existing abstract parameter and the unit of the new parameter is inconsistent with the existing one.

add_submodule(name: str, submodule: Union[InstrumentBase, ChannelList]) None

Bind one submodule to this instrument.

Instrument subclasses can call this repeatedly in their __init__ method for every submodule of the instrument.

Submodules can effectively be considered as instruments within the main instrument, and should at minimum be snapshottable. For example, they can be used to either store logical groupings of parameters, which may or may not be repeated, or channel lists.

Parameters
  • name – How the submodule will be stored within instrument.submodules and also how it can be addressed.

  • submodule – The submodule to be stored.

Raises
  • KeyError – If this instrument already contains a submodule with this name.

  • TypeError – If the submodule that we are trying to add is not an instance of an Metadatable object.

property ancestors: List[qcodes.instrument.base.InstrumentBase]

Returns a list of instruments, starting from the current instrument and following to the parent instrument and the parents parent instrument until the root instrument is reached.

ask(cmd: str) str
ask_raw(cmd: str) str
call(func_name: str, *args: Any) Any

Shortcut for calling a function from its name.

Parameters
  • func_name – The name of a function of this instrument.

  • *args – any arguments to the function.

Returns

The return value of the function.

delegate_attr_dicts: List[str] = ['parameters', 'functions', 'submodules']

A list of names (strings) of dictionaries which are (or will be) attributes of self, whose keys should be treated as attributes of self.

delegate_attr_objects: List[str] = []

A list of names (strings) of objects which are (or will be) attributes of self, whose attributes should be passed through to self.

property full_name: str
get(param_name: str) Any

Shortcut for getting a parameter from its name.

Parameters

param_name – The name of a parameter of this instrument.

Returns

The current value of the parameter.

load_metadata(metadata: Dict[Any, Any]) None

Load metadata into this classes metadata dictionary.

Parameters

metadata – Metadata to load.

property name: str

Name of the instrument

property name_parts: List[str]
omit_delegate_attrs: List[str] = []

A list of attribute names (strings) to not delegate to any other dictionary or object.

property parent: qcodes.instrument.base.InstrumentBase

Returns the parent instrument. By default this is None. Any SubInstrument should subclass this to return the parent instrument.

print_readable_snapshot(update: bool = False, max_chars: int = 80) None

Prints a readable version of the snapshot. The readable snapshot includes the name, value and unit of each parameter. A convenience function to quickly get an overview of the status of an instrument.

Parameters
  • update – If True, update the state by querying the instrument. If False, just use the latest values in memory. This argument gets passed to the snapshot function.

  • max_chars – the maximum number of characters per line. The readable snapshot will be cropped if this value is exceeded. Defaults to 80 to be consistent with default terminal width.

property root_instrument: qcodes.instrument.base.InstrumentBase
set(param_name: str, value: Any) None

Shortcut for setting a parameter from its name and new value.

Parameters
  • param_name – The name of a parameter of this instrument.

  • value – The new value to set.

property short_name: str

Short name of the instrument

snapshot(update: Optional[bool] = False) Dict[Any, Any]

Decorate a snapshot dictionary with metadata. DO NOT override this method if you want metadata in the snapshot instead, override snapshot_base().

Parameters

update – Passed to snapshot_base.

Returns

Base snapshot.

snapshot_base(update: Optional[bool] = False, params_to_skip_update: Optional[Sequence[str]] = None) Dict[Any, Any]

State of the instrument as a JSON-compatible dict (everything that the custom JSON encoder class qcodes.utils.helpers.NumpyJSONEncoder supports).

Parameters
  • update – If True, update the state by querying the instrument. If None update the state if known to be invalid. If False, just use the latest values in memory and never update state.

  • params_to_skip_update – List of parameter names that will be skipped in update even if update is True. This is useful if you have parameters that are slow to update but can be updated in a different way (as in the qdac). If you want to skip the update of certain parameters in all snapshots, use the snapshot_get attribute of those parameters instead.

Returns

base snapshot

Return type

dict

validate_status(verbose: bool = False) None

Validate the values of all gettable parameters

The validation is done for all parameters that have both a get and set method.

Parameters

verbose – If True, then information about the parameters that are being check is printed.

write(cmd: str) None
write_raw(cmd: str) None
parameters: Dict[str, _BaseParameter] = {}

All the parameters supported by this instrument. Usually populated via add_parameter().

functions: Dict[str, Function] = {}

All the functions supported by this instrument. Usually populated via add_function().

submodules: Dict[str, Union['InstrumentBase', 'ChannelList']] = {}

All the submodules of this instrument such as channel lists or logical groupings of parameters. Usually populated via add_submodule().

class qcodes.instrument_drivers.tektronix.DPO7200xx.TektronixDPOData(parent: Union[qcodes.instrument.base.Instrument, qcodes.instrument.channel.InstrumentChannel], name: str)[source]

Bases: qcodes.instrument.channel.InstrumentChannel

This submodule sets and retrieves information regarding the data source for the “CURVE?” query, which is used when retrieving waveform data.

__getitem__(key: str) Union[Callable[[...], Any], qcodes.instrument.parameter.Parameter]

Delegate instrument[‘name’] to parameter or function ‘name’.

__getstate__() None

Prevent pickling instruments, and give a nice error message.

__repr__() str

Custom repr to give parent information

add_function(name: str, **kwargs: Any) None

Bind one Function to this instrument.

Instrument subclasses can call this repeatedly in their __init__ for every real function of the instrument.

This functionality is meant for simple cases, principally things that map to simple commands like *RST (reset) or those with just a few arguments. It requires a fixed argument count, and positional args only. If your case is more complicated, you’re probably better off simply making a new method in your Instrument subclass definition.

Parameters
  • name – How the Function will be stored within instrument.Functions and also how you address it using the shortcut methods: instrument.call(func_name, *args) etc.

  • **kwargs – constructor kwargs for Function

Raises

KeyError – If this instrument already has a function with this name.

add_parameter(name: str, parameter_class: type = <class 'qcodes.instrument.parameter.Parameter'>, **kwargs: Any) None

Bind one Parameter to this instrument.

Instrument subclasses can call this repeatedly in their __init__ for every real parameter of the instrument.

In this sense, parameters are the state variables of the instrument, anything the user can set and/or get.

Parameters
  • name – How the parameter will be stored within instrument.parameters and also how you address it using the shortcut methods: instrument.set(param_name, value) etc.

  • parameter_class – You can construct the parameter out of any class. Default parameter.Parameter.

  • **kwargs – Constructor arguments for parameter_class.

Raises
  • KeyError – If this instrument already has a parameter with this name and the parameter being replaced is not an abstract parameter.

  • ValueError – If there is an existing abstract parameter and the unit of the new parameter is inconsistent with the existing one.

add_submodule(name: str, submodule: Union[InstrumentBase, ChannelList]) None

Bind one submodule to this instrument.

Instrument subclasses can call this repeatedly in their __init__ method for every submodule of the instrument.

Submodules can effectively be considered as instruments within the main instrument, and should at minimum be snapshottable. For example, they can be used to either store logical groupings of parameters, which may or may not be repeated, or channel lists.

Parameters
  • name – How the submodule will be stored within instrument.submodules and also how it can be addressed.

  • submodule – The submodule to be stored.

Raises
  • KeyError – If this instrument already contains a submodule with this name.

  • TypeError – If the submodule that we are trying to add is not an instance of an Metadatable object.

property ancestors: List[qcodes.instrument.base.InstrumentBase]

Returns a list of instruments, starting from the current instrument and following to the parent instrument and the parents parent instrument until the root instrument is reached.

ask(cmd: str) str
ask_raw(cmd: str) str
call(func_name: str, *args: Any) Any

Shortcut for calling a function from its name.

Parameters
  • func_name – The name of a function of this instrument.

  • *args – any arguments to the function.

Returns

The return value of the function.

delegate_attr_dicts: List[str] = ['parameters', 'functions', 'submodules']

A list of names (strings) of dictionaries which are (or will be) attributes of self, whose keys should be treated as attributes of self.

delegate_attr_objects: List[str] = []

A list of names (strings) of objects which are (or will be) attributes of self, whose attributes should be passed through to self.

property full_name: str
get(param_name: str) Any

Shortcut for getting a parameter from its name.

Parameters

param_name – The name of a parameter of this instrument.

Returns

The current value of the parameter.

load_metadata(metadata: Dict[Any, Any]) None

Load metadata into this classes metadata dictionary.

Parameters

metadata – Metadata to load.

property name: str

Name of the instrument

property name_parts: List[str]
omit_delegate_attrs: List[str] = []

A list of attribute names (strings) to not delegate to any other dictionary or object.

property parent: qcodes.instrument.base.InstrumentBase

Returns the parent instrument. By default this is None. Any SubInstrument should subclass this to return the parent instrument.

print_readable_snapshot(update: bool = False, max_chars: int = 80) None

Prints a readable version of the snapshot. The readable snapshot includes the name, value and unit of each parameter. A convenience function to quickly get an overview of the status of an instrument.

Parameters
  • update – If True, update the state by querying the instrument. If False, just use the latest values in memory. This argument gets passed to the snapshot function.

  • max_chars – the maximum number of characters per line. The readable snapshot will be cropped if this value is exceeded. Defaults to 80 to be consistent with default terminal width.

property root_instrument: qcodes.instrument.base.InstrumentBase
set(param_name: str, value: Any) None

Shortcut for setting a parameter from its name and new value.

Parameters
  • param_name – The name of a parameter of this instrument.

  • value – The new value to set.

property short_name: str

Short name of the instrument

snapshot(update: Optional[bool] = False) Dict[Any, Any]

Decorate a snapshot dictionary with metadata. DO NOT override this method if you want metadata in the snapshot instead, override snapshot_base().

Parameters

update – Passed to snapshot_base.

Returns

Base snapshot.

snapshot_base(update: Optional[bool] = False, params_to_skip_update: Optional[Sequence[str]] = None) Dict[Any, Any]

State of the instrument as a JSON-compatible dict (everything that the custom JSON encoder class qcodes.utils.helpers.NumpyJSONEncoder supports).

Parameters
  • update – If True, update the state by querying the instrument. If None update the state if known to be invalid. If False, just use the latest values in memory and never update state.

  • params_to_skip_update – List of parameter names that will be skipped in update even if update is True. This is useful if you have parameters that are slow to update but can be updated in a different way (as in the qdac). If you want to skip the update of certain parameters in all snapshots, use the snapshot_get attribute of those parameters instead.

Returns

base snapshot

Return type

dict

validate_status(verbose: bool = False) None

Validate the values of all gettable parameters

The validation is done for all parameters that have both a get and set method.

Parameters

verbose – If True, then information about the parameters that are being check is printed.

write(cmd: str) None
write_raw(cmd: str) None
parameters: Dict[str, _BaseParameter] = {}

All the parameters supported by this instrument. Usually populated via add_parameter().

functions: Dict[str, Function] = {}

All the functions supported by this instrument. Usually populated via add_function().

submodules: Dict[str, Union['InstrumentBase', 'ChannelList']] = {}

All the submodules of this instrument such as channel lists or logical groupings of parameters. Usually populated via add_submodule().

class qcodes.instrument_drivers.tektronix.DPO7200xx.TektronixDPOHorizontal(parent: Union[qcodes.instrument.base.Instrument, qcodes.instrument.channel.InstrumentChannel], name: str)[source]

Bases: qcodes.instrument.channel.InstrumentChannel

This module controls the horizontal axis of the scope

__getitem__(key: str) Union[Callable[[...], Any], qcodes.instrument.parameter.Parameter]

Delegate instrument[‘name’] to parameter or function ‘name’.

__getstate__() None

Prevent pickling instruments, and give a nice error message.

__repr__() str

Custom repr to give parent information

add_function(name: str, **kwargs: Any) None

Bind one Function to this instrument.

Instrument subclasses can call this repeatedly in their __init__ for every real function of the instrument.

This functionality is meant for simple cases, principally things that map to simple commands like *RST (reset) or those with just a few arguments. It requires a fixed argument count, and positional args only. If your case is more complicated, you’re probably better off simply making a new method in your Instrument subclass definition.

Parameters
  • name – How the Function will be stored within instrument.Functions and also how you address it using the shortcut methods: instrument.call(func_name, *args) etc.

  • **kwargs – constructor kwargs for Function

Raises

KeyError – If this instrument already has a function with this name.

add_parameter(name: str, parameter_class: type = <class 'qcodes.instrument.parameter.Parameter'>, **kwargs: Any) None

Bind one Parameter to this instrument.

Instrument subclasses can call this repeatedly in their __init__ for every real parameter of the instrument.

In this sense, parameters are the state variables of the instrument, anything the user can set and/or get.

Parameters
  • name – How the parameter will be stored within instrument.parameters and also how you address it using the shortcut methods: instrument.set(param_name, value) etc.

  • parameter_class – You can construct the parameter out of any class. Default parameter.Parameter.

  • **kwargs – Constructor arguments for parameter_class.

Raises
  • KeyError – If this instrument already has a parameter with this name and the parameter being replaced is not an abstract parameter.

  • ValueError – If there is an existing abstract parameter and the unit of the new parameter is inconsistent with the existing one.

add_submodule(name: str, submodule: Union[InstrumentBase, ChannelList]) None

Bind one submodule to this instrument.

Instrument subclasses can call this repeatedly in their __init__ method for every submodule of the instrument.

Submodules can effectively be considered as instruments within the main instrument, and should at minimum be snapshottable. For example, they can be used to either store logical groupings of parameters, which may or may not be repeated, or channel lists.

Parameters
  • name – How the submodule will be stored within instrument.submodules and also how it can be addressed.

  • submodule – The submodule to be stored.

Raises
  • KeyError – If this instrument already contains a submodule with this name.

  • TypeError – If the submodule that we are trying to add is not an instance of an Metadatable object.

property ancestors: List[qcodes.instrument.base.InstrumentBase]

Returns a list of instruments, starting from the current instrument and following to the parent instrument and the parents parent instrument until the root instrument is reached.

ask(cmd: str) str
ask_raw(cmd: str) str
call(func_name: str, *args: Any) Any

Shortcut for calling a function from its name.

Parameters
  • func_name – The name of a function of this instrument.

  • *args – any arguments to the function.

Returns

The return value of the function.

delegate_attr_dicts: List[str] = ['parameters', 'functions', 'submodules']

A list of names (strings) of dictionaries which are (or will be) attributes of self, whose keys should be treated as attributes of self.

delegate_attr_objects: List[str] = []

A list of names (strings) of objects which are (or will be) attributes of self, whose attributes should be passed through to self.

property full_name: str
get(param_name: str) Any

Shortcut for getting a parameter from its name.

Parameters

param_name – The name of a parameter of this instrument.

Returns

The current value of the parameter.

load_metadata(metadata: Dict[Any, Any]) None

Load metadata into this classes metadata dictionary.

Parameters

metadata – Metadata to load.

property name: str

Name of the instrument

property name_parts: List[str]
omit_delegate_attrs: List[str] = []

A list of attribute names (strings) to not delegate to any other dictionary or object.

property parent: qcodes.instrument.base.InstrumentBase

Returns the parent instrument. By default this is None. Any SubInstrument should subclass this to return the parent instrument.

print_readable_snapshot(update: bool = False, max_chars: int = 80) None

Prints a readable version of the snapshot. The readable snapshot includes the name, value and unit of each parameter. A convenience function to quickly get an overview of the status of an instrument.

Parameters
  • update – If True, update the state by querying the instrument. If False, just use the latest values in memory. This argument gets passed to the snapshot function.

  • max_chars – the maximum number of characters per line. The readable snapshot will be cropped if this value is exceeded. Defaults to 80 to be consistent with default terminal width.

property root_instrument: qcodes.instrument.base.InstrumentBase
set(param_name: str, value: Any) None

Shortcut for setting a parameter from its name and new value.

Parameters
  • param_name – The name of a parameter of this instrument.

  • value – The new value to set.

property short_name: str

Short name of the instrument

snapshot(update: Optional[bool] = False) Dict[Any, Any]

Decorate a snapshot dictionary with metadata. DO NOT override this method if you want metadata in the snapshot instead, override snapshot_base().

Parameters

update – Passed to snapshot_base.

Returns

Base snapshot.

snapshot_base(update: Optional[bool] = False, params_to_skip_update: Optional[Sequence[str]] = None) Dict[Any, Any]

State of the instrument as a JSON-compatible dict (everything that the custom JSON encoder class qcodes.utils.helpers.NumpyJSONEncoder supports).

Parameters
  • update – If True, update the state by querying the instrument. If None update the state if known to be invalid. If False, just use the latest values in memory and never update state.

  • params_to_skip_update – List of parameter names that will be skipped in update even if update is True. This is useful if you have parameters that are slow to update but can be updated in a different way (as in the qdac). If you want to skip the update of certain parameters in all snapshots, use the snapshot_get attribute of those parameters instead.

Returns

base snapshot

Return type

dict

validate_status(verbose: bool = False) None

Validate the values of all gettable parameters

The validation is done for all parameters that have both a get and set method.

Parameters

verbose – If True, then information about the parameters that are being check is printed.

write(cmd: str) None
write_raw(cmd: str) None
parameters: Dict[str, _BaseParameter] = {}

All the parameters supported by this instrument. Usually populated via add_parameter().

functions: Dict[str, Function] = {}

All the functions supported by this instrument. Usually populated via add_function().

submodules: Dict[str, Union['InstrumentBase', 'ChannelList']] = {}

All the submodules of this instrument such as channel lists or logical groupings of parameters. Usually populated via add_submodule().

class qcodes.instrument_drivers.tektronix.DPO7200xx.TektronixDPOMeasurement(parent: qcodes.instrument.base.Instrument, name: str, measurement_number: int)[source]

Bases: qcodes.instrument.channel.InstrumentChannel

The measurement submodule

measurements = [('amplitude', 'V'), ('area', 'Vs'), ('burst', 's'), ('carea', 'Vs'), ('cmean', 'V'), ('crms', 'V'), ('delay', 's'), ('distduty', '%'), ('extinctdb', 'dB'), ('extinctpct', '%'), ('extinctratio', ''), ('eyeheight', 'V'), ('eyewidth', 's'), ('fall', 's'), ('frequency', 'Hz'), ('high', 'V'), ('hits', 'hits'), ('low', 'V'), ('maximum', 'V'), ('mean', 'V'), ('median', 'V'), ('minimum', 'V'), ('ncross', 's'), ('nduty', '%'), ('novershoot', '%'), ('nwidth', 's'), ('pbase', 'V'), ('pcross', 's'), ('pctcross', '%'), ('pduty', '%'), ('peakhits', 'hits'), ('period', 's'), ('phase', '°'), ('pk2pk', 'V'), ('pkpkjitter', 's'), ('pkpknoise', 'V'), ('povershoot', '%'), ('ptop', 'V'), ('pwidth', 's'), ('qfactor', ''), ('rise', 's'), ('rms', 'V'), ('rmsjitter', 's'), ('rmsnoise', 'V'), ('sigma1', '%'), ('sigma2', '%'), ('sigma3', '%'), ('sixsigmajit', 's'), ('snratio', ''), ('stddev', 'V'), ('undefined', ''), ('waveforms', 'wfms')]
property measurement_number: int
wait_adjustment_time() None[source]

Wait until the minimum time after adjusting the measurement source or type has elapsed

__getitem__(key: str) Union[Callable[[...], Any], qcodes.instrument.parameter.Parameter]

Delegate instrument[‘name’] to parameter or function ‘name’.

__getstate__() None

Prevent pickling instruments, and give a nice error message.

__repr__() str

Custom repr to give parent information

add_function(name: str, **kwargs: Any) None

Bind one Function to this instrument.

Instrument subclasses can call this repeatedly in their __init__ for every real function of the instrument.

This functionality is meant for simple cases, principally things that map to simple commands like *RST (reset) or those with just a few arguments. It requires a fixed argument count, and positional args only. If your case is more complicated, you’re probably better off simply making a new method in your Instrument subclass definition.

Parameters
  • name – How the Function will be stored within instrument.Functions and also how you address it using the shortcut methods: instrument.call(func_name, *args) etc.

  • **kwargs – constructor kwargs for Function

Raises

KeyError – If this instrument already has a function with this name.

add_parameter(name: str, parameter_class: type = <class 'qcodes.instrument.parameter.Parameter'>, **kwargs: Any) None

Bind one Parameter to this instrument.

Instrument subclasses can call this repeatedly in their __init__ for every real parameter of the instrument.

In this sense, parameters are the state variables of the instrument, anything the user can set and/or get.

Parameters
  • name – How the parameter will be stored within instrument.parameters and also how you address it using the shortcut methods: instrument.set(param_name, value) etc.

  • parameter_class – You can construct the parameter out of any class. Default parameter.Parameter.

  • **kwargs – Constructor arguments for parameter_class.

Raises
  • KeyError – If this instrument already has a parameter with this name and the parameter being replaced is not an abstract parameter.

  • ValueError – If there is an existing abstract parameter and the unit of the new parameter is inconsistent with the existing one.

add_submodule(name: str, submodule: Union[InstrumentBase, ChannelList]) None

Bind one submodule to this instrument.

Instrument subclasses can call this repeatedly in their __init__ method for every submodule of the instrument.

Submodules can effectively be considered as instruments within the main instrument, and should at minimum be snapshottable. For example, they can be used to either store logical groupings of parameters, which may or may not be repeated, or channel lists.

Parameters
  • name – How the submodule will be stored within instrument.submodules and also how it can be addressed.

  • submodule – The submodule to be stored.

Raises
  • KeyError – If this instrument already contains a submodule with this name.

  • TypeError – If the submodule that we are trying to add is not an instance of an Metadatable object.

property ancestors: List[qcodes.instrument.base.InstrumentBase]

Returns a list of instruments, starting from the current instrument and following to the parent instrument and the parents parent instrument until the root instrument is reached.

ask(cmd: str) str
ask_raw(cmd: str) str
call(func_name: str, *args: Any) Any

Shortcut for calling a function from its name.

Parameters
  • func_name – The name of a function of this instrument.

  • *args – any arguments to the function.

Returns

The return value of the function.

delegate_attr_dicts: List[str] = ['parameters', 'functions', 'submodules']

A list of names (strings) of dictionaries which are (or will be) attributes of self, whose keys should be treated as attributes of self.

delegate_attr_objects: List[str] = []

A list of names (strings) of objects which are (or will be) attributes of self, whose attributes should be passed through to self.

property full_name: str
get(param_name: str) Any

Shortcut for getting a parameter from its name.

Parameters

param_name – The name of a parameter of this instrument.

Returns

The current value of the parameter.

load_metadata(metadata: Dict[Any, Any]) None

Load metadata into this classes metadata dictionary.

Parameters

metadata – Metadata to load.

property name: str

Name of the instrument

property name_parts: List[str]
omit_delegate_attrs: List[str] = []

A list of attribute names (strings) to not delegate to any other dictionary or object.

property parent: qcodes.instrument.base.InstrumentBase

Returns the parent instrument. By default this is None. Any SubInstrument should subclass this to return the parent instrument.

print_readable_snapshot(update: bool = False, max_chars: int = 80) None

Prints a readable version of the snapshot. The readable snapshot includes the name, value and unit of each parameter. A convenience function to quickly get an overview of the status of an instrument.

Parameters
  • update – If True, update the state by querying the instrument. If False, just use the latest values in memory. This argument gets passed to the snapshot function.

  • max_chars – the maximum number of characters per line. The readable snapshot will be cropped if this value is exceeded. Defaults to 80 to be consistent with default terminal width.

property root_instrument: qcodes.instrument.base.InstrumentBase
set(param_name: str, value: Any) None

Shortcut for setting a parameter from its name and new value.

Parameters
  • param_name – The name of a parameter of this instrument.

  • value – The new value to set.

property short_name: str

Short name of the instrument

snapshot(update: Optional[bool] = False) Dict[Any, Any]

Decorate a snapshot dictionary with metadata. DO NOT override this method if you want metadata in the snapshot instead, override snapshot_base().

Parameters

update – Passed to snapshot_base.

Returns

Base snapshot.

snapshot_base(update: Optional[bool] = False, params_to_skip_update: Optional[Sequence[str]] = None) Dict[Any, Any]

State of the instrument as a JSON-compatible dict (everything that the custom JSON encoder class qcodes.utils.helpers.NumpyJSONEncoder supports).

Parameters
  • update – If True, update the state by querying the instrument. If None update the state if known to be invalid. If False, just use the latest values in memory and never update state.

  • params_to_skip_update – List of parameter names that will be skipped in update even if update is True. This is useful if you have parameters that are slow to update but can be updated in a different way (as in the qdac). If you want to skip the update of certain parameters in all snapshots, use the snapshot_get attribute of those parameters instead.

Returns

base snapshot

Return type

dict

validate_status(verbose: bool = False) None

Validate the values of all gettable parameters

The validation is done for all parameters that have both a get and set method.

Parameters

verbose – If True, then information about the parameters that are being check is printed.

write(cmd: str) None
write_raw(cmd: str) None
parameters: Dict[str, _BaseParameter] = {}

All the parameters supported by this instrument. Usually populated via add_parameter().

functions: Dict[str, Function] = {}

All the functions supported by this instrument. Usually populated via add_function().

submodules: Dict[str, Union['InstrumentBase', 'ChannelList']] = {}

All the submodules of this instrument such as channel lists or logical groupings of parameters. Usually populated via add_submodule().

class qcodes.instrument_drivers.tektronix.DPO7200xx.TektronixDPOMeasurementParameter(name: str, instrument: Optional[InstrumentBase] = None, label: Optional[str] = None, unit: Optional[str] = None, get_cmd: Optional[Union[str, Callable[[...], Any], bool]] = None, set_cmd: Optional[Union[str, Callable[[...], Any], bool]] = False, initial_value: Optional[Union[float, str]] = None, max_val_age: Optional[float] = None, vals: Optional[qcodes.utils.validators.Validator[Any]] = None, docstring: Optional[str] = None, initial_cache_value: Optional[Union[float, str]] = None, bind_to_instrument: bool = True, **kwargs: Any)[source]

Bases: qcodes.instrument.parameter.Parameter

A measurement parameter does not only return the instantaneous value of a measurement, but can also return some statistics. The accumulation time over which these statistics are gathered can be controlled through the ‘time_constant’ parameter on the submodule ‘TektronixDPOMeasurementStatistics’. Here we also find the method ‘reset’ to reset the values over which the statistics are gathered.

mean() float[source]
max() float[source]
min() float[source]
stdev() float[source]
get_raw() float[source]

get_raw is called to perform the actual data acquisition from the instrument. This method should either be overwritten to perform the desired operation or alternatively for Parameter a suitable method is automatically generated if get_cmd is supplied to the parameter constructor. The method is automatically wrapped to provide a get method on the parameter instance.

set_raw(value: Any) None[source]

set_raw is called to perform the actual setting of a parameter on the instrument. This method should either be overwritten to perform the desired operation or alternatively for Parameter a suitable method is automatically generated if set_cmd is supplied to the parameter constructor. The method is automatically wrapped to provide a set method on the parameter instance.

__getitem__(keys: Any) qcodes.instrument.sweep_values.SweepFixedValues

Slice a Parameter to get a SweepValues object to iterate over during a sweep

__str__() str

Include the instrument name with the Parameter name if possible.

property abstract: Optional[bool]
property full_name: str

Name of the parameter including the name of the instrument and submodule that the parameter may be bound to. The names are separated by underscores, like this: instrument_submodule_parameter.

get_ramp_values(value: Union[float, Sized], step: Optional[float] = None) Sequence[Union[float, Sized]]

Return values to sweep from current value to target value. This method can be overridden to have a custom sweep behaviour. It can even be overridden by a generator.

Parameters
  • value – target value

  • step – maximum step size

Returns

List of stepped values, including target value.

property gettable: bool

Is it allowed to call get on this parameter?

increment(value: Any) None

Increment the parameter with a value

Parameters

value – Value to be added to the parameter.

property instrument: Optional[InstrumentBase]

Return the first instrument that this parameter is bound to. E.g if this is bound to a channel it will return the channel and not the instrument that the channel is bound too. Use root_instrument() to get the real instrument.

property inter_delay: float

Delay time between consecutive set operations. The actual time will not be shorter than this, but may be longer if the underlying set call takes longer.

Typically used in conjunction with step to create an effective ramp rate, but can also be used without a step to enforce a delay between sets.

Getter

Returns the current inter_delay.

Setter

Sets the value of the inter_delay.

Raises
load_metadata(metadata: Dict[Any, Any]) None

Load metadata into this classes metadata dictionary.

Parameters

metadata – Metadata to load.

property name: str

Name of the parameter. This is identical to short_name().

property name_parts: List[str]

List of the parts that make up the full name of this parameter

property post_delay: float

Delay time after start of set operation, for each set. The actual time will not be shorter than this, but may be longer if the underlying set call takes longer.

Typically used in conjunction with step to create an effective ramp rate, but can also be used without a step to enforce a delay after every set. One might think of post_delay as how long a set operation is supposed to take. For example, there might be an instrument that needs extra time after setting a parameter although the command for setting the parameter returns quickly.

Getter

Returns the current post_delay.

Setter

Sets the value of the post_delay.

Raises
property raw_value: Any

Note that this property will be deprecated soon. Use cache.raw_value instead.

Represents the cached raw value of the parameter.

Getter

Returns the cached raw value of the parameter.

restore_at_exit(allow_changes: bool = True) qcodes.instrument.parameter._SetParamContext

Use a context manager to restore the value of a parameter after a with block.

By default, the parameter value may be changed inside the block, but this can be prevented with allow_changes=False. This can be useful, for example, for debugging a complex measurement that unintentionally modifies a parameter.

Example

>>> p = Parameter("p", set_cmd=None, get_cmd=None)
>>> p.set(2)
>>> with p.restore_at_exit():
...     p.set(3)
...     print(f"value inside with block: {p.get()}")  # prints 3
>>> print(f"value after with block: {p.get()}")  # prints 2
>>> with p.restore_at_exit(allow_changes=False):
...     p.set(5)  # raises an exception
property root_instrument: Optional[InstrumentBase]

Return the fundamental instrument that this parameter belongs too. E.g if the parameter is bound to a channel this will return the fundamental instrument that that channel belongs to. Use instrument() to get the channel.

set_to(value: Any, allow_changes: bool = False) qcodes.instrument.parameter._SetParamContext

Use a context manager to temporarily set a parameter to a value. By default, the parameter value cannot be changed inside the context. This may be overridden with allow_changes=True.

Examples

>>> from qcodes import Parameter
>>> p = Parameter("p", set_cmd=None, get_cmd=None)
>>> p.set(2)
>>> with p.set_to(3):
...     print(f"p value in with block {p.get()}")  # prints 3
...     p.set(5)  # raises an exception
>>> print(f"p value outside with block {p.get()}")  # prints 2
>>> with p.set_to(3, allow_changes=True):
...     p.set(5)  # now this works
>>> print(f"value after second block: {p.get()}")  # still prints 2
property settable: bool

Is it allowed to call set on this parameter?

property short_name: str

Short name of the parameter. This is without the name of the instrument or submodule that the parameter may be bound to. For full name refer to full_name().

snapshot(update: Optional[bool] = False) Dict[Any, Any]

Decorate a snapshot dictionary with metadata. DO NOT override this method if you want metadata in the snapshot instead, override snapshot_base().

Parameters

update – Passed to snapshot_base.

Returns

Base snapshot.

snapshot_base(update: Optional[bool] = True, params_to_skip_update: Optional[Sequence[str]] = None) Dict[Any, Any]

State of the parameter as a JSON-compatible dict (everything that the custom JSON encoder class qcodes.utils.helpers.NumpyJSONEncoder supports).

If the parameter has been initiated with snapshot_value=False, the snapshot will NOT include the value and raw_value of the parameter.

Parameters
  • update – If True, update the state by calling parameter.get() unless snapshot_get of the parameter is False. If update is None, use the current value from the cache unless the cache is invalid. If False, never call parameter.get().

  • params_to_skip_update – No effect but may be passed from superclass

Returns

base snapshot

property snapshot_value: bool

If True the value of the parameter will be included in the snapshot.

property step: Optional[float]

Stepsize that this Parameter uses during set operation. Stepsize must be a positive number or None. If step is a positive number, this is the maximum value change allowed in one hardware call, so a single set can result in many calls to the hardware if the starting value is far from the target. All but the final change will attempt to change by +/- step exactly. If step is None stepping will not be used.

Getter

Returns the current stepsize.

Setter

Sets the value of the step.

Raises
  • TypeError – if step is set to not numeric or None

  • ValueError – if step is set to negative

  • TypeError – if step is set to not integer or None for an integer parameter

  • TypeError – if step is set to not a number on None

sweep(start: float, stop: float, step: Optional[float] = None, num: Optional[int] = None) qcodes.instrument.sweep_values.SweepFixedValues

Create a collection of parameter values to be iterated over. Requires start and stop and (step or num) The sign of step is not relevant.

Parameters
  • start – The starting value of the sequence.

  • stop – The end value of the sequence.

  • step – Spacing between values.

  • num – Number of values to generate.

Returns

Collection of parameter values to be iterated over.

Return type

SweepFixedValues

Examples

>>> sweep(0, 10, num=5)
 [0.0, 2.5, 5.0, 7.5, 10.0]
>>> sweep(5, 10, step=1)
[5.0, 6.0, 7.0, 8.0, 9.0, 10.0]
>>> sweep(15, 10.5, step=1.5)
>[15.0, 13.5, 12.0, 10.5]
property underlying_instrument: Optional[InstrumentBase]

Returns an instance of the underlying hardware instrument that this parameter communicates with, per this parameter’s implementation.

This is useful in the case where a parameter does not belongs to an instrument instance that represents a real hardware instrument but actually uses a real hardware instrument in its implementation (e.g. via calls to one or more parameters of that real hardware instrument). This is also useful when a parameter does belong to an instrument instance but that instance does not represent the real hardware instrument that the parameter interacts with: hence root_instrument of the parameter cannot be the hardware_instrument, however underlying_instrument can be implemented to return the hardware_instrument.

By default it returns the root_instrument of the parameter.

validate(value: Any) None

Validate the value supplied.

Parameters

value – value to validate

Raises
  • TypeError – If the value is of the wrong type.

  • ValueError – If the value is outside the bounds specified by the validator.

label: str = ()

Label of the data used for plots etc.

unit = ()

The unit of measure. Use '' for unitless.

class qcodes.instrument_drivers.tektronix.DPO7200xx.TektronixDPOMeasurementStatistics(*args: Any, **kwargs: Any)[source]

Bases: qcodes.instrument.channel.InstrumentChannel

reset() None[source]
__getitem__(key: str) Union[Callable[[...], Any], qcodes.instrument.parameter.Parameter]

Delegate instrument[‘name’] to parameter or function ‘name’.

__getstate__() None

Prevent pickling instruments, and give a nice error message.

__repr__() str

Custom repr to give parent information

add_function(name: str, **kwargs: Any) None

Bind one Function to this instrument.

Instrument subclasses can call this repeatedly in their __init__ for every real function of the instrument.

This functionality is meant for simple cases, principally things that map to simple commands like *RST (reset) or those with just a few arguments. It requires a fixed argument count, and positional args only. If your case is more complicated, you’re probably better off simply making a new method in your Instrument subclass definition.

Parameters
  • name – How the Function will be stored within instrument.Functions and also how you address it using the shortcut methods: instrument.call(func_name, *args) etc.

  • **kwargs – constructor kwargs for Function

Raises

KeyError – If this instrument already has a function with this name.

add_parameter(name: str, parameter_class: type = <class 'qcodes.instrument.parameter.Parameter'>, **kwargs: Any) None

Bind one Parameter to this instrument.

Instrument subclasses can call this repeatedly in their __init__ for every real parameter of the instrument.

In this sense, parameters are the state variables of the instrument, anything the user can set and/or get.

Parameters
  • name – How the parameter will be stored within instrument.parameters and also how you address it using the shortcut methods: instrument.set(param_name, value) etc.

  • parameter_class – You can construct the parameter out of any class. Default parameter.Parameter.

  • **kwargs – Constructor arguments for parameter_class.

Raises
  • KeyError – If this instrument already has a parameter with this name and the parameter being replaced is not an abstract parameter.

  • ValueError – If there is an existing abstract parameter and the unit of the new parameter is inconsistent with the existing one.

add_submodule(name: str, submodule: Union[InstrumentBase, ChannelList]) None

Bind one submodule to this instrument.

Instrument subclasses can call this repeatedly in their __init__ method for every submodule of the instrument.

Submodules can effectively be considered as instruments within the main instrument, and should at minimum be snapshottable. For example, they can be used to either store logical groupings of parameters, which may or may not be repeated, or channel lists.

Parameters
  • name – How the submodule will be stored within instrument.submodules and also how it can be addressed.

  • submodule – The submodule to be stored.

Raises
  • KeyError – If this instrument already contains a submodule with this name.

  • TypeError – If the submodule that we are trying to add is not an instance of an Metadatable object.

property ancestors: List[qcodes.instrument.base.InstrumentBase]

Returns a list of instruments, starting from the current instrument and following to the parent instrument and the parents parent instrument until the root instrument is reached.

ask(cmd: str) str
ask_raw(cmd: str) str
call(func_name: str, *args: Any) Any

Shortcut for calling a function from its name.

Parameters
  • func_name – The name of a function of this instrument.

  • *args – any arguments to the function.

Returns

The return value of the function.

delegate_attr_dicts: List[str] = ['parameters', 'functions', 'submodules']

A list of names (strings) of dictionaries which are (or will be) attributes of self, whose keys should be treated as attributes of self.

delegate_attr_objects: List[str] = []

A list of names (strings) of objects which are (or will be) attributes of self, whose attributes should be passed through to self.

property full_name: str
get(param_name: str) Any

Shortcut for getting a parameter from its name.

Parameters

param_name – The name of a parameter of this instrument.

Returns

The current value of the parameter.

load_metadata(metadata: Dict[Any, Any]) None

Load metadata into this classes metadata dictionary.

Parameters

metadata – Metadata to load.

property name: str

Name of the instrument

property name_parts: List[str]
omit_delegate_attrs: List[str] = []

A list of attribute names (strings) to not delegate to any other dictionary or object.

property parent: qcodes.instrument.base.InstrumentBase

Returns the parent instrument. By default this is None. Any SubInstrument should subclass this to return the parent instrument.

print_readable_snapshot(update: bool = False, max_chars: int = 80) None

Prints a readable version of the snapshot. The readable snapshot includes the name, value and unit of each parameter. A convenience function to quickly get an overview of the status of an instrument.

Parameters
  • update – If True, update the state by querying the instrument. If False, just use the latest values in memory. This argument gets passed to the snapshot function.

  • max_chars – the maximum number of characters per line. The readable snapshot will be cropped if this value is exceeded. Defaults to 80 to be consistent with default terminal width.

property root_instrument: qcodes.instrument.base.InstrumentBase
set(param_name: str, value: Any) None

Shortcut for setting a parameter from its name and new value.

Parameters
  • param_name – The name of a parameter of this instrument.

  • value – The new value to set.

property short_name: str

Short name of the instrument

snapshot(update: Optional[bool] = False) Dict[Any, Any]

Decorate a snapshot dictionary with metadata. DO NOT override this method if you want metadata in the snapshot instead, override snapshot_base().

Parameters

update – Passed to snapshot_base.

Returns

Base snapshot.