qcodes.instrument_drivers.AlazarTech package

Submodules

qcodes.instrument_drivers.AlazarTech.ATS module

class qcodes.instrument_drivers.AlazarTech.ATS.AcquisitionController(name: str, alazar_name: str, **kwargs: Any)[source]

Bases: qcodes.instrument.base.Instrument, qcodes.instrument_drivers.AlazarTech.ATS.AcquisitionInterface[Any], Generic[qcodes.instrument_drivers.AlazarTech.ATS.OutputType]

Compatibility class. The methods of AcquisitionController have been extracted. This class is the base class fro AcquisitionInterfaces that are intended to be QCoDeS instruments at the same time.

Parameters

alazar_name – The name of the alazar instrument.

__del__() None

Close the instrument and remove its instance record.

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

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

__getstate__() None

Prevent pickling instruments, and give a nice error message.

__repr__() str

Simplified repr giving just the class and name.

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

Bind one Function to this instrument.

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

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

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

  • **kwargs – constructor kwargs for Function

Raises

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

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

Bind one Parameter to this instrument.

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

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

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

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

  • **kwargs – Constructor arguments for parameter_class.

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

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

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

Bind one submodule to this instrument.

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

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

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

  • submodule – The submodule to be stored.

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

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

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

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

ask(cmd: str) str

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

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

Parameters

cmd – The string to send to the instrument.

Returns

response

Raises

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

ask_raw(cmd: str) str

Low level method to write to the hardware and return a response.

Subclasses that define a new hardware communication should override this method. Subclasses that transform cmd should instead override ask.

Parameters

cmd – The string to send to the instrument.

buffer_done_callback(buffers_completed: int) None

This method is called when a buffer is completed. It can be used if you want to implement an event that happens for each buffer. You will probably want to combine this with AUX_IN_TRIGGER_ENABLE to wait before starting capture of the next buffer.

Parameters

buffers_completed – how many buffers have been completed and copied to local memory at the time of this callback.

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.

close() None

Irreversibly stop this instrument and free its resources.

Subclasses should override this if they have other specific resources to close.

classmethod close_all() None

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

Examples

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

Print a standard message on initial connection to an instrument.

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

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

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

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

delegate_attr_objects: List[str] = []

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

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

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

Parameters
  • name – Name of the instrument.

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

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

Find an existing instrument by name.

Parameters
  • name – Name of the instrument.

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

Returns

The instrument found.

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

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

property full_name: str
get(param_name: str) Any

Shortcut for getting a parameter from its name.

Parameters

param_name – The name of a parameter of this instrument.

Returns

The current value of the parameter.

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

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

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

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

Returns

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

handle_buffer(buffer: numpy.ndarray, buffer_number: Optional[int] = None) None

This method should store or process the information that is contained in the buffers obtained during the acquisition.

Parameters
  • buffer – np.array with the data from the Alazar card

  • buffer_number – counter for which buffer we are handling

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

Get all currently defined instances of this instrument class.

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

Returns

A list of instances.

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

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

Parameters

instr_instance – Instance of an Instrument class or its subclass.

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

Load metadata into this classes metadata dictionary.

Parameters

metadata – Metadata to load.

property name: str

Name of the instrument

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

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

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

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

post_acquire() qcodes.instrument_drivers.AlazarTech.ATS.OutputType

This method should return any information you want to save from this acquisition. The acquisition method from the Alazar driver will use this data as its own return value

Returns

this function should return all relevant data that you want to get form the acquisition

pre_acquire() None

This method is called immediately after ‘AlazarStartCapture’ is called

pre_start_capture() None

Use this method to prepare yourself for the data acquisition The Alazar instrument will call this method right before ‘AlazarStartCapture’ is called

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

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

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

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

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

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

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

Parameters

instance – Instance to record.

Raises

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

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

Remove a particular instance from the record.

Parameters

instance – The instance to remove

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

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

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

  • value – The new value to set.

shared_kwargs = ()
property short_name: str

Short name of the instrument

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

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

Parameters

update – Passed to snapshot_base.

Returns

Base snapshot.

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

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

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

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

Returns

base snapshot

Return type

dict

validate_status(verbose: bool = False) None

Validate the values of all gettable parameters

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

Parameters

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

write(cmd: str) None

Write a command string with NO response to the hardware.

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

Parameters

cmd – The string to send to the instrument.

Raises

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

write_raw(cmd: str) None

Low level method to write a command string to the hardware.

Subclasses that define a new hardware communication should override this method. Subclasses that transform cmd should instead override write.

Parameters

cmd – The string to send to the instrument.

parameters: Dict[str, _BaseParameter] = {}

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

functions: Dict[str, Function] = {}

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

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

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

log: InstrumentLoggerAdapter = get_instrument_logger(self, __name__)
class qcodes.instrument_drivers.AlazarTech.ATS.AcquisitionInterface(*args, **kwds)[source]

Bases: Generic[qcodes.instrument_drivers.AlazarTech.ATS.OutputType]

This class represents all choices that the end-user has to make regarding the data-acquisition. this class should be subclassed to program these choices.

The basic structure of an acquisition is:

pre_start_capture() None[source]

Use this method to prepare yourself for the data acquisition The Alazar instrument will call this method right before ‘AlazarStartCapture’ is called

pre_acquire() None[source]

This method is called immediately after ‘AlazarStartCapture’ is called

handle_buffer(buffer: numpy.ndarray, buffer_number: Optional[int] = None) None[source]

This method should store or process the information that is contained in the buffers obtained during the acquisition.

Parameters
  • buffer – np.array with the data from the Alazar card

  • buffer_number – counter for which buffer we are handling

post_acquire() qcodes.instrument_drivers.AlazarTech.ATS.OutputType[source]

This method should return any information you want to save from this acquisition. The acquisition method from the Alazar driver will use this data as its own return value

Returns

this function should return all relevant data that you want to get form the acquisition

buffer_done_callback(buffers_completed: int) None[source]

This method is called when a buffer is completed. It can be used if you want to implement an event that happens for each buffer. You will probably want to combine this with AUX_IN_TRIGGER_ENABLE to wait before starting capture of the next buffer.

Parameters

buffers_completed – how many buffers have been completed and copied to local memory at the time of this callback.

class qcodes.instrument_drivers.AlazarTech.ATS.AlazarTech_ATS(name: str, system_id: int = 1, board_id: int = 1, dll_path: Optional[str] = None, api: Optional[qcodes.instrument_drivers.AlazarTech.ats_api.AlazarATSAPI] = None, **kwargs: Any)[source]

Bases: qcodes.instrument.base.Instrument

This is the qcodes driver for Alazar data acquisition cards

status: beta-version

Parameters
  • name – name for this instrument

  • system_id – target system id for this board

  • board_id – target board id within the system for this board

  • dll_path – path to the ATS driver dll library file

  • api – AlazarATSAPI interface, defaults to the dll api. This argument makes it possible to provide another api, e.g. for a simulated driver for which the binary Alazar drivers do not need to be installed.

dll_path = 'C:\\WINDOWS\\System32\\ATSApi'
channels = 2
classmethod find_boards(dll_path: Optional[str] = None) List[Dict[str, Any]][source]

Find connected Alazar boards

Parameters

dll_path – path to the Alazar API DLL library

Returns

list of board info dictionaries for each connected board

classmethod get_board_info(api: qcodes.instrument_drivers.AlazarTech.ats_api.AlazarATSAPI, system_id: int, board_id: int) Dict[str, Union[str, int]][source]

Get the information from a connected Alazar board

Parameters
  • api – An AlazarATSAPI that wraps around the CTypes CDLL

  • system_id – id of the Alazar system

  • board_id – id of the board within the alazar system

Returns

Dictionary containing

  • system_id

  • board_id

  • board_kind (as string)

  • max_samples

  • bits_per_sample

api: qcodes.instrument_drivers.AlazarTech.ats_api.AlazarATSAPI = api or AlazarATSAPI(dll_path or self.dll_path)
get_idn() Dict[str, Optional[Union[str, int]]][source]

This methods gets the most relevant information of this instrument

The firmware version reported should match the version number of downloadable fw files from AlazarTech. But note that the firmware version has often been found to be incorrect for several firmware versions. At the time of writing it is known to be correct for the 9360 (v 21.07) and 9373 (v 30.04) but incorrect for several earlier versions. In Alazar DSO this is reported as FPGA Version.

Returns

Dictionary containing
  • ’firmware’: as string

  • ’model’: as string

  • ’serial’: board serial number

  • ’vendor’: ‘AlazarTech’

  • ’CPLD_version’: version of the CPLD

  • ’driver_version’: version of the driver dll

  • ’SDK_version’: version of the SDK

  • ’latest_cal_date’: date of the latest calibration (as string)

  • ’memory_size’: size of the memory in samples

  • ’asopc_type’: type of asopc (as decimal number)

  • ’pcie_link_speed’: the speed of a single pcie link (in GB/s)

  • ’pcie_link_width’: number of pcie links

  • ’bits_per_sample’: number of bits per one sample

  • ’max_samples’: board memory size in samples

syncing() Iterator[None][source]

Context manager for syncing settings to Alazar card. It will automatically call sync_settings_to_card at the end of the context.

Example

This is intended to be used around multiple parameter sets to ensure syncing is done exactly once:

with alazar.syncing():
     alazar.trigger_source1('EXTERNAL')
     alazar.trigger_level1(100)
sync_settings_to_card() None[source]

Syncs all parameters to Alazar card

allocate_and_post_buffer(sample_type: Union[Type[ctypes.c_ubyte], Type[ctypes.c_ushort], Type[ctypes.c_uint], Type[ctypes.c_int], Type[ctypes.c_float]], n_bytes: int) qcodes.instrument_drivers.AlazarTech.ATS.Buffer[source]
acquire(mode: Optional[str] = None, samples_per_record: Optional[int] = None, records_per_buffer: Optional[int] = None, buffers_per_acquisition: Optional[int] = None, channel_selection: Optional[str] = None, transfer_offset: Optional[int] = None, external_startcapture: Optional[str] = None, enable_record_headers: Optional[str] = None, alloc_buffers: Optional[str] = None, fifo_only_streaming: Optional[str] = None, interleave_samples: Optional[str] = None, get_processed_data: Optional[str] = None, allocated_buffers: Optional[int] = None, buffer_timeout: Optional[int] = None, acquisition_controller: Optional[qcodes.instrument_drivers.AlazarTech.ATS.AcquisitionController[Any]] = None) qcodes.instrument_drivers.AlazarTech.ATS.OutputType[source]

perform a single acquisition with the Alazar board, and set certain parameters to the appropriate values for the parameters, see the ATS-SDK programmer’s guide

Parameters
  • mode

  • samples_per_record

  • records_per_buffer

  • buffers_per_acquisition

  • channel_selection

  • transfer_offset

  • external_startcapture

  • enable_record_headers

  • alloc_buffers

  • fifo_only_streaming

  • interleave_samples

  • get_processed_data

  • allocated_buffers

  • buffer_timeout

  • acquisition_controller – An instance of an acquisition controller that handles the dataflow of an acquisition

Returns

Whatever is given by acquisition_controller.post_acquire method

clear_buffers() None[source]

This method uncommits all buffers that were committed by the driver. This method only has to be called when the acquistion crashes, otherwise the driver will uncommit the buffers itself

Returns

None

signal_to_volt(channel: int, signal: float) float[source]

convert a value from a buffer to an actual value in volts based on the ranges of the channel

Parameters
  • channel – number of the channel where the signal value came from

  • signal – the value that needs to be converted

Returns

the corresponding value in volts

get_sample_rate(include_decimation: bool = True) float[source]

Obtain the effective sampling rate of the acquisition based on clock speed and decimation

Returns

the number of samples (per channel) per second

static get_num_channels(byte_rep: int) int[source]

Return the number of channels for a specific channel mask

Each single channel is represented by a bitarray with one non zero entry i.e. powers of two. All multichannel masks can be constructed by summing the single channel ones. However, not all configurations are supported. See table 4 Input Channel Configurations on page 241 of the Alazar SDK manual. This contains the complete mapping for all current Alazar cards. It’s left to the driver to ensure that only the ones supported for a specific card can be selected

__del__() None

Close the instrument and remove its instance record.

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

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

__getstate__() None

Prevent pickling instruments, and give a nice error message.

__repr__() str

Simplified repr giving just the class and name.

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

Bind one Function to this instrument.

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

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

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

  • **kwargs – constructor kwargs for Function

Raises

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

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

Bind one Parameter to this instrument.

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

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

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

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

  • **kwargs – Constructor arguments for parameter_class.

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

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

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

Bind one submodule to this instrument.

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

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

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

  • submodule – The submodule to be stored.

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

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

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

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

ask(cmd: str) str

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

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

Parameters

cmd – The string to send to the instrument.

Returns

response

Raises

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

ask_raw(cmd: str) str

Low level method to write to the hardware and return a response.

Subclasses that define a new hardware communication should override this method. Subclasses that transform cmd should instead override ask.

Parameters

cmd – The string to send to the instrument.

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

Shortcut for calling a function from its name.

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

  • *args – any arguments to the function.

Returns

The return value of the function.

close() None

Irreversibly stop this instrument and free its resources.

Subclasses should override this if they have other specific resources to close.

classmethod close_all() None

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

Examples

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

Print a standard message on initial connection to an instrument.

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

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

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

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

delegate_attr_objects: List[str] = []

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

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

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

Parameters
  • name – Name of the instrument.

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

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

Find an existing instrument by name.

Parameters
  • name – Name of the instrument.

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

Returns

The instrument found.

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

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

property full_name: str
get(param_name: str) Any

Shortcut for getting a parameter from its name.

Parameters

param_name – The name of a parameter of this instrument.

Returns

The current value of the parameter.

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

Get all currently defined instances of this instrument class.

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

Returns

A list of instances.

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

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

Parameters

instr_instance – Instance of an Instrument class or its subclass.

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

Load metadata into this classes metadata dictionary.

Parameters

metadata – Metadata to load.

property name: str

Name of the instrument

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

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

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

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

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

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

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

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

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

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

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

Parameters

instance – Instance to record.

Raises

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

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

Remove a particular instance from the record.

Parameters

instance – The instance to remove

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

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

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

  • value – The new value to set.

shared_kwargs = ()
property short_name: str

Short name of the instrument

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

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

Parameters

update – Passed to snapshot_base.

Returns

Base snapshot.

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

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

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

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

Returns

base snapshot

Return type

dict

validate_status(verbose: bool = False) None

Validate the values of all gettable parameters

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

Parameters

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

write(cmd: str) None

Write a command string with NO response to the hardware.

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

Parameters

cmd – The string to send to the instrument.

Raises

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

write_raw(cmd: str) None

Low level method to write a command string to the hardware.

Subclasses that define a new hardware communication should override this method. Subclasses that transform cmd should instead override write.

Parameters

cmd – The string to send to the instrument.

parameters: Dict[str, _BaseParameter] = {}

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

functions: Dict[str, Function] = {}

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

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

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

log: InstrumentLoggerAdapter = get_instrument_logger(self, __name__)
class qcodes.instrument_drivers.AlazarTech.ATS.Buffer(c_sample_type: Union[Type[ctypes.c_ubyte], Type[ctypes.c_ushort], Type[ctypes.c_uint], Type[ctypes.c_int], Type[ctypes.c_float]], size_bytes: int)[source]

Bases: object

Buffer suitable for DMA transfers.

AlazarTech digitizers use direct memory access (DMA) to transfer data from digitizers to the computer’s main memory. This class abstracts a memory buffer on the host, and ensures that all the requirements for DMA transfers are met.

Buffer export a ‘buffer’ member, which is a NumPy array view of the underlying memory buffer

Parameters
  • c_sample_type – The datatype of the buffer to create. Should be a valid ctypes type.

  • size_bytes – The size of the buffer to allocate, in bytes.

free_mem() None[source]

uncommit memory allocated with this buffer object

__del__() None[source]

If python garbage collects this object, __del__ should be called and it is the last chance to uncommit the memory to prevent a memory leak. This method is not very reliable so users should not rely on this functionality

qcodes.instrument_drivers.AlazarTech.ATS9360 module

class qcodes.instrument_drivers.AlazarTech.ATS9360.AlazarTech_ATS9360(name: str, dll_path: str = 'C:\\WINDOWS\\System32\\ATSApi.dll', **kwargs: Any)[source]

Bases: qcodes.instrument_drivers.AlazarTech.ATS.AlazarTech_ATS

This class is the driver for the ATS9360 board it inherits from the ATS base class

samples_divisor = 128
__del__() None

Close the instrument and remove its instance record.

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

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

__getstate__() None

Prevent pickling instruments, and give a nice error message.

__repr__() str

Simplified repr giving just the class and name.

acquire(mode: Optional[str] = None, samples_per_record: Optional[int] = None, records_per_buffer: Optional[int] = None, buffers_per_acquisition: Optional[int] = None, channel_selection: Optional[str] = None, transfer_offset: Optional[int] = None, external_startcapture: Optional[str] = None, enable_record_headers: Optional[str] = None, alloc_buffers: Optional[str] = None, fifo_only_streaming: Optional[str] = None, interleave_samples: Optional[str] = None, get_processed_data: Optional[str] = None, allocated_buffers: Optional[int] = None, buffer_timeout: Optional[int] = None, acquisition_controller: Optional[qcodes.instrument_drivers.AlazarTech.ATS.AcquisitionController[Any]] = None) qcodes.instrument_drivers.AlazarTech.ATS.OutputType

perform a single acquisition with the Alazar board, and set certain parameters to the appropriate values for the parameters, see the ATS-SDK programmer’s guide

Parameters
  • mode

  • samples_per_record

  • records_per_buffer

  • buffers_per_acquisition

  • channel_selection

  • transfer_offset

  • external_startcapture

  • enable_record_headers

  • alloc_buffers

  • fifo_only_streaming

  • interleave_samples

  • get_processed_data

  • allocated_buffers

  • buffer_timeout

  • acquisition_controller – An instance of an acquisition controller that handles the dataflow of an acquisition

Returns

Whatever is given by acquisition_controller.post_acquire method

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

Bind one Function to this instrument.

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

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

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

  • **kwargs – constructor kwargs for Function

Raises

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

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

Bind one Parameter to this instrument.

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

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

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

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

  • **kwargs – Constructor arguments for parameter_class.

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

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

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

Bind one submodule to this instrument.

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

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

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

  • submodule – The submodule to be stored.

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

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

allocate_and_post_buffer(sample_type: Union[Type[ctypes.c_ubyte], Type[ctypes.c_ushort], Type[ctypes.c_uint], Type[ctypes.c_int], Type[ctypes.c_float]], n_bytes: int) qcodes.instrument_drivers.AlazarTech.ATS.Buffer
property ancestors: List[qcodes.instrument.base.InstrumentBase]

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

ask(cmd: str) str

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

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

Parameters

cmd – The string to send to the instrument.

Returns

response

Raises

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

ask_raw(cmd: str) str

Low level method to write to the hardware and return a response.

Subclasses that define a new hardware communication should override this method. Subclasses that transform cmd should instead override ask.

Parameters

cmd – The string to send to the instrument.

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

Shortcut for calling a function from its name.

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

  • *args – any arguments to the function.

Returns

The return value of the function.

channels = 2
clear_buffers() None

This method uncommits all buffers that were committed by the driver. This method only has to be called when the acquistion crashes, otherwise the driver will uncommit the buffers itself

Returns

None

close() None

Irreversibly stop this instrument and free its resources.

Subclasses should override this if they have other specific resources to close.

classmethod close_all() None

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

Examples

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

Print a standard message on initial connection to an instrument.

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

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

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

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

delegate_attr_objects: List[str] = []

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

dll_path = 'C:\\WINDOWS\\System32\\ATSApi'
static exist(name: str, instrument_class: Optional[type] = None) bool

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

Parameters
  • name – Name of the instrument.

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

classmethod find_boards(dll_path: Optional[str] = None) List[Dict[str, Any]]

Find connected Alazar boards

Parameters

dll_path – path to the Alazar API DLL library

Returns

list of board info dictionaries for each connected board

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

Find an existing instrument by name.

Parameters
  • name – Name of the instrument.

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

Returns

The instrument found.

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

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

property full_name: str
get(param_name: str) Any

Shortcut for getting a parameter from its name.

Parameters

param_name – The name of a parameter of this instrument.

Returns

The current value of the parameter.

classmethod get_board_info(api: qcodes.instrument_drivers.AlazarTech.ats_api.AlazarATSAPI, system_id: int, board_id: int) Dict[str, Union[str, int]]

Get the information from a connected Alazar board

Parameters
  • api – An AlazarATSAPI that wraps around the CTypes CDLL

  • system_id – id of the Alazar system

  • board_id – id of the board within the alazar system

Returns

Dictionary containing

  • system_id

  • board_id

  • board_kind (as string)

  • max_samples

  • bits_per_sample

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

This methods gets the most relevant information of this instrument

The firmware version reported should match the version number of downloadable fw files from AlazarTech. But note that the firmware version has often been found to be incorrect for several firmware versions. At the time of writing it is known to be correct for the 9360 (v 21.07) and 9373 (v 30.04) but incorrect for several earlier versions. In Alazar DSO this is reported as FPGA Version.

Returns

Dictionary containing
  • ’firmware’: as string

  • ’model’: as string

  • ’serial’: board serial number

  • ’vendor’: ‘AlazarTech’

  • ’CPLD_version’: version of the CPLD

  • ’driver_version’: version of the driver dll

  • ’SDK_version’: version of the SDK

  • ’latest_cal_date’: date of the latest calibration (as string)

  • ’memory_size’: size of the memory in samples

  • ’asopc_type’: type of asopc (as decimal number)

  • ’pcie_link_speed’: the speed of a single pcie link (in GB/s)

  • ’pcie_link_width’: number of pcie links

  • ’bits_per_sample’: number of bits per one sample

  • ’max_samples’: board memory size in samples

static get_num_channels(byte_rep: int) int

Return the number of channels for a specific channel mask

Each single channel is represented by a bitarray with one non zero entry i.e. powers of two. All multichannel masks can be constructed by summing the single channel ones. However, not all configurations are supported. See table 4 Input Channel Configurations on page 241 of the Alazar SDK manual. This contains the complete mapping for all current Alazar cards. It’s left to the driver to ensure that only the ones supported for a specific card can be selected

get_sample_rate(include_decimation: bool = True) float

Obtain the effective sampling rate of the acquisition based on clock speed and decimation

Returns

the number of samples (per channel) per second

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

Get all currently defined instances of this instrument class.

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

Returns

A list of instances.

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

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

Parameters

instr_instance – Instance of an Instrument class or its subclass.

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

Load metadata into this classes metadata dictionary.

Parameters

metadata – Metadata to load.

property name: str

Name of the instrument

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

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

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

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

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

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

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

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

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

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

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

Parameters

instance – Instance to record.

Raises

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

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

Remove a particular instance from the record.

Parameters

instance – The instance to remove

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

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

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

  • value – The new value to set.

shared_kwargs = ()
property short_name: str

Short name of the instrument

signal_to_volt(channel: int, signal: float) float

convert a value from a buffer to an actual value in volts based on the ranges of the channel

Parameters
  • channel – number of the channel where the signal value came from

  • signal – the value that needs to be converted

Returns

the corresponding value in volts

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

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

Parameters

update – Passed to snapshot_base.

Returns

Base snapshot.

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

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

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

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

Returns

base snapshot

Return type

dict

sync_settings_to_card() None

Syncs all parameters to Alazar card

syncing() Iterator[None]

Context manager for syncing settings to Alazar card. It will automatically call sync_settings_to_card at the end of the context.

Example

This is intended to be used around multiple parameter sets to ensure syncing is done exactly once:

with alazar.syncing():
     alazar.trigger_source1('EXTERNAL')
     alazar.trigger_level1(100)
validate_status(verbose: bool = False) None

Validate the values of all gettable parameters

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

Parameters

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

write(cmd: str) None

Write a command string with NO response to the hardware.

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

Parameters

cmd – The string to send to the instrument.

Raises

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

write_raw(cmd: str) None

Low level method to write a command string to the hardware.

Subclasses that define a new hardware communication should override this method. Subclasses that transform cmd should instead override write.

Parameters

cmd – The string to send to the instrument.

api: qcodes.instrument_drivers.AlazarTech.ats_api.AlazarATSAPI = api or AlazarATSAPI(dll_path or self.dll_path)
buffer_list: List['Buffer'] = []
parameters: Dict[str, _BaseParameter] = {}

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

functions: Dict[str, Function] = {}

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

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

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

log: InstrumentLoggerAdapter = get_instrument_logger(self, __name__)

qcodes.instrument_drivers.AlazarTech.ATS9373 module

class qcodes.instrument_drivers.AlazarTech.ATS9373.AlazarTech_ATS9373(name: str, dll_path: str = 'C:\\WINDOWS\\System32\\ATSApi.dll', **kwargs: Any)[source]

Bases: qcodes.instrument_drivers.AlazarTech.ATS.AlazarTech_ATS

This class is the driver for the ATS9373 board.

Note that this board is very similar to ATS9360. Refer to ATS SDK for details.

Note that channels of this board have 12-bit resolution (see IDN()[‘bits_per_sample’]) which means that the raw data that is returned by the card should be converted to uint16 type with a bit shift by 4 bits. Refer to ATS SDK for more infromation.

samples_divisor = 128
__del__() None

Close the instrument and remove its instance record.

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

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

__getstate__() None

Prevent pickling instruments, and give a nice error message.

__repr__() str

Simplified repr giving just the class and name.

acquire(mode: Optional[str] = None, samples_per_record: Optional[int] = None, records_per_buffer: Optional[int] = None, buffers_per_acquisition: Optional[int] = None, channel_selection: Optional[str] = None, transfer_offset: Optional[int] = None, external_startcapture: Optional[str] = None, enable_record_headers: Optional[str] = None, alloc_buffers: Optional[str] = None, fifo_only_streaming: Optional[str] = None, interleave_samples: Optional[str] = None, get_processed_data: Optional[str] = None, allocated_buffers: Optional[int] = None, buffer_timeout: Optional[int] = None, acquisition_controller: Optional[qcodes.instrument_drivers.AlazarTech.ATS.AcquisitionController[Any]] = None) qcodes.instrument_drivers.AlazarTech.ATS.OutputType

perform a single acquisition with the Alazar board, and set certain parameters to the appropriate values for the parameters, see the ATS-SDK programmer’s guide

Parameters
  • mode

  • samples_per_record

  • records_per_buffer

  • buffers_per_acquisition

  • channel_selection

  • transfer_offset

  • external_startcapture

  • enable_record_headers

  • alloc_buffers

  • fifo_only_streaming

  • interleave_samples

  • get_processed_data

  • allocated_buffers

  • buffer_timeout

  • acquisition_controller – An instance of an acquisition controller that handles the dataflow of an acquisition

Returns

Whatever is given by acquisition_controller.post_acquire method

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

Bind one Function to this instrument.

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

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

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

  • **kwargs – constructor kwargs for Function

Raises

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

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

Bind one Parameter to this instrument.

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

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

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

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

  • **kwargs – Constructor arguments for parameter_class.

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

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

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

Bind one submodule to this instrument.

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

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

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

  • submodule – The submodule to be stored.

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

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

allocate_and_post_buffer(sample_type: Union[Type[ctypes.c_ubyte], Type[ctypes.c_ushort], Type[ctypes.c_uint], Type[ctypes.c_int], Type[ctypes.c_float]], n_bytes: int) qcodes.instrument_drivers.AlazarTech.ATS.Buffer
property ancestors: List[qcodes.instrument.base.InstrumentBase]

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

ask(cmd: str) str

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

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

Parameters

cmd – The string to send to the instrument.

Returns

response

Raises

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

ask_raw(cmd: str) str

Low level method to write to the hardware and return a response.

Subclasses that define a new hardware communication should override this method. Subclasses that transform cmd should instead override ask.

Parameters

cmd – The string to send to the instrument.

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

Shortcut for calling a function from its name.

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

  • *args – any arguments to the function.

Returns

The return value of the function.

channels = 2
clear_buffers() None

This method uncommits all buffers that were committed by the driver. This method only has to be called when the acquistion crashes, otherwise the driver will uncommit the buffers itself

Returns

None

close() None

Irreversibly stop this instrument and free its resources.

Subclasses should override this if they have other specific resources to close.

classmethod close_all() None

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

Examples

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

Print a standard message on initial connection to an instrument.

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

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

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

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

delegate_attr_objects: List[str] = []

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

dll_path = 'C:\\WINDOWS\\System32\\ATSApi'
static exist(name: str, instrument_class: Optional[type] = None) bool

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

Parameters
  • name – Name of the instrument.

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

classmethod find_boards(dll_path: Optional[str] = None) List[Dict[str, Any]]

Find connected Alazar boards

Parameters

dll_path – path to the Alazar API DLL library

Returns

list of board info dictionaries for each connected board

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

Find an existing instrument by name.

Parameters
  • name – Name of the instrument.

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

Returns

The instrument found.

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

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

property full_name: str
get(param_name: str) Any

Shortcut for getting a parameter from its name.

Parameters

param_name – The name of a parameter of this instrument.

Returns

The current value of the parameter.

classmethod get_board_info(api: qcodes.instrument_drivers.AlazarTech.ats_api.AlazarATSAPI, system_id: int, board_id: int) Dict[str, Union[str, int]]

Get the information from a connected Alazar board

Parameters
  • api – An AlazarATSAPI that wraps around the CTypes CDLL

  • system_id – id of the Alazar system

  • board_id – id of the board within the alazar system

Returns

Dictionary containing

  • system_id

  • board_id

  • board_kind (as string)

  • max_samples

  • bits_per_sample

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

This methods gets the most relevant information of this instrument

The firmware version reported should match the version number of downloadable fw files from AlazarTech. But note that the firmware version has often been found to be incorrect for several firmware versions. At the time of writing it is known to be correct for the 9360 (v 21.07) and 9373 (v 30.04) but incorrect for several earlier versions. In Alazar DSO this is reported as FPGA Version.

Returns

Dictionary containing
  • ’firmware’: as string

  • ’model’: as string

  • ’serial’: board serial number

  • ’vendor’: ‘AlazarTech’

  • ’CPLD_version’: version of the CPLD

  • ’driver_version’: version of the driver dll

  • ’SDK_version’: version of the SDK

  • ’latest_cal_date’: date of the latest calibration (as string)

  • ’memory_size’: size of the memory in samples

  • ’asopc_type’: type of asopc (as decimal number)

  • ’pcie_link_speed’: the speed of a single pcie link (in GB/s)

  • ’pcie_link_width’: number of pcie links

  • ’bits_per_sample’: number of bits per one sample

  • ’max_samples’: board memory size in samples

static get_num_channels(byte_rep: int) int

Return the number of channels for a specific channel mask

Each single channel is represented by a bitarray with one non zero entry i.e. powers of two. All multichannel masks can be constructed by summing the single channel ones. However, not all configurations are supported. See table 4 Input Channel Configurations on page 241 of the Alazar SDK manual. This contains the complete mapping for all current Alazar cards. It’s left to the driver to ensure that only the ones supported for a specific card can be selected

get_sample_rate(include_decimation: bool = True) float

Obtain the effective sampling rate of the acquisition based on clock speed and decimation

Returns

the number of samples (per channel) per second

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

Get all currently defined instances of this instrument class.

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

Returns

A list of instances.

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

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

Parameters

instr_instance – Instance of an Instrument class or its subclass.

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

Load metadata into this classes metadata dictionary.

Parameters

metadata – Metadata to load.

property name: str

Name of the instrument

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

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

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

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

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

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

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

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

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

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

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

Parameters

instance – Instance to record.

Raises

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

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

Remove a particular instance from the record.

Parameters

instance – The instance to remove

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

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

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

  • value – The new value to set.

shared_kwargs = ()
property short_name: str

Short name of the instrument

signal_to_volt(channel: int, signal: float) float

convert a value from a buffer to an actual value in volts based on the ranges of the channel

Parameters
  • channel – number of the channel where the signal value came from

  • signal – the value that needs to be converted

Returns

the corresponding value in volts

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

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

Parameters

update – Passed to snapshot_base.

Returns

Base snapshot.

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

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

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

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

Returns

base snapshot

Return type

dict

sync_settings_to_card() None

Syncs all parameters to Alazar card

syncing() Iterator[None]

Context manager for syncing settings to Alazar card. It will automatically call sync_settings_to_card at the end of the context.

Example

This is intended to be used around multiple parameter sets to ensure syncing is done exactly once:

with alazar.syncing():
     alazar.trigger_source1('EXTERNAL')
     alazar.trigger_level1(100)
validate_status(verbose: bool = False) None

Validate the values of all gettable parameters

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

Parameters

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

write(cmd: str) None

Write a command string with NO response to the hardware.

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

Parameters

cmd – The string to send to the instrument.

Raises

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

write_raw(cmd: str) None

Low level method to write a command string to the hardware.

Subclasses that define a new hardware communication should override this method. Subclasses that transform cmd should instead override write.

Parameters

cmd – The string to send to the instrument.

api: qcodes.instrument_drivers.AlazarTech.ats_api.AlazarATSAPI = api or AlazarATSAPI(dll_path or self.dll_path)
buffer_list: List['Buffer'] = []
parameters: Dict[str, _BaseParameter] = {}

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

functions: Dict[str, Function] = {}

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

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

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

log: InstrumentLoggerAdapter = get_instrument_logger(self, __name__)

qcodes.instrument_drivers.AlazarTech.ATS9440 module

class qcodes.instrument_drivers.AlazarTech.ATS9440.AlazarTech_ATS9440(name: str, dll_path: str = 'C:\\WINDOWS\\System32\\ATSApi.dll', **kwargs: Any)[source]

Bases: qcodes.instrument_drivers.AlazarTech.ATS.AlazarTech_ATS

This class is the driver for the ATS9440 board it inherits from the ATS base class

samples_divisor = 32
channels = 4
__del__() None

Close the instrument and remove its instance record.

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

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

__getstate__() None

Prevent pickling instruments, and give a nice error message.

__repr__() str

Simplified repr giving just the class and name.

acquire(mode: Optional[str] = None, samples_per_record: Optional[int] = None, records_per_buffer: Optional[int] = None, buffers_per_acquisition: Optional[int] = None, channel_selection: Optional[str] = None, transfer_offset: Optional[int] = None, external_startcapture: Optional[str] = None, enable_record_headers: Optional[str] = None, alloc_buffers: Optional[str] = None, fifo_only_streaming: Optional[str] = None, interleave_samples: Optional[str] = None, get_processed_data: Optional[str] = None, allocated_buffers: Optional[int] = None, buffer_timeout: Optional[int] = None, acquisition_controller: Optional[qcodes.instrument_drivers.AlazarTech.ATS.AcquisitionController[Any]] = None) qcodes.instrument_drivers.AlazarTech.ATS.OutputType

perform a single acquisition with the Alazar board, and set certain parameters to the appropriate values for the parameters, see the ATS-SDK programmer’s guide

Parameters
  • mode

  • samples_per_record

  • records_per_buffer

  • buffers_per_acquisition

  • channel_selection

  • transfer_offset

  • external_startcapture

  • enable_record_headers

  • alloc_buffers

  • fifo_only_streaming

  • interleave_samples

  • get_processed_data

  • allocated_buffers

  • buffer_timeout

  • acquisition_controller – An instance of an acquisition controller that handles the dataflow of an acquisition

Returns

Whatever is given by acquisition_controller.post_acquire method

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

Bind one Function to this instrument.

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

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

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

  • **kwargs – constructor kwargs for Function

Raises

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

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

Bind one Parameter to this instrument.

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

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

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

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

  • **kwargs – Constructor arguments for parameter_class.

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

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

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

Bind one submodule to this instrument.

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

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

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

  • submodule – The submodule to be stored.

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

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

allocate_and_post_buffer(sample_type: Union[Type[ctypes.c_ubyte], Type[ctypes.c_ushort], Type[ctypes.c_uint], Type[ctypes.c_int], Type[ctypes.c_float]], n_bytes: int) qcodes.instrument_drivers.AlazarTech.ATS.Buffer
property ancestors: List[qcodes.instrument.base.InstrumentBase]

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

ask(cmd: str) str

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

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

Parameters

cmd – The string to send to the instrument.

Returns

response

Raises

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

ask_raw(cmd: str) str

Low level method to write to the hardware and return a response.

Subclasses that define a new hardware communication should override this method. Subclasses that transform cmd should instead override ask.

Parameters

cmd – The string to send to the instrument.

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

Shortcut for calling a function from its name.

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

  • *args – any arguments to the function.

Returns

The return value of the function.

clear_buffers() None

This method uncommits all buffers that were committed by the driver. This method only has to be called when the acquistion crashes, otherwise the driver will uncommit the buffers itself

Returns

None

close() None

Irreversibly stop this instrument and free its resources.

Subclasses should override this if they have other specific resources to close.

classmethod close_all() None

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

Examples

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

Print a standard message on initial connection to an instrument.

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

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

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

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

delegate_attr_objects: List[str] = []

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

dll_path = 'C:\\WINDOWS\\System32\\ATSApi'
static exist(name: str, instrument_class: Optional[type] = None) bool

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

Parameters
  • name – Name of the instrument.

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

classmethod find_boards(dll_path: Optional[str] = None) List[Dict[str, Any]]

Find connected Alazar boards

Parameters

dll_path – path to the Alazar API DLL library

Returns

list of board info dictionaries for each connected board

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

Find an existing instrument by name.

Parameters
  • name – Name of the instrument.

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

Returns

The instrument found.

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

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

property full_name: str
get(param_name: str) Any

Shortcut for getting a parameter from its name.

Parameters

param_name – The name of a parameter of this instrument.

Returns

The current value of the parameter.

classmethod get_board_info(api: qcodes.instrument_drivers.AlazarTech.ats_api.AlazarATSAPI, system_id: int, board_id: int) Dict[str, Union[str, int]]

Get the information from a connected Alazar board

Parameters
  • api – An AlazarATSAPI that wraps around the CTypes CDLL

  • system_id – id of the Alazar system

  • board_id – id of the board within the alazar system

Returns

Dictionary containing

  • system_id

  • board_id

  • board_kind (as string)

  • max_samples

  • bits_per_sample

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

This methods gets the most relevant information of this instrument

The firmware version reported should match the version number of downloadable fw files from AlazarTech. But note that the firmware version has often been found to be incorrect for several firmware versions. At the time of writing it is known to be correct for the 9360 (v 21.07) and 9373 (v 30.04) but incorrect for several earlier versions. In Alazar DSO this is reported as FPGA Version.

Returns

Dictionary containing
  • ’firmware’: as string

  • ’model’: as string

  • ’serial’: board serial number

  • ’vendor’: ‘AlazarTech’

  • ’CPLD_version’: version of the CPLD

  • ’driver_version’: version of the driver dll

  • ’SDK_version’: version of the SDK

  • ’latest_cal_date’: date of the latest calibration (as string)

  • ’memory_size’: size of the memory in samples

  • ’asopc_type’: type of asopc (as decimal number)

  • ’pcie_link_speed’: the speed of a single pcie link (in GB/s)

  • ’pcie_link_width’: number of pcie links

  • ’bits_per_sample’: number of bits per one sample

  • ’max_samples’: board memory size in samples

static get_num_channels(byte_rep: int) int

Return the number of channels for a specific channel mask

Each single channel is represented by a bitarray with one non zero entry i.e. powers of two. All multichannel masks can be constructed by summing the single channel ones. However, not all configurations are supported. See table 4 Input Channel Configurations on page 241 of the Alazar SDK manual. This contains the complete mapping for all current Alazar cards. It’s left to the driver to ensure that only the ones supported for a specific card can be selected

get_sample_rate(include_decimation: bool = True) float

Obtain the effective sampling rate of the acquisition based on clock speed and decimation

Returns

the number of samples (per channel) per second

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

Get all currently defined instances of this instrument class.

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

Returns

A list of instances.

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

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

Parameters

instr_instance – Instance of an Instrument class or its subclass.

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

Load metadata into this classes metadata dictionary.

Parameters

metadata – Metadata to load.

property name: str

Name of the instrument

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

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

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

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

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

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

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

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

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

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

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

Parameters

instance – Instance to record.

Raises

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

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

Remove a particular instance from the record.

Parameters

instance – The instance to remove

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

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

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

  • value – The new value to set.

shared_kwargs = ()
property short_name: str

Short name of the instrument

signal_to_volt(channel: int, signal: float) float

convert a value from a buffer to an actual value in volts based on the ranges of the channel

Parameters
  • channel – number of the channel where the signal value came from

  • signal – the value that needs to be converted

Returns

the corresponding value in volts

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

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

Parameters

update – Passed to snapshot_base.

Returns

Base snapshot.

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

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

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

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

Returns

base snapshot

Return type

dict

sync_settings_to_card() None

Syncs all parameters to Alazar card

syncing() Iterator[None]

Context manager for syncing settings to Alazar card. It will automatically call sync_settings_to_card at the end of the context.

Example

This is intended to be used around multiple parameter sets to ensure syncing is done exactly once:

with alazar.syncing():
     alazar.trigger_source1('EXTERNAL')
     alazar.trigger_level1(100)
validate_status(verbose: bool = False) None

Validate the values of all gettable parameters

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

Parameters

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

write(cmd: str) None

Write a command string with NO response to the hardware.

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

Parameters

cmd – The string to send to the instrument.

Raises

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

write_raw(cmd: str) None

Low level method to write a command string to the hardware.

Subclasses that define a new hardware communication should override this method. Subclasses that transform cmd should instead override write.

Parameters

cmd – The string to send to the instrument.

api: qcodes.instrument_drivers.AlazarTech.ats_api.AlazarATSAPI = api or AlazarATSAPI(dll_path or self.dll_path)
buffer_list: List['Buffer'] = []
parameters: Dict[str, _BaseParameter] = {}

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

functions: Dict[str, Function] = {}

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

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

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

log: InstrumentLoggerAdapter = get_instrument_logger(self, __name__)

qcodes.instrument_drivers.AlazarTech.ATS9870 module

class qcodes.instrument_drivers.AlazarTech.ATS9870.AlazarTech_ATS9870(name: str, dll_path: str = 'C:\\WINDOWS\\System32\\ATSApi.dll', **kwargs: Any)[source]

Bases: qcodes.instrument_drivers.AlazarTech.ATS.AlazarTech_ATS

This class is the driver for the ATS9870 board it inherits from the ATS base class

It creates all necessary parameters for the Alazar card

__del__() None

Close the instrument and remove its instance record.

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

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

__getstate__() None

Prevent pickling instruments, and give a nice error message.

__repr__() str

Simplified repr giving just the class and name.

acquire(mode: Optional[str] = None, samples_per_record: Optional[int] = None, records_per_buffer: Optional[int] = None, buffers_per_acquisition: Optional[int] = None, channel_selection: Optional[str] = None, transfer_offset: Optional[int] = None, external_startcapture: Optional[str] = None, enable_record_headers: Optional[str] = None, alloc_buffers: Optional[str] = None, fifo_only_streaming: Optional[str] = None, interleave_samples: Optional[str] = None, get_processed_data: Optional[str] = None, allocated_buffers: Optional[int] = None, buffer_timeout: Optional[int] = None, acquisition_controller: Optional[qcodes.instrument_drivers.AlazarTech.ATS.AcquisitionController[Any]] = None) qcodes.instrument_drivers.AlazarTech.ATS.OutputType

perform a single acquisition with the Alazar board, and set certain parameters to the appropriate values for the parameters, see the ATS-SDK programmer’s guide

Parameters
  • mode

  • samples_per_record

  • records_per_buffer

  • buffers_per_acquisition

  • channel_selection

  • transfer_offset

  • external_startcapture

  • enable_record_headers

  • alloc_buffers

  • fifo_only_streaming

  • interleave_samples

  • get_processed_data

  • allocated_buffers

  • buffer_timeout

  • acquisition_controller – An instance of an acquisition controller that handles the dataflow of an acquisition

Returns

Whatever is given by acquisition_controller.post_acquire method

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

Bind one Function to this instrument.

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

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

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

  • **kwargs – constructor kwargs for Function

Raises

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

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

Bind one Parameter to this instrument.

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

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

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

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

  • **kwargs – Constructor arguments for parameter_class.

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

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

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

Bind one submodule to this instrument.

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

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

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

  • submodule – The submodule to be stored.

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

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

allocate_and_post_buffer(sample_type: Union[Type[ctypes.c_ubyte], Type[ctypes.c_ushort], Type[ctypes.c_uint], Type[ctypes.c_int], Type[ctypes.c_float]], n_bytes: int) qcodes.instrument_drivers.AlazarTech.ATS.Buffer
property ancestors: List[qcodes.instrument.base.InstrumentBase]

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

ask(cmd: str) str

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

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

Parameters

cmd – The string to send to the instrument.

Returns

response

Raises

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

ask_raw(cmd: str) str

Low level method to write to the hardware and return a response.

Subclasses that define a new hardware communication should override this method. Subclasses that transform cmd should instead override ask.

Parameters

cmd – The string to send to the instrument.

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

Shortcut for calling a function from its name.

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

  • *args – any arguments to the function.

Returns

The return value of the function.

channels = 2
clear_buffers() None

This method uncommits all buffers that were committed by the driver. This method only has to be called when the acquistion crashes, otherwise the driver will uncommit the buffers itself

Returns

None

close() None

Irreversibly stop this instrument and free its resources.

Subclasses should override this if they have other specific resources to close.

classmethod close_all() None

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

Examples

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

Print a standard message on initial connection to an instrument.

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

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

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

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

delegate_attr_objects: List[str] = []

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

dll_path = 'C:\\WINDOWS\\System32\\ATSApi'
static exist(name: str, instrument_class: Optional[type] = None) bool

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

Parameters
  • name – Name of the instrument.

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

classmethod find_boards(dll_path: Optional[str] = None) List[Dict[str, Any]]

Find connected Alazar boards

Parameters

dll_path – path to the Alazar API DLL library

Returns

list of board info dictionaries for each connected board

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

Find an existing instrument by name.

Parameters
  • name – Name of the instrument.

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

Returns

The instrument found.

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

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

property full_name: str
get(param_name: str) Any

Shortcut for getting a parameter from its name.

Parameters

param_name – The name of a parameter of this instrument.

Returns

The current value of the parameter.

classmethod get_board_info(api: qcodes.instrument_drivers.AlazarTech.ats_api.AlazarATSAPI, system_id: int, board_id: int) Dict[str, Union[str, int]]

Get the information from a connected Alazar board

Parameters
  • api – An AlazarATSAPI that wraps around the CTypes CDLL

  • system_id – id of the Alazar system

  • board_id – id of the board within the alazar system

Returns

Dictionary containing

  • system_id

  • board_id

  • board_kind (as string)

  • max_samples

  • bits_per_sample

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

This methods gets the most relevant information of this instrument

The firmware version reported should match the version number of downloadable fw files from AlazarTech. But note that the firmware version has often been found to be incorrect for several firmware versions. At the time of writing it is known to be correct for the 9360 (v 21.07) and 9373 (v 30.04) but incorrect for several earlier versions. In Alazar DSO this is reported as FPGA Version.

Returns

Dictionary containing
  • ’firmware’: as string

  • ’model’: as string

  • ’serial’: board serial number

  • ’vendor’: ‘AlazarTech’

  • ’CPLD_version’: version of the CPLD

  • ’driver_version’: version of the driver dll

  • ’SDK_version’: version of the SDK

  • ’latest_cal_date’: date of the latest calibration (as string)

  • ’memory_size’: size of the memory in samples

  • ’asopc_type’: type of asopc (as decimal number)

  • ’pcie_link_speed’: the speed of a single pcie link (in GB/s)

  • ’pcie_link_width’: number of pcie links

  • ’bits_per_sample’: number of bits per one sample

  • ’max_samples’: board memory size in samples

static get_num_channels(byte_rep: int) int

Return the number of channels for a specific channel mask

Each single channel is represented by a bitarray with one non zero entry i.e. powers of two. All multichannel masks can be constructed by summing the single channel ones. However, not all configurations are supported. See table 4 Input Channel Configurations on page 241 of the Alazar SDK manual. This contains the complete mapping for all current Alazar cards. It’s left to the driver to ensure that only the ones supported for a specific card can be selected

get_sample_rate(include_decimation: bool = True) float

Obtain the effective sampling rate of the acquisition based on clock speed and decimation

Returns

the number of samples (per channel) per second

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

Get all currently defined instances of this instrument class.

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

Returns

A list of instances.

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

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

Parameters

instr_instance – Instance of an Instrument class or its subclass.

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

Load metadata into this classes metadata dictionary.

Parameters

metadata – Metadata to load.

property name: str

Name of the instrument

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

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

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

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

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

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

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

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

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

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

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

Parameters

instance – Instance to record.

Raises

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

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

Remove a particular instance from the record.

Parameters

instance – The instance to remove

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

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

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

  • value – The new value to set.

shared_kwargs = ()
property short_name: str

Short name of the instrument

signal_to_volt(channel: int, signal: float) float

convert a value from a buffer to an actual value in volts based on the ranges of the channel

Parameters
  • channel – number of the channel where the signal value came from

  • signal – the value that needs to be converted

Returns

the corresponding value in volts

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

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

Parameters

update – Passed to snapshot_base.

Returns

Base snapshot.

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

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

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

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

Returns

base snapshot

Return type

dict

sync_settings_to_card() None

Syncs all parameters to Alazar card

syncing() Iterator[None]

Context manager for syncing settings to Alazar card. It will automatically call sync_settings_to_card at the end of the context.

Example

This is intended to be used around multiple parameter sets to ensure syncing is done exactly once:

with alazar.syncing():
     alazar.trigger_source1('EXTERNAL')
     alazar.trigger_level1(100)
validate_status(verbose: bool = False) None

Validate the values of all gettable parameters

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

Parameters

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

write(cmd: str) None

Write a command string with NO response to the hardware.

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

Parameters

cmd – The string to send to the instrument.

Raises

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

write_raw(cmd: str) None

Low level method to write a command string to the hardware.

Subclasses that define a new hardware communication should override this method. Subclasses that transform cmd should instead override write.

Parameters

cmd – The string to send to the instrument.

api: qcodes.instrument_drivers.AlazarTech.ats_api.AlazarATSAPI = api or AlazarATSAPI(dll_path or self.dll_path)
buffer_list: List['Buffer'] = []
parameters: Dict[str, _BaseParameter] = {}

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

functions: Dict[str, Function] = {}

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

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

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

log: InstrumentLoggerAdapter = get_instrument_logger(self, __name__)

qcodes.instrument_drivers.AlazarTech.ATS_acquisition_controllers module

class qcodes.instrument_drivers.AlazarTech.ATS_acquisition_controllers.Demodulation_AcquisitionController(name: str, alazar_name: str, demodulation_frequency: float, **kwargs: Any)[source]

Bases: qcodes.instrument_drivers.AlazarTech.ATS.AcquisitionController[float]

This class represents an example acquisition controller. End users will probably want to use something more sophisticated. It will average all buffers and then perform a fourier transform on the resulting average trace for one frequency component. The amplitude of the result of channel_a will be returned.

Parameters
  • name – name for this acquisition_conroller as an instrument

  • alazar_name – the name of the alazar instrument such that this controller can communicate with the Alazar

  • demodulation_frequency – the selected component for the fourier transform

  • **kwargs – kwargs are forwarded to the Instrument base class

  • alazar_name – The name of the alazar instrument.

update_acquisitionkwargs(**kwargs: Any) None[source]

This method must be used to update the kwargs used for the acquisition with the alazar_driver.acquire :param kwargs: :return:

do_acquisition() float[source]

this method performs an acquisition, which is the get_cmd for the acquisiion parameter of this instrument :return:

pre_start_capture() None[source]

See AcquisitionController

pre_acquire() None[source]

See AcquisitionController :return:

handle_buffer(data: numpy.ndarray, buffer_number: Optional[int] = None) None[source]

See AcquisitionController :return:

post_acquire() float[source]

See AcquisitionController :return:

fit(buf: numpy.ndarray) Tuple[float, float][source]

the DFT is implemented in this method :param buf: buffer to perform the transform on :return: return amplitude and phase of the resulted transform

__del__() None

Close the instrument and remove its instance record.

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

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

__getstate__() None

Prevent pickling instruments, and give a nice error message.

__repr__() str

Simplified repr giving just the class and name.

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

Bind one Function to this instrument.

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

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

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

  • **kwargs – constructor kwargs for Function

Raises

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

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

Bind one Parameter to this instrument.

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

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

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

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

  • **kwargs – Constructor arguments for parameter_class.

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

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

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

Bind one submodule to this instrument.

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

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

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

  • submodule – The submodule to be stored.

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

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

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

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

ask(cmd: str) str

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

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

Parameters

cmd – The string to send to the instrument.

Returns

response

Raises

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

ask_raw(cmd: str) str

Low level method to write to the hardware and return a response.

Subclasses that define a new hardware communication should override this method. Subclasses that transform cmd should instead override ask.

Parameters

cmd – The string to send to the instrument.

buffer_done_callback(buffers_completed: int) None

This method is called when a buffer is completed. It can be used if you want to implement an event that happens for each buffer. You will probably want to combine this with AUX_IN_TRIGGER_ENABLE to wait before starting capture of the next buffer.

Parameters

buffers_completed – how many buffers have been completed and copied to local memory at the time of this callback.

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.

close() None

Irreversibly stop this instrument and free its resources.

Subclasses should override this if they have other specific resources to close.

classmethod close_all() None

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

Examples

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

Print a standard message on initial connection to an instrument.

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

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

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

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

delegate_attr_objects: List[str] = []

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

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

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

Parameters
  • name – Name of the instrument.

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

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

Find an existing instrument by name.

Parameters
  • name – Name of the instrument.

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

Returns

The instrument found.

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

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

property full_name: str
get(param_name: str) Any

Shortcut for getting a parameter from its name.

Parameters

param_name – The name of a parameter of this instrument.

Returns

The current value of the parameter.

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

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

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

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

Returns

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

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

Get all currently defined instances of this instrument class.

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

Returns

A list of instances.

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

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

Parameters

instr_instance – Instance of an Instrument class or its subclass.

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

Load metadata into this classes metadata dictionary.

Parameters

metadata – Metadata to load.

property name: str

Name of the instrument

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

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

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

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

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

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

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

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

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

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

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

Parameters

instance – Instance to record.

Raises

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

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

Remove a particular instance from the record.

Parameters

instance – The instance to remove

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

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

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

  • value – The new value to set.

shared_kwargs = ()
property short_name: str

Short name of the instrument

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

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

Parameters

update – Passed to snapshot_base.

Returns

Base snapshot.

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

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

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

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

Returns

base snapshot

Return type

dict

validate_status(verbose: bool = False) None

Validate the values of all gettable parameters

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

Parameters

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

write(cmd: str) None

Write a command string with NO response to the hardware.

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

Parameters

cmd – The string to send to the instrument.

Raises

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

write_raw(cmd: str) None

Low level method to write a command string to the hardware.

Subclasses that define a new hardware communication should override this method. Subclasses that transform cmd should instead override write.

Parameters

cmd – The string to send to the instrument.

parameters: Dict[str, _BaseParameter] = {}

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

functions: Dict[str, Function] = {}

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

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

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

log: InstrumentLoggerAdapter = get_instrument_logger(self, __name__)

qcodes.instrument_drivers.AlazarTech.ats_api module

This module provides a class that encapsulates Alazar ATS API, AlazarATSAPI. The class is used to expose Alazar API functions of its C library in a python-friendly way.

class qcodes.instrument_drivers.AlazarTech.ats_api.AlazarATSAPI(dll_path: str, *args: Any, **kwargs: Any)[source]

Bases: qcodes.instrument_drivers.AlazarTech.dll_wrapper.WrappedDll

A thread-safe wrapper for the ATS API library.

The exposed ATS API functions have snake_case names, may accept python types and qcodes.instrument.parameter.Parameter s as input. The API calls are thread-safe, and are executed in a separate thread. Moreover, behind the scenes it is ensured that only single instance of this class exists per unique ATS API DLL file.

Some of the ATS API functions are also exposed with more convenient signatures. These usually have the same name but with an additional underscore at the end.

BOARD_NAMES = {0: 'ATS_NONE', 1: 'ATS850', 2: 'ATS310', 3: 'ATS330', 4: 'ATS855', 5: 'ATS315', 6: 'ATS335', 7: 'ATS460', 8: 'ATS860', 9: 'ATS660', 10: 'ATS665', 11: 'ATS9462', 12: 'ATS9434', 13: 'ATS9870', 14: 'ATS9350', 15: 'ATS9325', 16: 'ATS9440', 17: 'ATS9410', 18: 'ATS9351', 19: 'ATS9310', 20: 'ATS9461', 21: 'ATS9850', 22: 'ATS9625', 23: 'ATG6500', 24: 'ATS9626', 25: 'ATS9360', 26: 'AXI9870', 27: 'ATS9370', 28: 'ATU7825', 29: 'ATS9373', 30: 'ATS9416', 31: 'ATS9637', 32: 'ATS9120', 33: 'ATS9371', 34: 'ATS9130', 35: 'ATS9352', 36: 'ATS9453'}
signatures: Dict[str, qcodes.instrument_drivers.AlazarTech.dll_wrapper.Signature] = {'AlazarAbortAsyncRead': Signature(return_type=<function NewType.<locals>.new_type>, argument_types=[<class 'ctypes.c_void_p'>]), 'AlazarBeforeAsyncRead': Signature(return_type=<function NewType.<locals>.new_type>, argument_types=[<class 'ctypes.c_void_p'>, <class 'ctypes.c_uint'>, <class 'ctypes.c_long'>, <class 'ctypes.c_uint'>, <class 'ctypes.c_uint'>, <class 'ctypes.c_uint'>, <class 'ctypes.c_uint'>]), 'AlazarBoardsInSystemBySystemID': Signature(return_type=<class 'ctypes.c_uint'>, argument_types=[<class 'ctypes.c_uint'>]), 'AlazarBusy': Signature(return_type=<class 'ctypes.c_uint'>, argument_types=[<class 'ctypes.c_void_p'>]), 'AlazarConfigureAuxIO': Signature(return_type=<function NewType.<locals>.new_type>, argument_types=[<class 'ctypes.c_void_p'>, <class 'ctypes.c_uint'>, <class 'ctypes.c_uint'>]), 'AlazarConfigureRecordAverage': Signature(return_type=<function NewType.<locals>.new_type>, argument_types=[<class 'ctypes.c_void_p'>, <class 'ctypes.c_uint'>, <class 'ctypes.c_uint'>, <class 'ctypes.c_uint'>, <class 'ctypes.c_uint'>]), 'AlazarErrorToText': Signature(return_type=<class 'ctypes.c_char_p'>, argument_types=[<class 'ctypes.c_uint'>]), 'AlazarForceTrigger': Signature(return_type=<function NewType.<locals>.new_type>, argument_types=[<class 'ctypes.c_void_p'>]), 'AlazarForceTriggerEnable': Signature(return_type=<function NewType.<locals>.new_type>, argument_types=[<class 'ctypes.c_void_p'>]), 'AlazarFreeBufferU16': Signature(return_type=<function NewType.<locals>.new_type>, argument_types=[<class 'ctypes.c_void_p'>, <class 'qcodes.instrument_drivers.AlazarTech.ats_api.LP_c_ushort'>]), 'AlazarFreeBufferU8': Signature(return_type=<function NewType.<locals>.new_type>, argument_types=[<class 'ctypes.c_void_p'>, <class 'qcodes.instrument_drivers.AlazarTech.ats_api.LP_c_ubyte'>]), 'AlazarGetBoardBySystemID': Signature(return_type=<class 'ctypes.c_void_p'>, argument_types=[<class 'ctypes.c_uint'>, <class 'ctypes.c_uint'>]), 'AlazarGetBoardKind': Signature(return_type=<class 'ctypes.c_uint'>, argument_types=[<class 'ctypes.c_void_p'>]), 'AlazarGetCPLDVersion': Signature(return_type=<function NewType.<locals>.new_type>, argument_types=[<class 'ctypes.c_void_p'>, <class 'qcodes.instrument_drivers.AlazarTech.ats_api.LP_c_ubyte'>, <class 'qcodes.instrument_drivers.AlazarTech.ats_api.LP_c_ubyte'>]), 'AlazarGetChannelInfo': Signature(return_type=<function NewType.<locals>.new_type>, argument_types=[<class 'ctypes.c_void_p'>, <class 'qcodes.instrument_drivers.AlazarTech.ats_api.LP_c_uint'>, <class 'qcodes.instrument_drivers.AlazarTech.ats_api.LP_c_ubyte'>]), 'AlazarGetDriverVersion': Signature(return_type=<function NewType.<locals>.new_type>, argument_types=[<class 'qcodes.instrument_drivers.AlazarTech.ats_api.LP_c_ubyte'>, <class 'qcodes.instrument_drivers.AlazarTech.ats_api.LP_c_ubyte'>, <class 'qcodes.instrument_drivers.AlazarTech.ats_api.LP_c_ubyte'>]), 'AlazarGetParameter': Signature(return_type=<function NewType.<locals>.new_type>, argument_types=[<class 'ctypes.c_void_p'>, <class 'ctypes.c_ubyte'>, <class 'ctypes.c_uint'>, <class 'qcodes.instrument_drivers.AlazarTech.ats_api.LP_c_long'>]), 'AlazarGetSDKVersion': Signature(return_type=<function NewType.<locals>.new_type>, argument_types=[<class 'qcodes.instrument_drivers.AlazarTech.ats_api.LP_c_ubyte'>, <class 'qcodes.instrument_drivers.AlazarTech.ats_api.LP_c_ubyte'>, <class 'qcodes.instrument_drivers.AlazarTech.ats_api.LP_c_ubyte'>]), 'AlazarInputControl': Signature(return_type=<function NewType.<locals>.new_type>, argument_types=[<class 'ctypes.c_void_p'>, <class 'ctypes.c_ubyte'>, <class 'ctypes.c_uint'>, <class 'ctypes.c_uint'>, <class 'ctypes.c_uint'>]), 'AlazarNumOfSystems': Signature(return_type=<class 'ctypes.c_uint'>, argument_types=()), 'AlazarPostAsyncBuffer': Signature(return_type=<function NewType.<locals>.new_type>, argument_types=[<class 'ctypes.c_void_p'>, <class 'ctypes.c_void_p'>, <class 'ctypes.c_uint'>]), 'AlazarQueryCapability': Signature(return_type=<function NewType.<locals>.new_type>, argument_types=[<class 'ctypes.c_void_p'>, <class 'ctypes.c_uint'>, <class 'ctypes.c_uint'>, <class 'qcodes.instrument_drivers.AlazarTech.ats_api.LP_c_uint'>]), 'AlazarReadRegister': Signature(return_type=<function NewType.<locals>.new_type>, argument_types=[<class 'ctypes.c_void_p'>, <class 'ctypes.c_uint'>, <class 'qcodes.instrument_drivers.AlazarTech.ats_api.LP_c_uint'>, <class 'ctypes.c_uint'>]), 'AlazarSetBWLimit': Signature(return_type=<function NewType.<locals>.new_type>, argument_types=[<class 'ctypes.c_void_p'>, <class 'ctypes.c_uint'>, <class 'ctypes.c_uint'>]), 'AlazarSetCaptureClock': Signature(return_type=<function NewType.<locals>.new_type>, argument_types=[<class 'ctypes.c_void_p'>, <class 'ctypes.c_uint'>, <class 'ctypes.c_uint'>, <class 'ctypes.c_uint'>, <class 'ctypes.c_uint'>]), 'AlazarSetExternalTrigger': Signature(return_type=<function NewType.<locals>.new_type>, argument_types=[<class 'ctypes.c_void_p'>, <class 'ctypes.c_uint'>, <class 'ctypes.c_uint'>]), 'AlazarSetLED': Signature(return_type=<function NewType.<locals>.new_type>, argument_types=[<class 'ctypes.c_void_p'>, <class 'ctypes.c_uint'>]), 'AlazarSetParameter': Signature(return_type=<function NewType.<locals>.new_type>, argument_types=[<class 'ctypes.c_void_p'>, <class 'ctypes.c_ubyte'>, <class 'ctypes.c_uint'>, <class 'ctypes.c_long'>]), 'AlazarSetRecordSize': Signature(return_type=<function NewType.<locals>.new_type>, argument_types=[<class 'ctypes.c_void_p'>, <class 'ctypes.c_uint'>, <class 'ctypes.c_uint'>]), 'AlazarSetTriggerDelay': Signature(return_type=<function NewType.<locals>.new_type>, argument_types=[<class 'ctypes.c_void_p'>, <class 'ctypes.c_uint'>]), 'AlazarSetTriggerOperation': Signature(return_type=<function NewType.<locals>.new_type>, argument_types=[<class 'ctypes.c_void_p'>, <class 'ctypes.c_uint'>, <class 'ctypes.c_uint'>, <class 'ctypes.c_uint'>, <class 'ctypes.c_uint'>, <class 'ctypes.c_uint'>, <class 'ctypes.c_uint'>, <class 'ctypes.c_uint'>, <class 'ctypes.c_uint'>, <class 'ctypes.c_uint'>]), 'AlazarSetTriggerTimeOut': Signature(return_type=<function NewType.<locals>.new_type>, argument_types=[<class 'ctypes.c_void_p'>, <class 'ctypes.c_uint'>]), 'AlazarStartCapture': Signature(return_type=<function NewType.<locals>.new_type>, argument_types=[<class 'ctypes.c_void_p'>]), 'AlazarTriggered': Signature(return_type=<class 'ctypes.c_uint'>, argument_types=[<class 'ctypes.c_void_p'>]), 'AlazarWaitAsyncBufferComplete': Signature(return_type=<function NewType.<locals>.new_type>, argument_types=[<class 'ctypes.c_void_p'>, <class 'ctypes.c_void_p'>, <class 'ctypes.c_uint'>]), 'AlazarWriteRegister': Signature(return_type=<function NewType.<locals>.new_type>, argument_types=[<class 'ctypes.c_void_p'>, <class 'ctypes.c_uint'>, <class 'ctypes.c_uint'>, <class 'ctypes.c_uint'>])}

Signatures for loaded DLL functions; It is to be filled with Signature instances for the DLL functions of interest in a subclass.

set_trigger_time_out(handle: int, timeout_ticks: Union[int, qcodes.instrument.parameter._BaseParameter]) ReturnCode[source]
get_board_kind(handle: int) int[source]
get_channel_info(handle: int, memory_size_in_samples: Any, bits_per_sample: Any) ReturnCode[source]
get_cpld_version(handle: int, major: Any, minor: Any) ReturnCode[source]
get_driver_version(major: Any, minor: Any, revision: Any) ReturnCode[source]
get_sdk_version(major: Any, minor: Any, revision: Any) ReturnCode[source]
query_capability(handle: int, capability: int, reserved: int, value: Any) ReturnCode[source]
read_register(handle: int, offset: int, output: Any, password: int) ReturnCode[source]
write_register(handle: int, offset: int, value: int, password: int) ReturnCode[source]
num_of_systems() int[source]
boards_in_system_by_system_id(system_id: int) int[source]
get_board_by_system_id(system_id: int, board_id: int) int[source]
get_parameter(handle: int, channel: int, parameter: int, ret_value: Any) ReturnCode[source]
set_parameter(handle: int, channel: int, parameter: int, value: int) ReturnCode[source]
set_capture_clock(handle: int, source_id: Union[int, qcodes.instrument.parameter._BaseParameter], sample_rate_id_or_value: Union[int, qcodes.instrument.parameter._BaseParameter], edge_id: Union[int, qcodes.instrument.parameter._BaseParameter], decimation: Union[int, qcodes.instrument.parameter._BaseParameter]) ReturnCode[source]
input_control(handle: int, channel_id: Union[int, qcodes.instrument.parameter._BaseParameter], coupling_id: Union[int, qcodes.instrument.parameter._BaseParameter], range_id: Union[int, qcodes.instrument.parameter._BaseParameter], impedance_id: Union[int, qcodes.instrument.parameter._BaseParameter]) ReturnCode[source]
set_bw_limit(handle: int, channel_id: Union[int, qcodes.instrument.parameter._BaseParameter], flag: Union[int, qcodes.instrument.parameter._BaseParameter]) ReturnCode[source]
set_trigger_operation(handle: int, trigger_operation: Union[int, qcodes.instrument.parameter._BaseParameter], trigger_engine_id_1: Union[int, qcodes.instrument.parameter._BaseParameter], source_id_1: Union[int, qcodes.instrument.parameter._BaseParameter], slope_id_1: Union[int, qcodes.instrument.parameter._BaseParameter], level_1: Union[int, qcodes.instrument.parameter._BaseParameter], trigger_engine_id_2: Union[int, qcodes.instrument.parameter._BaseParameter], source_id_2: Union[int, qcodes.instrument.parameter._BaseParameter], slope_id_2: Union[int, qcodes.instrument.parameter._BaseParameter], level_2: Union[int, qcodes.instrument.parameter._BaseParameter]) ReturnCode[source]
set_external_trigger(handle: int, coupling_id: Union[int, qcodes.instrument.parameter._BaseParameter], range_id: Union[int, qcodes.instrument.parameter._BaseParameter]) ReturnCode[source]
set_trigger_delay(handle: int, value: Union[int, qcodes.instrument.parameter._BaseParameter]) ReturnCode[source]
configure_aux_io(handle: int, mode_id: Union[int, qcodes.instrument.parameter._BaseParameter], mode_parameter_value: Union[int, qcodes.instrument.parameter._BaseParameter]) ReturnCode[source]
set_record_size(handle: int, pre_trigger_samples: Union[int, qcodes.instrument.parameter._BaseParameter], post_trigger_samples: Union[int, qcodes.instrument.parameter._BaseParameter]) ReturnCode[source]
before_async_read(handle: int, channel_select: int, transfer_offset: int, samples_per_record: int, records_per_buffer: int, records_per_acquisition: int, flags: int) ReturnCode[source]
post_async_buffer(handle: int, buffer: ctypes.c_void_p, buffer_length: int) ReturnCode[source]
wait_async_buffer_complete(handle: int, buffer: ctypes.c_void_p, timeout_in_ms: int) ReturnCode[source]
start_capture(handle: int) ReturnCode[source]
abort_async_read(handle: int) ReturnCode[source]
error_to_text(return_code: ReturnCode) str[source]
force_trigger(handle: int) ReturnCode[source]
force_trigger_enable(handle: int) ReturnCode[source]
busy(handle: int) int[source]
configure_record_average(handle: int, mode: int, samples_per_record: int, records_per_average: int, options: int) ReturnCode[source]
free_buffer_u16(handle: int, buffer: Any) ReturnCode[source]
free_buffer_u8(handle: int, buffer: Any) ReturnCode[source]
set_led(handle: int, led_on: bool) ReturnCode[source]
triggered(handle: int) int[source]
get_board_model(handle: int) str[source]
get_channel_info_(handle: int) Tuple[int, int][source]

A more convenient version of get_channel_info() method (AlazarGetChannelInfo).

This method hides the fact that the output values in the original function are written to the provided pointers.

Parameters

handle – Handle of the board of interest

Returns

Tuple of bits per sample and maximum board memory in samples

get_cpld_version_(handle: int) str[source]

A more convenient version of get_cpld_version() method (AlazarGetCPLDVersion).

This method hides the fact that the output values in the original function are written to the provided pointers.

Parameters

handle – Handle of the board of interest

Returns

Version string in the format “<major>.<minor>”

get_driver_version_() str[source]

A more convenient version of get_driver_version() method (AlazarGetDriverVersion).

This method hides the fact that the output values in the original function are written to the provided pointers.

Returns

Version string in the format “<major>.<minor>.<revision>”

get_sdk_version_() str[source]

A more convenient version of get_sdk_version() method (AlazarGetSDKVersion).

This method hides the fact that the output values in the original function are written to the provided pointers.

Returns

Version string in the format “<major>.<minor>.<revision>”

query_capability_(handle: int, capability: int) int[source]

A more convenient version of query_capability() method (AlazarQueryCapability).

This method hides the fact that the output values in the original function are written to the provided pointers.

Parameters
  • handle – Handle of the board of interest

  • capability – An integer identifier of a capability parameter (constants.Capability enumeration encapsulates the available identifiers)

Returns

Value of the requested capability

read_register_(handle: int, offset: int) int[source]

Read a value from a given offset in the Alazar card’s register.

A more convenient version of read_register() method (AlazarReadRegister).

Parameters
  • handle – Handle of the board of interest

  • offset – Offset into the memory to read from

Returns

The value read as an integer

write_register_(handle: int, offset: int, value: int) None[source]

Write a value to a given offset in the Alazar card’s register.

A more convenient version of write_register() method (AlazarWriteRegister).

Parameters
  • handle – Handle of the board of interest

  • offset – The offset in memory to write to

  • value – The value to write

qcodes.instrument_drivers.AlazarTech.constants module

This module defines constants that are used in Alazar ATS API.

Since the original names of the constants are mostly preserved, it is convenient to find the uesful constants here based on the Alazar SDK manual.

class qcodes.instrument_drivers.AlazarTech.constants.APITraceStates(value)[source]

Bases: enum.IntEnum

Values for API_FLAGS of Parameter Defined by ALAZAR_API_TRACE_STATES in AlazarCmd.h

API_ENABLE_TRACE = 1
API_DISABLE_TRACE = 0
class qcodes.instrument_drivers.AlazarTech.constants.AUXInputLevel(value)[source]

Bases: enum.IntEnum

Values for GET_AUX_INPUT_LEVEL of Parameter Defined by ALAZAR_AUX_INPUT_LEVELS in AlazarCmd.h

AUX_INPUT_LOW = 0
AUX_INPUT_HIGH = 1
class qcodes.instrument_drivers.AlazarTech.constants.AlazarParameter(value)[source]

Bases: enum.IntEnum

Parameters suitable to be used with `` AlazarSetParameter`` and/or AlazarGetParameter Defined by ALAZAR_PARAMETERS in AlazarCmd.h

DATA_WIDTH = 268435465
SETGET_ASYNC_BUFFSIZE_BYTES = 268435513
SETGET_ASYNC_BUFFCOUNT = 268435520
GET_ASYNC_BUFFERS_PENDING = 268435536
GET_ASYNC_BUFFERS_PENDING_FULL = 268435537
GET_ASYNC_BUFFERS_PENDING_EMPTY = 268435538
SET_DATA_FORMAT = 268435521
GET_DATA_FORMAT = 268435522
GET_SAMPLES_PER_TIMESTAMP_CLOCK = 268435524
GET_RECORDS_CAPTURED = 268435525
ECC_MODE = 268435528
GET_AUX_INPUT_LEVEL = 268435529
GET_CHANNELS_PER_BOARD = 268435568
GET_FPGA_TEMPERATURE = 268435584
PACK_MODE = 268435570
SET_SINGLE_CHANNEL_MODE = 268435523
API_FLAGS = 268435600
class qcodes.instrument_drivers.AlazarTech.constants.AutoDMAFlag(value)[source]

Bases: enum.IntFlag

An enumeration.

ADMA_TRADITIONAL_MODE = 0
ADMA_CONTINUOUS_MODE = 256
ADMA_NPT = 512
ADMA_TRIGGERED_STREAMING = 1024
ADMA_EXTERNAL_STARTCAPTURE = 1
ADMA_ENABLE_RECORD_HEADERS = 8
ADMA_FIFO_ONLY_STREAMING = 2048
ADMA_ALLOC_BUFFERS = 32
ADMA_INTERLEAVE_SAMPLES = 4096
ADMA_GET_PROCESSED_DATA = 8192
ADMA_DSP = 16384
ADMA_SINGLE_DMA_CHANNEL = 16
ADMA_ENABLE_RECORD_FOOTERS = 65536
class qcodes.instrument_drivers.AlazarTech.constants.AuxilaryIO(value)[source]

Bases: enum.IntEnum

An enumeration.

AUX_OUT_TRIGGER = 0
AUX_OUT_PACER = 2
AUX_OUT_BUSY = 4
AUX_OUT_CLOCK = 6
AUX_OUT_RESERVED = 8
AUX_OUT_CAPTURE_ALMOST_DONE = 10
AUX_OUT_AUXILIARY = 12
AUX_OUT_SERIAL_DATA = 14
AUX_OUT_TRIGGER_ENABLE = 16
AUX_IN_TRIGGER_ENABLE = 1
AUX_IN_DIGITAL_TRIGGER = 3
AUX_IN_GATE = 5
AUX_IN_CAPTURE_ON_DEMAND = 7
AUX_IN_RESET_TIMESTAMP = 9
AUX_IN_SLOW_EXTERNAL_CLOCK = 11
AUX_IN_AUXILIARY = 13
AUX_IN_SERIAL_DATA = 15
class qcodes.instrument_drivers.AlazarTech.constants.BandwidthLimit(value)[source]

Bases: enum.IntEnum

An enumeration.

DISABLE = 0
ENABLE = 1
class qcodes.instrument_drivers.AlazarTech.constants.CPFDevice(value)[source]

Bases: enum.IntEnum

An enumeration.

EP3SL50 = 1
EP3SE260 = 2
class qcodes.instrument_drivers.AlazarTech.constants.Capability(value)[source]

Bases: enum.IntEnum

Capability identifiers for AlazarATSAPI.query_capability()

GET_SERIAL_NUMBER = 268435492
GET_LATEST_CAL_DATE = 268435494
GET_LATEST_CAL_DATE_MONTH = 268435501
GET_LATEST_CAL_DATE_DAY = 268435502
GET_LATEST_CAL_DATE_YEAR = 268435503
MEMORY_SIZE = 268435498
ASOPC_TYPE = 268435500
BOARD_TYPE = 268435499
GET_MAX_PRETRIGGER_SAMPLES = 268435526
GET_CPF_DEVICE = 268435569
class qcodes.instrument_drivers.AlazarTech.constants.Channel(value)[source]

Bases: enum.IntFlag

Flags for selecting channel configuration

ALL = 0
A = 1
B = 2
C = 4
D = 8
E = 16
F = 32
G = 64
H = 128
I = 256
J = 512
K = 1024
L = 2048
M = 4096
N = 8192
O = 16384
P = 32768
class qcodes.instrument_drivers.AlazarTech.constants.ClockEdge(value)[source]

Bases: enum.IntEnum

An enumeration.

CLOCK_EDGE_RISING = 0
CLOCK_EDGE_FALLING = 1
class qcodes.instrument_drivers.AlazarTech.constants.ClockSource(value)[source]

Bases: enum.IntEnum

An enumeration.

INTERNAL_CLOCK = 1
FAST_EXTERNAL_CLOCK = 2
EXTERNAL_CLOCK = 2
MEDIUM_EXTERNAL_CLOCK = 3
SLOW_EXTERNAL_CLOCK = 4
EXTERNAL_CLOCK_AC = 5
EXTERNAL_CLOCK_DC = 6
EXTERNAL_CLOCK_10MHz_REF = 7
INTERNAL_CLOCK_10MHz_REF = 8
EXTERNAL_CLOCK_10MHz_PXI = 10
INTERNAL_CLOCK_DIV_4 = 15
INTERNAL_CLOCK_DIV_5 = 16
MASTER_CLOCK = 17
INTERNAL_CLOCK_SET_VCO = 18
class qcodes.instrument_drivers.AlazarTech.constants.Coupling(value)[source]

Bases: enum.IntEnum

An enumeration.

AC_COUPLING = 1
DC_COUPLING = 2
class qcodes.instrument_drivers.AlazarTech.constants.ECCMode(value)[source]

Bases: enum.IntEnum

Values for ECC_MODE of Parameter Defined by ALAZAR_ECC_MODES in AlazarCmd.h

ECC_DISABLE = 0
ECC_ENABLE = 1
qcodes.instrument_drivers.AlazarTech.constants.ExternalTriggerAttenuatorRelay

alias of qcodes.instrument_drivers.AlazarTech.constants.ExternalTriggerRange

class qcodes.instrument_drivers.AlazarTech.constants.ExternalTriggerCoupling(value)[source]

Bases: enum.IntEnum

An enumeration.

AC = 1
DC = 2
class qcodes.instrument_drivers.AlazarTech.constants.ExternalTriggerRange(value)[source]

Bases: enum.IntEnum

An enumeration.

ETR_DIV5 = 0
ETR_X1 = 1
ETR_5V = 0
ETR_1V = 1
ETR_TTL = 2
ETR_2V5 = 3
class qcodes.instrument_drivers.AlazarTech.constants.Impedance(value)[source]

Bases: enum.IntEnum

An enumeration.

IMPEDANCE_1M_OHM = 1
IMPEDANCE_50_OHM = 2
IMPEDANCE_75_OHM = 4
IMPEDANCE_300_OHM = 8
class qcodes.instrument_drivers.AlazarTech.constants.InputRange(value)[source]

Bases: enum.IntEnum

An enumeration.

INPUT_RANGE_PM_20_MV = 1
INPUT_RANGE_PM_40_MV = 2
INPUT_RANGE_PM_50_MV = 3
INPUT_RANGE_PM_80_MV = 4
INPUT_RANGE_PM_100_MV = 5
INPUT_RANGE_PM_200_MV = 6
INPUT_RANGE_PM_400_MV = 7
INPUT_RANGE_PM_500_MV = 8
INPUT_RANGE_PM_800_MV = 9
INPUT_RANGE_PM_1_V = 10
INPUT_RANGE_PM_2_V = 11
INPUT_RANGE_PM_4_V = 12
INPUT_RANGE_PM_5_V = 13
INPUT_RANGE_PM_8_V = 14
INPUT_RANGE_PM_10_V = 15
INPUT_RANGE_PM_20_V = 16
INPUT_RANGE_PM_40_V = 17
INPUT_RANGE_PM_16_V = 18
INPUT_RANGE_HIFI = 32
INPUT_RANGE_PM_1_V_25 = 33
INPUT_RANGE_PM_2_V_5 = 37
INPUT_RANGE_PM_125_MV = 40
INPUT_RANGE_PM_250_MV = 48
class qcodes.instrument_drivers.AlazarTech.constants.PackMode(value)[source]

Bases: enum.IntEnum

Values for PACK_MODE of Parameter Defined by ALAZAR_PACK_MODES in AlazarCmd.h

PACK_DEFAULT = 0
PACK_8_BITS_PER_SAMPLE = 1
PACK_12_BITS_PER_SAMPLE = 2
class qcodes.instrument_drivers.AlazarTech.constants.RecordAverageMode(value)[source]

Bases: enum.IntEnum

Values for mode argument of AlazarConfigureRecordAverage function

DISABLE = 0
ENABLE_FPGA_AVE = 1
class qcodes.instrument_drivers.AlazarTech.constants.RecordAverageOption(value)[source]

Bases: enum.IntEnum

Values for options argument of AlazarConfigureRecordAverage function

UNSIGNED = 0

Find sum of unsigned ADC samples codes

SIGNED = 1

Find sum of signed ADC sample

class qcodes.instrument_drivers.AlazarTech.constants.SampleRate(value)[source]

Bases: enum.IntEnum

An enumeration.

SAMPLE_RATE_USER_DEF = 64
SAMPLE_RATE_1KSPS = 1
SAMPLE_RATE_2KSPS = 2
SAMPLE_RATE_5KSPS = 4
SAMPLE_RATE_10KSPS = 8
SAMPLE_RATE_20KSPS = 10
SAMPLE_RATE_50KSPS = 12
SAMPLE_RATE_100KSPS = 14
SAMPLE_RATE_200KSPS = 16
SAMPLE_RATE_500KSPS = 18
SAMPLE_RATE_1MSPS = 20
SAMPLE_RATE_2MSPS = 24
SAMPLE_RATE_5MSPS = 26
SAMPLE_RATE_10MSPS = 28
SAMPLE_RATE_20MSPS = 30
SAMPLE_RATE_25MSPS = 33
SAMPLE_RATE_50MSPS = 34
SAMPLE_RATE_100MSPS = 36
SAMPLE_RATE_125MSPS = 37
SAMPLE_RATE_160MSPS = 38
SAMPLE_RATE_180MSPS = 39
SAMPLE_RATE_200MSPS = 40
SAMPLE_RATE_250MSPS = 43
SAMPLE_RATE_400MSPS = 45
SAMPLE_RATE_500MSPS = 48
SAMPLE_RATE_800MSPS = 50
SAMPLE_RATE_1000MSPS = 53
SAMPLE_RATE_1GSPS = 53
SAMPLE_RATE_1200MSPS = 55
SAMPLE_RATE_1500MSPS = 58
SAMPLE_RATE_1600MSPS = 59
SAMPLE_RATE_1800MSPS = 61
SAMPLE_RATE_2000MSPS = 63
SAMPLE_RATE_2GSPS = 63
SAMPLE_RATE_2400MSPS = 106
SAMPLE_RATE_3000MSPS = 117
SAMPLE_RATE_3GSPS = 117
SAMPLE_RATE_3600MSPS = 123
SAMPLE_RATE_4000MSPS = 128
SAMPLE_RATE_4GSPS = 128
class qcodes.instrument_drivers.AlazarTech.constants.TriggerEngine(value)[source]

Bases: enum.IntEnum

An enumeration.

TRIG_ENGINE_J = 0
TRIG_ENGINE_K = 1
class qcodes.instrument_drivers.AlazarTech.constants.TriggerEngineOperation(value)[source]

Bases: enum.IntEnum

An enumeration.

TRIG_ENGINE_OP_J = 0
TRIG_ENGINE_OP_K = 1
TRIG_ENGINE_OP_J_OR_K = 2
TRIG_ENGINE_OP_J_AND_K = 3
TRIG_ENGINE_OP_J_XOR_K = 4
TRIG_ENGINE_OP_J_AND_NOT_K = 5
TRIG_ENGINE_OP_NOT_J_AND_K = 6
class qcodes.instrument_drivers.AlazarTech.constants.TriggerEngineSource(value)[source]

Bases: enum.IntEnum

An enumeration.

TRIG_CHAN_A = 0
TRIG_CHAN_B = 1
TRIG_EXTERNAL = 2
TRIG_DISABLE = 3
TRIG_CHAN_C = 4
TRIG_CHAN_D = 5
TRIG_CHAN_E = 6
TRIG_CHAN_F = 7
TRIG_CHAN_G = 8
TRIG_CHAN_H = 9
TRIG_CHAN_I = 10
TRIG_CHAN_J = 11
TRIG_CHAN_K = 12
TRIG_CHAN_L = 13
TRIG_CHAN_M = 14
TRIG_CHAN_N = 15
TRIG_CHAN_O = 16
TRIG_CHAN_P = 17
TRIG_PXI_STAR = 256
class qcodes.instrument_drivers.AlazarTech.constants.TriggerSlope(value)[source]

Bases: enum.IntEnum

Used in more than one place, for example, for AUX_IN_TRIGGER_ENABLE Auxiallary IO mode

TRIGGER_SLOPE_POSITIVE = 1
TRIGGER_SLOPE_NEGATIVE = 2

qcodes.instrument_drivers.AlazarTech.dll_wrapper module

This module provides infrastructure for wrapping DLL libraries, loaded using ctypes. With this infrastructure, one just needs to subclass WrappedDll and define class methods for the functions of interest from the DLL library with mostly python types in mind, and conveniently specify their signatures in terms of ctypes types.

class qcodes.instrument_drivers.AlazarTech.dll_wrapper.DllWrapperMeta[source]

Bases: type

DLL-path-based ‘singleton’ metaclass for DLL wrapper classes

mro()

Return a type’s method resolution order.

class qcodes.instrument_drivers.AlazarTech.dll_wrapper.Signature(return_type, argument_types)[source]

Bases: tuple

Create new instance of Signature(return_type, argument_types)

property return_type

Alias for field number 0

property argument_types

Alias for field number 1

count(value, /)

Return number of occurrences of value.

index(value, start=0, stop=9223372036854775807, /)

Return first index of value.

Raises ValueError if the value is not present.

class qcodes.instrument_drivers.AlazarTech.dll_wrapper.WrappedDll(dll_path: str, *args: Any, **kwargs: Any)[source]

Bases: object

A base class for wrapping DLL libraries.

Note that this class is still quite specific to Alazar ATS DLL library.

This class uses dictionary of the signatures attribute in order to assign argtypes and restype attributes for functions of a loaded DLL library (from the _dll attribute of the class). If restype is of type RETURN_CODE, then an exception is raised in case the return code is an Alazar error code. For string-alike restype s, the returned value is converted to a python string.

Functions are executed in a single separate thread (see what the _executor gets initialize to), hence the class also has a lock instance in the _lock attribute that is used to wrap around the actual calls to the DLL library.

Method _sync_dll_call is supposed to be called when a subclass implements calls to functions of the loaded DLL.

Parameters

dll_path – Path to the DLL library to load and wrap

signatures: Dict[str, qcodes.instrument_drivers.AlazarTech.dll_wrapper.Signature] = {}

Signatures for loaded DLL functions; It is to be filled with Signature instances for the DLL functions of interest in a subclass.

qcodes.instrument_drivers.AlazarTech.helpers module

This module provides helper objects for Alazar driver class. The objects allow to hide realted pieces of logic into a form of “submodule” (analogious to InstrumentBase.add_submodule()) that can be included into the driver class in some way.

class qcodes.instrument_drivers.AlazarTech.helpers.CapabilityHelper(api: qcodes.instrument_drivers.AlazarTech.ats_api.AlazarATSAPI, handle: int)[source]

Bases: object

A helper class providing convenient methods for various useful ‘query capability’ (AlazarQueryCapability) calls for a given Alazar board.

Most common capabilities are enumerated in CAPABILITIES.

For frequently used capabilities, dedicated convenience query_<...>() methods are available.

Parameters
  • api – Instance of Alazar ATS API class

  • handle – Handle of a specific board (from AlazarGetBoardBySystemId)

CAPABILITIES

alias of qcodes.instrument_drivers.AlazarTech.constants.Capability

query(capability: int) int[source]

Query the given ‘capability’ of the board

query_serial() str[source]
query_latest_calibration() str[source]

Query latest calibration date in ‘12-34-56’ format

query_memory_size() int[source]

Query board memory size in samples

query_asopc_type() int[source]

Query PCIE link speed in GB/s

Query PCIE link width

query_firmware_version() str[source]

Query firmware version in “<major>.<minor>” format

The firmware version reported should match the version number of downloadable fw files from AlazarTech. But note that the firmware version has often been found to be incorrect for several firmware versions. At the time of writing it is known to be correct for the 9360 (v 21.07) and 9373 (v 30.04) but incorrect for several earlier versions. In Alazar DSO this is reported as FPGA Version.

qcodes.instrument_drivers.AlazarTech.utils module

The module provides useful utility objects for the Alazar driver class. The purpose of these is more to provide relevant functionality and less to improve the code structure (which is more the purpose of the AlazarTech.helpers module).

class qcodes.instrument_drivers.AlazarTech.utils.TraceParameter(*args: Any, **kwargs: Any)[source]

Bases: qcodes.instrument.parameter.Parameter

A parameter that keeps track of if its value has been synced to the Instrument. To achieve that, this parameter sets the _parameters_synced attribute of the Instrument to False when the value of the parameter is changed.

This parameter is useful for the Alazar card driver. Syncing parameters to an Alazar card is relatively slow, hence it makes sense to first set the values of the parameters, and then “synchronize them to the card”.

property synced_to_card: bool

True if the parameter value has been synced to the instrument

set_raw(value: Any) None[source]

set_raw is called to perform the actual setting of a parameter on the instrument. This method should either be overwritten to perform the desired operation or alternatively for Parameter a suitable method is automatically generated if set_cmd is supplied to the parameter constructor. The method is automatically wrapped to provide a set method on the parameter instance.

__getitem__(keys: Any) qcodes.instrument.sweep_values.SweepFixedValues

Slice a Parameter to get a SweepValues object to iterate over during a sweep

__str__() str

Include the instrument name with the Parameter name if possible.

property abstract: Optional[bool]
property full_name: str

Name of the parameter including the name of the instrument and submodule that the parameter may be bound to. The names are separated by underscores, like this: instrument_submodule_parameter.

get_ramp_values(value: Union[float, Sized], step: Optional[float] = None) Sequence[Union[float, Sized]]

Return values to sweep from current value to target value. This method can be overridden to have a custom sweep behaviour. It can even be overridden by a generator.

Parameters
  • value – target value

  • step – maximum step size

Returns

List of stepped values, including target value.

get_raw() Any

get_raw is called to perform the actual data acquisition from the instrument. This method should either be overwritten to perform the desired operation or alternatively for Parameter a suitable method is automatically generated if get_cmd is supplied to the parameter constructor. The method is automatically wrapped to provide a get method on the parameter instance.

property gettable: bool

Is it allowed to call get on this parameter?

increment(value: Any) None

Increment the parameter with a value

Parameters

value – Value to be added to the parameter.

property instrument: Optional[InstrumentBase]

Return the first instrument that this parameter is bound to. E.g if this is bound to a channel it will return the channel and not the instrument that the channel is bound too. Use root_instrument() to get the real instrument.

property inter_delay: float

Delay time between consecutive set operations. The actual time will not be shorter than this, but may be longer if the underlying set call takes longer.

Typically used in conjunction with step to create an effective ramp rate, but can also be used without a step to enforce a delay between sets.

Getter

Returns the current inter_delay.

Setter

Sets the value of the inter_delay.

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

Load metadata into this classes metadata dictionary.

Parameters

metadata – Metadata to load.

property name: str

Name of the parameter. This is identical to short_name().

property name_parts: List[str]

List of the parts that make up the full name of this parameter

property post_delay: float

Delay time after start of set operation, for each set. The actual time will not be shorter than this, but may be longer if the underlying set call takes longer.

Typically used in conjunction with step to create an effective ramp rate, but can also be used without a step to enforce a delay after every set. One might think of post_delay as how long a set operation is supposed to take. For example, there might be an instrument that needs extra time after setting a parameter although the command for setting the parameter returns quickly.

Getter

Returns the current post_delay.

Setter

Sets the value of the post_delay.

Raises
property raw_value: Any

Note that this property will be deprecated soon. Use cache.raw_value instead.

Represents the cached raw value of the parameter.

Getter

Returns the cached raw value of the parameter.

restore_at_exit(allow_changes: bool = True) qcodes.instrument.parameter._SetParamContext

Use a context manager to restore the value of a parameter after a with block.

By default, the parameter value may be changed inside the block, but this can be prevented with allow_changes=False. This can be useful, for example, for debugging a complex measurement that unintentionally modifies a parameter.

Example

>>> p = Parameter("p", set_cmd=None, get_cmd=None)
>>> p.set(2)
>>> with p.restore_at_exit():
...     p.set(3)
...     print(f"value inside with block: {p.get()}")  # prints 3
>>> print(f"value after with block: {p.get()}")  # prints 2
>>> with p.restore_at_exit(allow_changes=False):
...     p.set(5)  # raises an exception
property root_instrument: Optional[InstrumentBase]

Return the fundamental instrument that this parameter belongs too. E.g if the parameter is bound to a channel this will return the fundamental instrument that that channel belongs to. Use instrument() to get the channel.

set_to(value: Any, allow_changes: bool = False) qcodes.instrument.parameter._SetParamContext

Use a context manager to temporarily set a parameter to a value. By default, the parameter value cannot be changed inside the context. This may be overridden with allow_changes=True.

Examples

>>> from qcodes import Parameter
>>> p = Parameter("p", set_cmd=None, get_cmd=None)
>>> p.set(2)
>>> with p.set_to(3):
...     print(f"p value in with block {p.get()}")  # prints 3
...     p.set(5)  # raises an exception
>>> print(f"p value outside with block {p.get()}")  # prints 2
>>> with p.set_to(3, allow_changes=True):
...     p.set(5)  # now this works
>>> print(f"value after second block: {p.get()}")  # still prints 2
property settable: bool

Is it allowed to call set on this parameter?

property short_name: str

Short name of the parameter. This is without the name of the instrument or submodule that the parameter may be bound to. For full name refer to full_name().

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

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

Parameters

update – Passed to snapshot_base.

Returns

Base snapshot.

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

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

If the parameter has been initiated with snapshot_value=False, the snapshot will NOT include the value and raw_value of the parameter.

Parameters
  • update – If True, update the state by calling parameter.get() unless snapshot_get of the parameter is False. If update is None, use the current value from the cache unless the cache is invalid. If False, never call parameter.get().

  • params_to_skip_update – No effect but may be passed from superclass

Returns

base snapshot

property snapshot_value: bool

If True the value of the parameter will be included in the snapshot.

property step: Optional[float]

Stepsize that this Parameter uses during set operation. Stepsize must be a positive number or None. If step is a positive number, this is the maximum value change allowed in one hardware call, so a single set can result in many calls to the hardware if the starting value is far from the target. All but the final change will attempt to change by +/- step exactly. If step is None stepping will not be used.

Getter

Returns the current stepsize.

Setter

Sets the value of the step.

Raises
  • TypeError – if step is set to not numeric or None

  • ValueError – if step is set to negative

  • TypeError – if step is set to not integer or None for an integer parameter

  • TypeError – if step is set to not a number on None

sweep(start: float, stop: float, step: Optional[float] = None, num: Optional[int] = None) qcodes.instrument.sweep_values.SweepFixedValues

Create a collection of parameter values to be iterated over. Requires start and stop and (step or num) The sign of step is not relevant.

Parameters
  • start – The starting value of the sequence.

  • stop – The end value of the sequence.

  • step – Spacing between values.

  • num – Number of values to generate.

Returns

Collection of parameter values to be iterated over.

Return type

SweepFixedValues

Examples

>>> sweep(0, 10, num=5)
 [0.0, 2.5, 5.0, 7.5, 10.0]
>>> sweep(5, 10, step=1)
[5.0, 6.0, 7.0, 8.0, 9.0, 10.0]
>>> sweep(15, 10.5, step=1.5)
>[15.0, 13.5, 12.0, 10.5]
property underlying_instrument: Optional[InstrumentBase]

Returns an instance of the underlying hardware instrument that this parameter communicates with, per this parameter’s implementation.

This is useful in the case where a parameter does not belongs to an instrument instance that represents a real hardware instrument but actually uses a real hardware instrument in its implementation (e.g. via calls to one or more parameters of that real hardware instrument). This is also useful when a parameter does belong to an instrument instance but that instance does not represent the real hardware instrument that the parameter interacts with: hence root_instrument of the parameter cannot be the hardware_instrument, however underlying_instrument can be implemented to return the hardware_instrument.

By default it returns the root_instrument of the parameter.

validate(value: Any) None

Validate the value supplied.

Parameters

value – value to validate

Raises
  • TypeError – If the value is of the wrong type.

  • ValueError – If the value is outside the bounds specified by the validator.

label: str = ()

Label of the data used for plots etc.

unit = ()

The unit of measure. Use '' for unitless.

Module contents