Tektronix Drivers
Classes:
|
Submodule for trigger setup. |
|
This submodule retrieves data from waveform sources, e.g. |
|
Class to hold a channel of the AWG. |
|
This is the QCoDeS driver for the Tektronix AWG5014 Arbitrary Waveform Generator. |
|
The QCoDeS driver for Tektronix AWG5208 |
|
The QCoDeS driver for Tektronix AWG70001A series AWG's. |
|
The QCoDeS driver for Tektronix AWG70001B series AWG's. |
|
The QCoDeS driver for Tektronix AWG70002A series AWG's. |
|
The QCoDeS driver for Tektronix AWG70002B series AWG's. |
|
QCoDeS driver for Tektronix DPO5000 Digital Oscilloscopes |
|
QCoDeS driver for Tektronix DPO7000 Digital Oscilloscopes |
|
QCoDeS driver for Tektronix DPO70000 Digital Oscilloscopes |
|
The main channel module for the oscilloscope. |
|
This submodule sets and retrieves information regarding the data source for the "CURVE?" query, which is used when retrieving waveform data. |
|
This module controls the horizontal axis of the scope |
|
The measurement submodule |
|
A measurement parameter does not only return the instantaneous value of a measurement, but can also return some statistics. |
|
|
|
With this sub module we can query waveform formatting data. |
|
QCoDeS driver for Tektronix DSA70000 Digital Oscilloscopes |
|
QCoDeS driver for Tektronix MSO5000 Digital Oscilloscopes |
|
QCoDeS driver for Tektronix MSO70000 Digital Oscilloscopes |
|
This is the QCoDeS driver for the Tektronix 2012B oscilloscope. |
|
Exceptions:
Raise this exception if we are in a wrong mode to perform an action |
- class qcodes.instrument_drivers.tektronix.TekronixDPOTrigger(parent: Instrument, name: str, delayed_trigger: bool = False)[source]
Bases:
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
Methods:
__getitem__
(key)Delegate instrument['name'] to parameter or function 'name'.
Prevent pickling instruments, and give a nice error message.
__repr__
()Custom repr to give parent information
add_function
(name, **kwargs)Bind one
Function
to this instrument.add_parameter
(name[, parameter_class])Bind one Parameter to this instrument.
add_submodule
(name, submodule)Bind one submodule to this instrument.
ask
(cmd)ask_raw
(cmd)call
(func_name, *args)Shortcut for calling a function from its name.
get
(param_name)Shortcut for getting a parameter from its name.
get_component
(full_name)Recursively get a component of the instrument by full_name.
Invalidate the cache of all parameters on the instrument.
load_metadata
(metadata)Load metadata into this classes metadata dictionary.
print_readable_snapshot
([update, max_chars])Prints a readable version of the snapshot.
set
(param_name, value)Shortcut for setting a parameter from its name and new value.
snapshot
([update])Decorate a snapshot dictionary with metadata.
snapshot_base
([update, params_to_skip_update])State of the instrument as a JSON-compatible dict (everything that the custom JSON encoder class
NumpyJSONEncoder
supports).validate_status
([verbose])Validate the values of all gettable parameters
write
(cmd)write_raw
(cmd)Attributes:
Ancestors in the form of a list of
InstrumentBase
A list of names (strings) of dictionaries which are (or will be) attributes of
self
, whose keys should be treated as attributes ofself
.A list of names (strings) of objects which are (or will be) attributes of
self
, whose attributes should be passed through toself
.Full name of the instrument.
Nicely formatted label of the instrument.
Full name of the instrument
A list of all the parts of the instrument name from
root_instrument()
to the currentInstrumentModule
.A list of attribute names (strings) to not delegate to any other dictionary or object.
The parent instrument.
The topmost parent of this module.
Short name of the instrument.
All the parameters supported by this instrument.
All the functions supported by this instrument.
All the submodules of this instrument such as channel lists or logical groupings of parameters.
All the
InstrumentModule
of this instrument Usually populated viaadd_submodule()
.- __getitem__(key: str) Callable[[...], Any] | Parameter
Delegate instrument[‘name’] to parameter or function ‘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.Note
We do not recommend the usage of Function for any new driver. Function does not add any significant features over a method defined on the class.
- 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[qcodes.parameters.parameter_base.ParameterBase] | None = None, **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
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
parameters.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: InstrumentModule | ChannelTuple) 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. They should either be an instance of an
InstrumentModule
or aChannelTuple
.- 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:
- property ancestors: tuple[qcodes.instrument.instrument_base.InstrumentBase, ...]
Ancestors in the form of a list of
InstrumentBase
The list starts with the current module then the parent and the parents parent until the root instrument is reached.
- 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 ofself
.
- 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 toself
.
- property full_name: str
Full name of the instrument.
For an
InstrumentModule
this includes all parents separated by_
- 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_component(full_name: str) MetadatableWithName
Recursively get a component of the instrument by full_name.
- Parameters:
name – The name of the component to get.
- Returns:
The component with the given name.
- Raises:
KeyError – If the component does not exist.
- invalidate_cache() None
Invalidate the cache of all parameters on the instrument. Calling this method will recursively mark the cache of all parameters on the instrument and any parameter on instrument modules as invalid.
This is useful if you have performed manual operations (e.g. using the frontpanel) which changes the state of the instrument outside QCoDeS.
This in turn means that the next snapshot of the instrument will trigger a (potentially slow) reread of all parameters of the instrument if you pass update=None to snapshot.
- load_metadata(metadata: Mapping[str, Any]) None
Load metadata into this classes metadata dictionary.
- Parameters:
metadata – Metadata to load.
- property name: str
Full name of the instrument
This is equivalent to
full_name()
for backwards compatibility.
- property name_parts: list[str]
A list of all the parts of the instrument name from
root_instrument()
to the currentInstrumentModule
.
- omit_delegate_attrs: List[str] = []
A list of attribute names (strings) to not delegate to any other dictionary or object.
- property parent: InstrumentBase
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. IfFalse
, 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: InstrumentBase
The topmost parent of this module.
For the
root_instrument
this isself
.
- 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.
For an
InstrumentModule
this does not include any parent names.
- snapshot(update: bool | None = False) Dict[str, 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: bool | None = False, params_to_skip_update: Sequence[str] | None = None) dict[Any, Any]
State of the instrument as a JSON-compatible dict (everything that the custom JSON encoder class
NumpyJSONEncoder
supports).- Parameters:
update – If
True
, update the state by querying the instrument. If None update the state if known to be invalid. IfFalse
, 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:
- 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.
- parameters: dict[str, ParameterBase] = {}
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, InstrumentModule | ChannelTuple] = {}
All the submodules of this instrument such as channel lists or logical groupings of parameters. Usually populated via
add_submodule()
.
- instrument_modules: dict[str, InstrumentModule] = {}
All the
InstrumentModule
of this instrument Usually populated viaadd_submodule()
.
- log: InstrumentLoggerAdapter = get_instrument_logger(self, __name__)
- class qcodes.instrument_drivers.tektronix.TekronixDPOWaveform(parent: Instrument | InstrumentChannel, name: str, identifier: str)[source]
Bases:
InstrumentChannel
This submodule retrieves data from waveform sources, e.g. channels.
Attributes:
Ancestors in the form of a list of
InstrumentBase
A list of names (strings) of dictionaries which are (or will be) attributes of
self
, whose keys should be treated as attributes ofself
.A list of names (strings) of objects which are (or will be) attributes of
self
, whose attributes should be passed through toself
.Full name of the instrument.
Nicely formatted label of the instrument.
Full name of the instrument
A list of all the parts of the instrument name from
root_instrument()
to the currentInstrumentModule
.A list of attribute names (strings) to not delegate to any other dictionary or object.
The parent instrument.
The topmost parent of this module.
Short name of the instrument.
All the parameters supported by this instrument.
All the functions supported by this instrument.
All the submodules of this instrument such as channel lists or logical groupings of parameters.
All the
InstrumentModule
of this instrument Usually populated viaadd_submodule()
.Methods:
__getitem__
(key)Delegate instrument['name'] to parameter or function 'name'.
Prevent pickling instruments, and give a nice error message.
__repr__
()Custom repr to give parent information
add_function
(name, **kwargs)Bind one
Function
to this instrument.add_parameter
(name[, parameter_class])Bind one Parameter to this instrument.
add_submodule
(name, submodule)Bind one submodule to this instrument.
ask
(cmd)ask_raw
(cmd)call
(func_name, *args)Shortcut for calling a function from its name.
get
(param_name)Shortcut for getting a parameter from its name.
get_component
(full_name)Recursively get a component of the instrument by full_name.
Invalidate the cache of all parameters on the instrument.
load_metadata
(metadata)Load metadata into this classes metadata dictionary.
print_readable_snapshot
([update, max_chars])Prints a readable version of the snapshot.
set
(param_name, value)Shortcut for setting a parameter from its name and new value.
snapshot
([update])Decorate a snapshot dictionary with metadata.
snapshot_base
([update, params_to_skip_update])State of the instrument as a JSON-compatible dict (everything that the custom JSON encoder class
NumpyJSONEncoder
supports).validate_status
([verbose])Validate the values of all gettable parameters
write
(cmd)write_raw
(cmd)- valid_identifiers = ['CH1', 'CH2', 'CH3', 'CH4', 'MATH1', 'MATH2', 'MATH3', 'MATH4', 'REF1', 'REF2', 'REF3', 'REF4']
- __getitem__(key: str) Callable[[...], Any] | Parameter
Delegate instrument[‘name’] to parameter or function ‘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.Note
We do not recommend the usage of Function for any new driver. Function does not add any significant features over a method defined on the class.
- 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[qcodes.parameters.parameter_base.ParameterBase] | None = None, **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
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
parameters.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: InstrumentModule | ChannelTuple) 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. They should either be an instance of an
InstrumentModule
or aChannelTuple
.- 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:
- property ancestors: tuple[qcodes.instrument.instrument_base.InstrumentBase, ...]
Ancestors in the form of a list of
InstrumentBase
The list starts with the current module then the parent and the parents parent until the root instrument is reached.
- 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 ofself
.
- 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 toself
.
- property full_name: str
Full name of the instrument.
For an
InstrumentModule
this includes all parents separated by_
- 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_component(full_name: str) MetadatableWithName
Recursively get a component of the instrument by full_name.
- Parameters:
name – The name of the component to get.
- Returns:
The component with the given name.
- Raises:
KeyError – If the component does not exist.
- invalidate_cache() None
Invalidate the cache of all parameters on the instrument. Calling this method will recursively mark the cache of all parameters on the instrument and any parameter on instrument modules as invalid.
This is useful if you have performed manual operations (e.g. using the frontpanel) which changes the state of the instrument outside QCoDeS.
This in turn means that the next snapshot of the instrument will trigger a (potentially slow) reread of all parameters of the instrument if you pass update=None to snapshot.
- load_metadata(metadata: Mapping[str, Any]) None
Load metadata into this classes metadata dictionary.
- Parameters:
metadata – Metadata to load.
- property name: str
Full name of the instrument
This is equivalent to
full_name()
for backwards compatibility.
- property name_parts: list[str]
A list of all the parts of the instrument name from
root_instrument()
to the currentInstrumentModule
.
- omit_delegate_attrs: List[str] = []
A list of attribute names (strings) to not delegate to any other dictionary or object.
- property parent: InstrumentBase
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. IfFalse
, 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: InstrumentBase
The topmost parent of this module.
For the
root_instrument
this isself
.
- 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.
For an
InstrumentModule
this does not include any parent names.
- snapshot(update: bool | None = False) Dict[str, 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: bool | None = False, params_to_skip_update: Sequence[str] | None = None) dict[Any, Any]
State of the instrument as a JSON-compatible dict (everything that the custom JSON encoder class
NumpyJSONEncoder
supports).- Parameters:
update – If
True
, update the state by querying the instrument. If None update the state if known to be invalid. IfFalse
, 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:
- 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.
- parameters: dict[str, ParameterBase] = {}
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, InstrumentModule | ChannelTuple] = {}
All the submodules of this instrument such as channel lists or logical groupings of parameters. Usually populated via
add_submodule()
.
- instrument_modules: dict[str, InstrumentModule] = {}
All the
InstrumentModule
of this instrument Usually populated viaadd_submodule()
.
- log: InstrumentLoggerAdapter = get_instrument_logger(self, __name__)
- class qcodes.instrument_drivers.tektronix.Tektronix70000AWGChannel(parent: Instrument, name: str, channel: int)[source]
Bases:
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.
Methods:
setWaveform
(name)Select a waveform from the waveform list to output on this channel
setSequenceTrack
(seqname, tracknr)Assign a track from a sequence to this channel.
__getitem__
(key)Delegate instrument['name'] to parameter or function 'name'.
Prevent pickling instruments, and give a nice error message.
__repr__
()Custom repr to give parent information
add_function
(name, **kwargs)Bind one
Function
to this instrument.add_parameter
(name[, parameter_class])Bind one Parameter to this instrument.
add_submodule
(name, submodule)Bind one submodule to this instrument.
ask
(cmd)ask_raw
(cmd)call
(func_name, *args)Shortcut for calling a function from its name.
get
(param_name)Shortcut for getting a parameter from its name.
get_component
(full_name)Recursively get a component of the instrument by full_name.
Invalidate the cache of all parameters on the instrument.
load_metadata
(metadata)Load metadata into this classes metadata dictionary.
print_readable_snapshot
([update, max_chars])Prints a readable version of the snapshot.
set
(param_name, value)Shortcut for setting a parameter from its name and new value.
snapshot
([update])Decorate a snapshot dictionary with metadata.
snapshot_base
([update, params_to_skip_update])State of the instrument as a JSON-compatible dict (everything that the custom JSON encoder class
NumpyJSONEncoder
supports).validate_status
([verbose])Validate the values of all gettable parameters
write
(cmd)write_raw
(cmd)Attributes:
Ancestors in the form of a list of
InstrumentBase
A list of names (strings) of dictionaries which are (or will be) attributes of
self
, whose keys should be treated as attributes ofself
.A list of names (strings) of objects which are (or will be) attributes of
self
, whose attributes should be passed through toself
.Full name of the instrument.
Nicely formatted label of the instrument.
Full name of the instrument
A list of all the parts of the instrument name from
root_instrument()
to the currentInstrumentModule
.A list of attribute names (strings) to not delegate to any other dictionary or object.
The parent instrument.
The topmost parent of this module.
Short name of the instrument.
All the parameters supported by this instrument.
All the functions supported by this instrument.
All the submodules of this instrument such as channel lists or logical groupings of parameters.
All the
InstrumentModule
of this instrument Usually populated viaadd_submodule()
.- 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) Callable[[...], Any] | Parameter
Delegate instrument[‘name’] to parameter or function ‘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.Note
We do not recommend the usage of Function for any new driver. Function does not add any significant features over a method defined on the class.
- 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[qcodes.parameters.parameter_base.ParameterBase] | None = None, **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
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
parameters.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: InstrumentModule | ChannelTuple) 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. They should either be an instance of an
InstrumentModule
or aChannelTuple
.- 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:
- property ancestors: tuple[qcodes.instrument.instrument_base.InstrumentBase, ...]
Ancestors in the form of a list of
InstrumentBase
The list starts with the current module then the parent and the parents parent until the root instrument is reached.
- 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 ofself
.
- 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 toself
.
- property full_name: str
Full name of the instrument.
For an
InstrumentModule
this includes all parents separated by_
- 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_component(full_name: str) MetadatableWithName
Recursively get a component of the instrument by full_name.
- Parameters:
name – The name of the component to get.
- Returns:
The component with the given name.
- Raises:
KeyError – If the component does not exist.
- invalidate_cache() None
Invalidate the cache of all parameters on the instrument. Calling this method will recursively mark the cache of all parameters on the instrument and any parameter on instrument modules as invalid.
This is useful if you have performed manual operations (e.g. using the frontpanel) which changes the state of the instrument outside QCoDeS.
This in turn means that the next snapshot of the instrument will trigger a (potentially slow) reread of all parameters of the instrument if you pass update=None to snapshot.
- load_metadata(metadata: Mapping[str, Any]) None
Load metadata into this classes metadata dictionary.
- Parameters:
metadata – Metadata to load.
- property name: str
Full name of the instrument
This is equivalent to
full_name()
for backwards compatibility.
- property name_parts: list[str]
A list of all the parts of the instrument name from
root_instrument()
to the currentInstrumentModule
.
- omit_delegate_attrs: List[str] = []
A list of attribute names (strings) to not delegate to any other dictionary or object.
- property parent: InstrumentBase
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. IfFalse
, 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: InstrumentBase
The topmost parent of this module.
For the
root_instrument
this isself
.
- 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.
For an
InstrumentModule
this does not include any parent names.
- snapshot(update: bool | None = False) Dict[str, 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: bool | None = False, params_to_skip_update: Sequence[str] | None = None) dict[Any, Any]
State of the instrument as a JSON-compatible dict (everything that the custom JSON encoder class
NumpyJSONEncoder
supports).- Parameters:
update – If
True
, update the state by querying the instrument. If None update the state if known to be invalid. IfFalse
, 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:
- 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.
- parameters: dict[str, ParameterBase] = {}
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, InstrumentModule | ChannelTuple] = {}
All the submodules of this instrument such as channel lists or logical groupings of parameters. Usually populated via
add_submodule()
.
- instrument_modules: dict[str, InstrumentModule] = {}
All the
InstrumentModule
of this instrument Usually populated viaadd_submodule()
.
- log: InstrumentLoggerAdapter = get_instrument_logger(self, __name__)
- class qcodes.instrument_drivers.tektronix.TektronixAWG5014(name: str, address: str, timeout: int = 180, num_channels: int = 4, **kwargs: Any)[source]
Bases:
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
Attributes:
Ancestors in the form of a list of
InstrumentBase
A list of names (strings) of dictionaries which are (or will be) attributes of
self
, whose keys should be treated as attributes ofself
.A list of names (strings) of objects which are (or will be) attributes of
self
, whose attributes should be passed through toself
.Full name of the instrument.
Nicely formatted label of the instrument.
Full name of the instrument
A list of all the parts of the instrument name from
root_instrument()
to the currentInstrumentModule
.A list of attribute names (strings) to not delegate to any other dictionary or object.
The parent instrument.
The topmost parent of this module.
Short name of the instrument.
The VISA resource used by this instrument.
All the parameters supported by this instrument.
All the functions supported by this instrument.
All the submodules of this instrument such as channel lists or logical groupings of parameters.
All the
InstrumentModule
of this instrument Usually populated viaadd_submodule()
.Methods:
newlinestripper
(string)This query returns the run state of the arbitrary waveform generator or the sequencer.
start
()Convenience function, identical to self.run()
run
()This command initiates the output of a waveform or a sequence.
stop
()This command stops the output of a waveform or a sequence.
This command generates a trigger event.
get_folder_contents
([print_contents])This query returns the current contents and state of the mass storage media (on the AWG Windows machine).
This query returns the current directory of the file system on the arbitrary waveform generator.
set_current_folder_name
(file_path)Set the current directory of the file system on the arbitrary waveform generator.
change_folder
(folder)Duplicate of self.set_current_folder_name
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)Set the current directory of the file system on the arbitrary waveform generator.
Set the state of all channels to be ON.
Set the state of all channels to be OFF.
This command generates a trigger event.
This command generates a forced event.
set_sqel_event_target_index
(element_no, index)This command sets the target index for the sequencer’s event jump operation.
set_sqel_goto_target_index
(element_no, ...)This command sets the target index for the GOTO command of the sequencer.
set_sqel_goto_state
(element_no, goto_state)This command sets the GOTO state of the sequencer for the specified sequence element.
set_sqel_loopcnt_to_inf
(element_no[, state])This command sets the infinite looping state for a sequence element.
get_sqel_loopcnt
([element_no])This query returns the loop count (number of repetitions) of a sequence element.
set_sqel_loopcnt
(loopcount[, element_no])This command sets the loop count.
set_sqel_waveform
(waveform_name, channel[, ...])This command sets the waveform for a sequence element on the specified channel.
get_sqel_waveform
(channel[, element_no])This query returns the waveform for a sequence element on the specified channel.
set_sqel_trigger_wait
(element_no[, state])This command sets the wait trigger state for an element.
get_sqel_trigger_wait
(element_no)This query returns the wait trigger state for an element.
set_sqel_event_jump_target_index
(element_no, ...)Duplicate of set_sqel_event_target_index
set_sqel_event_jump_type
(element_no, jtar_state)This command sets the event jump target type for the jump for the specified sequence element.
This query returns the type of the arbitrary waveform generator's sequencer.
This function is used to generate a config file, that is used when generating sequence files, from existing settings in the awg.
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.
returns from the channel index and marker index from a marker descriptor string e.g.
Makes an awg file form a forged sequence as produced by broadbean.sequence.Sequence.forge.
send_awg_file
(filename, awg_file[, verbose])Writes an .awg-file onto the disk of the AWG.
load_awg_file
(filename)Loads an .awg-file from the disc of the AWG into the AWG memory.
make_awg_file
(waveforms, m1s, m2s, nreps, ...)- param waveforms:
A list of the waveforms to be packed. The list
make_send_and_load_awg_file
(waveforms, m1s, ...)Makes an .awg-file, sends it to the AWG and loads it.
make_and_save_awg_file
(waveforms, m1s, m2s, ...)Makes an .awg-file and saves it locally.
This function retrieves and returns data from the error and event queues.
Delete all user-defined waveforms in the list in a single action.
Duplicate of self.get_folder_contents
send_DC_pulse
(DC_channel_number, set_level, ...)Sets the DC level on the specified channel, waits a while and then resets it to what it was before.
Assert if the AWG is ready.
send_waveform_to_list
(w, m1, m2, wfmname)Send a single complete waveform directly to the "User defined" waveform list (prepend it).
clear_message_queue
([verbose])Function to clear up (flush) the VISA message queue of the AWG instrument.
__del__
()Close the instrument and remove its instance record.
__getitem__
(key)Delegate instrument['name'] to parameter or function 'name'.
Prevent pickling instruments, and give a nice error message.
__repr__
()Simplified repr giving just the class and name.
add_function
(name, **kwargs)Bind one
Function
to this instrument.add_parameter
(name[, parameter_class])Bind one Parameter to this instrument.
add_submodule
(name, submodule)Bind one submodule to this instrument.
ask
(cmd)Write a command string to the hardware and return a response.
ask_raw
(cmd)Low-level interface to
visa_handle.ask
.call
(func_name, *args)Shortcut for calling a function from its name.
close
()Disconnect and irreversibly tear down the instrument.
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.connect_message
([idn_param, begin_time])Print a standard message on initial connection to an instrument.
Clear the buffers of the device
exist
(name[, instrument_class])Check if an instrument with a given names exists (i.e.
find_instrument
(name[, instrument_class])Find an existing instrument by name.
get
(param_name)Shortcut for getting a parameter from its name.
get_component
(full_name)Recursively get a component of the instrument by full_name.
get_idn
()Parse a standard VISA
*IDN?
response into an ID dict.Get all currently defined instances of this instrument class.
Invalidate the cache of all parameters on the instrument.
is_valid
(instr_instance)Check if a given instance of an instrument is valid: if an instrument has been closed, its instance is not longer a "valid" instrument.
load_metadata
(metadata)Load metadata into this classes metadata dictionary.
print_readable_snapshot
([update, max_chars])Prints a readable version of the snapshot.
record_instance
(instance)Record (a weak ref to) an instance in a class's instance list.
remove_instance
(instance)Remove a particular instance from the record.
set
(param_name, value)Shortcut for setting a parameter from its name and new value.
set_address
(address)Set the address for this instrument.
set_terminator
(terminator)Change the read terminator to use.
snapshot
([update])Decorate a snapshot dictionary with metadata.
snapshot_base
([update, params_to_skip_update])State of the instrument as a JSON-compatible dict (everything that the custom JSON encoder class
NumpyJSONEncoder
supports).validate_status
([verbose])Validate the values of all gettable parameters
write
(cmd)Write a command string with NO response to the hardware.
write_raw
(cmd)Low-level interface to
visa_handle.write
.- 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'}
- get_state() 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.
- 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()
- 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:
- 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
- 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.
- 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()
- 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:
- 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, float | None] [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()
andAWG_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) _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:
seq – the sequence dictionary
filename – filename of the uploaded awg file. See
make_send_and_load_awg_file()
preservechannelsettings – see
make_send_and_load_awg_file()
- 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: Sequence[Sequence[ndarray]] | Sequence[ndarray], m1s: Sequence[Sequence[ndarray]] | Sequence[ndarray], m2s: Sequence[Sequence[ndarray]] | Sequence[ndarray], nreps: Sequence[int], trig_waits: Sequence[int], goto_states: Sequence[int], jump_tos: Sequence[int], channels: Sequence[int] | None = 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[ndarray]], m1s: Sequence[Sequence[ndarray]], m2s: Sequence[Sequence[ndarray]], nreps: Sequence[int], trig_waits: Sequence[int], goto_states: Sequence[int], jump_tos: Sequence[int], channels: Sequence[int] | None = 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[ndarray]], m1s: Sequence[Sequence[ndarray]], m2s: Sequence[Sequence[ndarray]], nreps: Sequence[int], trig_waits: Sequence[int], goto_states: Sequence[int], jump_tos: Sequence[int], channels: Sequence[int] | None = 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.
- 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.
- send_waveform_to_list(w: ndarray, m1: ndarray, m2: 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.
- 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 queue.
- Parameters:
verbose – If True, the read messages are printed. Default: False.
- __getitem__(key: str) Callable[[...], Any] | Parameter
Delegate instrument[‘name’] to parameter or function ‘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.Note
We do not recommend the usage of Function for any new driver. Function does not add any significant features over a method defined on the class.
- 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[qcodes.parameters.parameter_base.ParameterBase] | None = None, **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
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
parameters.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: InstrumentModule | ChannelTuple) 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. They should either be an instance of an
InstrumentModule
or aChannelTuple
.- 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:
- property ancestors: tuple[qcodes.instrument.instrument_base.InstrumentBase, ...]
Ancestors in the form of a list of
InstrumentBase
The list starts with the current module then the parent and the parents parent 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 callsuper().ask(new_cmd)
. Subclasses that define a new hardware communication should instead overrideask_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:
- 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.
- 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: float | None = 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_time –
time.time()
when init started. Default isself._t0
, set at start ofInstrument.__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 ofself
.
- 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 toself
.
- static exist(name: str, instrument_class: type | None = 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: type[T] | None = None) T
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:
- property full_name: str
Full name of the instrument.
For an
InstrumentModule
this includes all parents separated by_
- 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_component(full_name: str) MetadatableWithName
Recursively get a component of the instrument by full_name.
- Parameters:
name – The name of the component to get.
- Returns:
The component with the given name.
- Raises:
KeyError – If the component does not exist.
- get_idn() dict[str, str | None]
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[T]
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.
- invalidate_cache() None
Invalidate the cache of all parameters on the instrument. Calling this method will recursively mark the cache of all parameters on the instrument and any parameter on instrument modules as invalid.
This is useful if you have performed manual operations (e.g. using the frontpanel) which changes the state of the instrument outside QCoDeS.
This in turn means that the next snapshot of the instrument will trigger a (potentially slow) reread of all parameters of the instrument if you pass update=None to snapshot.
- static is_valid(instr_instance: 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: Mapping[str, Any]) None
Load metadata into this classes metadata dictionary.
- Parameters:
metadata – Metadata to load.
- property name: str
Full name of the instrument
This is equivalent to
full_name()
for backwards compatibility.
- property name_parts: list[str]
A list of all the parts of the instrument name from
root_instrument()
to the currentInstrumentModule
.
- omit_delegate_attrs: List[str] = []
A list of attribute names (strings) to not delegate to any other dictionary or object.
- property parent: InstrumentBase | None
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. IfFalse
, 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: 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.
This method is called after initialization of the instrument is completed.
- Parameters:
instance – Instance to record.
- Raises:
KeyError – If another instance with the same name is already present.
- classmethod remove_instance(instance: Instrument) None
Remove a particular instance from the record.
- Parameters:
instance – The instance to remove
- property root_instrument: InstrumentBase
The topmost parent of this module.
For the
root_instrument
this isself
.
- 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) None
Change the read terminator to use.
- Parameters:
terminator – Character(s) to look for at the end of a read and to end each write command with. eg.
\r\n
. If None the terminator will not be set.
- property short_name: str
Short name of the instrument.
For an
InstrumentModule
this does not include any parent names.
- snapshot(update: bool | None = False) Dict[str, 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: bool | None = True, params_to_skip_update: Sequence[str] | None = None) dict[Any, Any]
State of the instrument as a JSON-compatible dict (everything that the custom JSON encoder class
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:
- 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 callsuper().write(new_cmd)
. Subclasses that define a new hardware communication should instead overridewrite_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.
- visa_handle: pyvisa.resources.MessageBasedResource = visa_handle
The VISA resource used by this instrument.
- parameters: dict[str, ParameterBase] = {}
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, InstrumentModule | ChannelTuple] = {}
All the submodules of this instrument such as channel lists or logical groupings of parameters. Usually populated via
add_submodule()
.
- instrument_modules: dict[str, InstrumentModule] = {}
All the
InstrumentModule
of this instrument Usually populated viaadd_submodule()
.
- log: InstrumentLoggerAdapter = get_instrument_logger(self, __name__)
- class qcodes.instrument_drivers.tektronix.TektronixAWG5208(name: str, address: str, timeout: float = 10, **kwargs: Any)[source]
Bases:
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).
Methods:
__del__
()Close the instrument and remove its instance record.
__getitem__
(key)Delegate instrument['name'] to parameter or function 'name'.
Prevent pickling instruments, and give a nice error message.
__repr__
()Simplified repr giving just the class and name.
add_function
(name, **kwargs)Bind one
Function
to this instrument.add_parameter
(name[, parameter_class])Bind one Parameter to this instrument.
add_submodule
(name, submodule)Bind one submodule to this instrument.
ask
(cmd)Write a command string to the hardware and return a response.
ask_raw
(cmd)Low-level interface to
visa_handle.ask
.call
(func_name, *args)Shortcut for calling a function from its name.
Clear the sequence list
Clear the waveform list
close
()Disconnect and irreversibly tear down the instrument.
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.connect_message
([idn_param, begin_time])Print a standard message on initial connection to an instrument.
delete_sequence_from_list
(seqname)Delete the specified sequence from the sequence list
Clear the buffers of the device
exist
(name[, instrument_class])Check if an instrument with a given names exists (i.e.
find_instrument
(name[, instrument_class])Find an existing instrument by name.
Force a trigger A event
Force a trigger B event
get
(param_name)Shortcut for getting a parameter from its name.
get_component
(full_name)Recursively get a component of the instrument by full_name.
get_idn
()Parse a standard VISA
*IDN?
response into an ID dict.Get all currently defined instances of this instrument class.
Invalidate the cache of all parameters on the instrument.
is_valid
(instr_instance)Check if a given instance of an instrument is valid: if an instrument has been closed, its instance is not longer a "valid" instrument.
loadSEQXFile
(filename[, path])Load a seqx file from instrument disk memory.
loadWFMXFile
(filename[, path])Loads a wfmx from memory into the waveform list Only loading from the C: drive is supported
load_metadata
(metadata)Load metadata into this classes metadata dictionary.
makeSEQXFile
(trig_waits, nreps, event_jumps, ...)Make a full .seqx file (bundle) A .seqx file can presumably hold several sequences, but for now we support only packing a single sequence
makeWFMXFile
(data, amplitude)Compose a WFMX file
make_SEQX_from_forged_sequence
(seq, ...[, ...])Make a .seqx from a forged broadbean sequence.
play
([wait_for_running, timeout])Run the AWG/Func.
print_readable_snapshot
([update, max_chars])Prints a readable version of the snapshot.
record_instance
(instance)Record (a weak ref to) an instance in a class's instance list.
remove_instance
(instance)Remove a particular instance from the record.
sendSEQXFile
(seqx, filename[, path])Send a binary seqx file to the AWG's memory
sendWFMXFile
(wfmx, filename[, path])Send a binary wfmx file to the AWG's memory
set
(param_name, value)Shortcut for setting a parameter from its name and new value.
set_address
(address)Set the address for this instrument.
set_terminator
(terminator)Change the read terminator to use.
snapshot
([update])Decorate a snapshot dictionary with metadata.
snapshot_base
([update, params_to_skip_update])State of the instrument as a JSON-compatible dict (everything that the custom JSON encoder class
NumpyJSONEncoder
supports).stop
()Stop the output of the instrument.
validate_status
([verbose])Validate the values of all gettable parameters
Waits for the latest issued overlapping command to finish
write
(cmd)Write a command string with NO response to the hardware.
write_raw
(cmd)Low-level interface to
visa_handle.write
.Attributes:
Ancestors in the form of a list of
InstrumentBase
A list of names (strings) of dictionaries which are (or will be) attributes of
self
, whose keys should be treated as attributes ofself
.A list of names (strings) of objects which are (or will be) attributes of
self
, whose attributes should be passed through toself
.Full name of the instrument.
Nicely formatted label of the instrument.
Full name of the instrument
A list of all the parts of the instrument name from
root_instrument()
to the currentInstrumentModule
.A list of attribute names (strings) to not delegate to any other dictionary or object.
The parent instrument.
The topmost parent of this module.
Return the sequence list as a list of strings
Short name of the instrument.
Return the waveform list as a list of strings
The VISA resource used by this instrument.
All the parameters supported by this instrument.
All the functions supported by this instrument.
All the submodules of this instrument such as channel lists or logical groupings of parameters.
All the
InstrumentModule
of this instrument Usually populated viaadd_submodule()
.- __getitem__(key: str) Callable[[...], Any] | Parameter
Delegate instrument[‘name’] to parameter or function ‘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.Note
We do not recommend the usage of Function for any new driver. Function does not add any significant features over a method defined on the class.
- 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[qcodes.parameters.parameter_base.ParameterBase] | None = None, **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
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
parameters.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: InstrumentModule | ChannelTuple) 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. They should either be an instance of an
InstrumentModule
or aChannelTuple
.- 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:
- property ancestors: tuple[qcodes.instrument.instrument_base.InstrumentBase, ...]
Ancestors in the form of a list of
InstrumentBase
The list starts with the current module then the parent and the parents parent 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 callsuper().ask(new_cmd)
. Subclasses that define a new hardware communication should instead overrideask_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:
- 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.
- 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: float | None = 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_time –
time.time()
when init started. Default isself._t0
, set at start ofInstrument.__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 ofself
.
- 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 toself
.
- 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
- static exist(name: str, instrument_class: type | None = 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: type[T] | None = None) T
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:
- property full_name: str
Full name of the instrument.
For an
InstrumentModule
this includes all parents separated by_
- 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_component(full_name: str) MetadatableWithName
Recursively get a component of the instrument by full_name.
- Parameters:
name – The name of the component to get.
- Returns:
The component with the given name.
- Raises:
KeyError – If the component does not exist.
- get_idn() dict[str, str | None]
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[T]
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.
- invalidate_cache() None
Invalidate the cache of all parameters on the instrument. Calling this method will recursively mark the cache of all parameters on the instrument and any parameter on instrument modules as invalid.
This is useful if you have performed manual operations (e.g. using the frontpanel) which changes the state of the instrument outside QCoDeS.
This in turn means that the next snapshot of the instrument will trigger a (potentially slow) reread of all parameters of the instrument if you pass update=None to snapshot.
- static is_valid(instr_instance: 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: str | None = 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: str | None = 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: Mapping[str, 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[ndarray]], amplitudes: Sequence[float], seqname: str, flags: Sequence[Sequence[Sequence[int]]] | None = None) 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 ‘_’
flags – Flags for the auxiliary outputs. 0 for ‘No change’, 1 for ‘High’, 2 for ‘Low’, 3 for ‘Toggle’, or 4 for ‘Pulse’. 4 flags [A, B, C, D] for every channel in every element, packed like: [[ch1pos1, ch1pos2, …], [ch2pos1, …], …] If omitted, no flags will be set.
- Returns:
The binary .seqx file, ready to be sent to the instrument.
- static makeWFMXFile(data: 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: Mapping[int, Mapping[Any, Any]], amplitudes: Sequence[float], seqname: str, channel_mapping: Mapping[str | int, int] | None = 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
Full name of the instrument
This is equivalent to
full_name()
for backwards compatibility.
- property name_parts: list[str]
A list of all the parts of the instrument name from
root_instrument()
to the currentInstrumentModule
.
- omit_delegate_attrs: List[str] = []
A list of attribute names (strings) to not delegate to any other dictionary or object.
- property parent: InstrumentBase | None
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. IfFalse
, 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: 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.
This method is called after initialization of the instrument is completed.
- Parameters:
instance – Instance to record.
- Raises:
KeyError – If another instance with the same name is already present.
- classmethod remove_instance(instance: Instrument) None
Remove a particular instance from the record.
- Parameters:
instance – The instance to remove
- property root_instrument: InstrumentBase
The topmost parent of this module.
For the
root_instrument
this isself
.
- sendSEQXFile(seqx: bytes, filename: str, path: str | None = 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: str | None = 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.
- 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) None
Change the read terminator to use.
- Parameters:
terminator – Character(s) to look for at the end of a read and to end each write command with. eg.
\r\n
. If None the terminator will not be set.
- property short_name: str
Short name of the instrument.
For an
InstrumentModule
this does not include any parent names.
- snapshot(update: bool | None = False) Dict[str, 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: bool | None = True, params_to_skip_update: Sequence[str] | None = None) dict[Any, Any]
State of the instrument as a JSON-compatible dict (everything that the custom JSON encoder class
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:
- 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.
- 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 callsuper().write(new_cmd)
. Subclasses that define a new hardware communication should instead overridewrite_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.
- visa_handle: pyvisa.resources.MessageBasedResource = visa_handle
The VISA resource used by this instrument.
- parameters: dict[str, ParameterBase] = {}
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, InstrumentModule | ChannelTuple] = {}
All the submodules of this instrument such as channel lists or logical groupings of parameters. Usually populated via
add_submodule()
.
- instrument_modules: dict[str, InstrumentModule] = {}
All the
InstrumentModule
of this instrument Usually populated viaadd_submodule()
.
- log: InstrumentLoggerAdapter = get_instrument_logger(self, __name__)
- class qcodes.instrument_drivers.tektronix.TektronixAWG70001A(name: str, address: str, timeout: float = 10, **kwargs: Any)[source]
Bases:
AWG70000A
The QCoDeS driver for Tektronix AWG70001A 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).
Methods:
__del__
()Close the instrument and remove its instance record.
__getitem__
(key)Delegate instrument['name'] to parameter or function 'name'.
Prevent pickling instruments, and give a nice error message.
__repr__
()Simplified repr giving just the class and name.
add_function
(name, **kwargs)Bind one
Function
to this instrument.add_parameter
(name[, parameter_class])Bind one Parameter to this instrument.
add_submodule
(name, submodule)Bind one submodule to this instrument.
ask
(cmd)Write a command string to the hardware and return a response.
ask_raw
(cmd)Low-level interface to
visa_handle.ask
.call
(func_name, *args)Shortcut for calling a function from its name.
Clear the sequence list
Clear the waveform list
close
()Disconnect and irreversibly tear down the instrument.
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.connect_message
([idn_param, begin_time])Print a standard message on initial connection to an instrument.
delete_sequence_from_list
(seqname)Delete the specified sequence from the sequence list
Clear the buffers of the device
exist
(name[, instrument_class])Check if an instrument with a given names exists (i.e.
find_instrument
(name[, instrument_class])Find an existing instrument by name.
Force a trigger A event
Force a trigger B event
get
(param_name)Shortcut for getting a parameter from its name.
get_component
(full_name)Recursively get a component of the instrument by full_name.
get_idn
()Parse a standard VISA
*IDN?
response into an ID dict.Get all currently defined instances of this instrument class.
Invalidate the cache of all parameters on the instrument.
is_valid
(instr_instance)Check if a given instance of an instrument is valid: if an instrument has been closed, its instance is not longer a "valid" instrument.
loadSEQXFile
(filename[, path])Load a seqx file from instrument disk memory.
loadWFMXFile
(filename[, path])Loads a wfmx from memory into the waveform list Only loading from the C: drive is supported
load_metadata
(metadata)Load metadata into this classes metadata dictionary.
makeSEQXFile
(trig_waits, nreps, event_jumps, ...)Make a full .seqx file (bundle) A .seqx file can presumably hold several sequences, but for now we support only packing a single sequence
makeWFMXFile
(data, amplitude)Compose a WFMX file
make_SEQX_from_forged_sequence
(seq, ...[, ...])Make a .seqx from a forged broadbean sequence.
play
([wait_for_running, timeout])Run the AWG/Func.
print_readable_snapshot
([update, max_chars])Prints a readable version of the snapshot.
record_instance
(instance)Record (a weak ref to) an instance in a class's instance list.
remove_instance
(instance)Remove a particular instance from the record.
sendSEQXFile
(seqx, filename[, path])Send a binary seqx file to the AWG's memory
sendWFMXFile
(wfmx, filename[, path])Send a binary wfmx file to the AWG's memory
set
(param_name, value)Shortcut for setting a parameter from its name and new value.
set_address
(address)Set the address for this instrument.
set_terminator
(terminator)Change the read terminator to use.
snapshot
([update])Decorate a snapshot dictionary with metadata.
snapshot_base
([update, params_to_skip_update])State of the instrument as a JSON-compatible dict (everything that the custom JSON encoder class
NumpyJSONEncoder
supports).stop
()Stop the output of the instrument.
validate_status
([verbose])Validate the values of all gettable parameters
Waits for the latest issued overlapping command to finish
write
(cmd)Write a command string with NO response to the hardware.
write_raw
(cmd)Low-level interface to
visa_handle.write
.Attributes:
Ancestors in the form of a list of
InstrumentBase
A list of names (strings) of dictionaries which are (or will be) attributes of
self
, whose keys should be treated as attributes ofself
.A list of names (strings) of objects which are (or will be) attributes of
self
, whose attributes should be passed through toself
.Full name of the instrument.
Nicely formatted label of the instrument.
Full name of the instrument
A list of all the parts of the instrument name from
root_instrument()
to the currentInstrumentModule
.A list of attribute names (strings) to not delegate to any other dictionary or object.
The parent instrument.
The topmost parent of this module.
Return the sequence list as a list of strings
Short name of the instrument.
Return the waveform list as a list of strings
The VISA resource used by this instrument.
All the parameters supported by this instrument.
All the functions supported by this instrument.
All the submodules of this instrument such as channel lists or logical groupings of parameters.
All the
InstrumentModule
of this instrument Usually populated viaadd_submodule()
.- __getitem__(key: str) Callable[[...], Any] | Parameter
Delegate instrument[‘name’] to parameter or function ‘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.Note
We do not recommend the usage of Function for any new driver. Function does not add any significant features over a method defined on the class.
- 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[qcodes.parameters.parameter_base.ParameterBase] | None = None, **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
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
parameters.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: InstrumentModule | ChannelTuple) 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. They should either be an instance of an
InstrumentModule
or aChannelTuple
.- 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:
- property ancestors: tuple[qcodes.instrument.instrument_base.InstrumentBase, ...]