KeysightXSeries

This devices covers Keysight X-series oscilloscopes. It has been explicitely tested with 1000 and 3000 series ‘scopes. Other series should be simple to implement.

README

KeysightXSeries

Directory structure

└── KeysightXSeries/
    ├── .gitignore
    ├── pyproject.toml
    ├── README.md
    ├── LICENSE.txt
    ├── CITATION.cff
    ├── docs/
    │   ├── conf.py
    │   ├── make.bat
    │   ├── Makefile
    │   └── index.rst
    └── src/naqs_devices/ # note: must be same as in the parent naqs_devices repo to be in the same namespace
        └── KeysightXSeries/
            ├── __init__.py
            ├── blacs_tabs.py
            ├── blacs_workers.py
            ├── labscript_devices.py
            └── register_classes.py

Models tested with

  • DSOX1204G

API Documentation

class naqs_devices.KeysightXSeries.labscript_devices.ScopeChannel(name, parent_device, connection)[source]

Bases: AnalogIn

This instantiates a scope channel to acquire during a buffered shot.

Parameters:
  • name (str) – Name to assign channel

  • parent_device (obj) – Handle to parent device

  • connection (str) – Which physical scope channel is acquiring. Generally of the form ‘Channel n’ where n is the channel label.

description = 'Scope Acquisition Channel Class'

Brief description of the device.

acquire()[source]

Inform BLACS to save data from this channel.

Note that the parent_device controls when the acquisition trigger is sent.

add_device(device)

Adds a child device to this device.

Parameters:

device (Device) – Device to add.

Raises:

LabscriptError – If device is not an allowed child of this device.

allowed_children = None

Defines types of devices that are allowed to be children of this device.

Type:

list

generate_code(hdf5_file)

Generate hardware instructions for device and children, then save to h5 file.

Will recursively call generate_code for all children devices.

Parameters:

hdf5_file (h5py:h5py.File) – Handle to shot file.

get_all_children()

Get all children devices for this device.

Returns:

List of children Device.

Return type:

list

get_all_outputs()

Get all children devices that are outputs.

Recursively calls get_all_outputs() on each child device. Output’s will return a list containing just themselves.

Returns:

List of children Output.

Return type:

list

get_properties(location=None)

Get all properties in location.

Parameters:

location (str, optional) – Location to get properties from. If None, return all properties.

Returns:

Dictionary of properties.

Return type:

dict

get_property(name, location=None, *args, **kwargs)

Method to get a property of this device already set using Device.set_property().

If the property is not already set, a default value will be returned if specified as the argument after ‘name’, if there is only one argument after ‘name’ and the argument is either not a keyword argurment or is a keyword argument with the name ‘default’.

Parameters:
  • name (str) – Name of property to get.

  • location (str, optional) – If not None, only search for name in location.

  • default – The default value. If not provided, an exception is raised if the value is not set.

Returns:

Property value.

Raises:

LabscriptError – If property not set and default not provided, or default conventions not followed.

Examples

Examples of acceptable signatures:

>>> get_property('example')             # 'example' will be returned if set, or an exception raised
>>> get_property('example', 7)          # 7 returned if 'example' is not set
>>> get_property('example', default=7)  # 7 returnd if 'example' is not set

Example signatures that WILL ALWAYS RAISE AN EXCEPTION:

>>> get_property('example', 7, 8)
>>> get_property('example', 7, default=9)
>>> get_property('example', default=7, x=9)
init_device_group(hdf5_file)

Creates the device group in the shot file.

Parameters:

hdf5_file (h5py:h5py.File) – File handle to create the group in.

Returns:

Created group handle.

Return type:

h5py:h5py.Group

property parent_clock_line

Stores the clocking clockline, which may be itself.

Type:

ClockLine

property pseudoclock_device

Stores the clocking pseudoclock, which may be itself.

Type:

PseudoclockDevice

quantise_to_pseudoclock(times)

Quantises times to the resolution of the controlling pseudoclock.

Parameters:

times (numpy:numpy.ndarray or list or set or float) – Time, in seconds, to quantise.

Returns:

Quantised times.

Return type:

same type as times

set_properties(properties_dict, property_names, overwrite=False)

Add one or a bunch of properties packed into properties_dict

Parameters:
  • properties_dict (dict) – Dictionary of properties and their values.

  • property_names (dict) – Is a dictionary {key:val, …} where each val is a list [var1, var2, …] of variables to be pulled from properties_dict and added to the property localtion with name key

  • overwrite (bool, optional) – Toggles overwriting of existing properties.

set_property(name, value, location=None, overwrite=False)

Method to set a property for this device.

Property will be stored in the connection table and used during connection table comparisons.

Value must satisfy eval(repr(value)) == value.

Parameters:
  • name (str) – Name to save property value to.

  • value – Value to set property to.

  • location (str, optional) – Specify a location to save property to, such as ‘device_properties’ or ‘connection_table_properties’.

  • overwrite (bool, optional) – If True, allow overwriting a property already set.

Raises:

LabscriptError – If ‘location’ is not valid or trying to overwrite an existing property with ‘overwrite’=False.

property t0

The earliest time output can be commanded from this device at the start of the experiment. This is nonzero on secondary pseudoclock devices due to triggering delays.

Type:

float

class naqs_devices.KeysightXSeries.labscript_devices.CounterScopeChannel(name, parent_device, connection)[source]

Bases: ScopeChannel

This instantiates a counter scope channel to acquire during a buffered shot.

Parameters:
  • name (str) – Name to assign channel

  • parent_device (obj) – Handle to parent device

  • connection (str) – Which physical scope channel is acquiring. Generally of the form ‘Channel n’ where n is the channel label.

description = 'Scope Acquisition Channel Class with Pulse Counting'

Brief description of the device.

count(typ, pol)[source]

Register a pulse counter operation for this channel.

Parameters:
  • typ (str) – count ‘pulse’ or ‘edge’

  • pol (str) – reference to ‘pos’ or ‘neg’ edges

acquire()

Inform BLACS to save data from this channel.

Note that the parent_device controls when the acquisition trigger is sent.

add_device(device)

Adds a child device to this device.

Parameters:

device (Device) – Device to add.

Raises:

LabscriptError – If device is not an allowed child of this device.

allowed_children = None

Defines types of devices that are allowed to be children of this device.

Type:

list

generate_code(hdf5_file)

Generate hardware instructions for device and children, then save to h5 file.

Will recursively call generate_code for all children devices.

Parameters:

hdf5_file (h5py:h5py.File) – Handle to shot file.

get_all_children()

Get all children devices for this device.

Returns:

List of children Device.

Return type:

list

get_all_outputs()

Get all children devices that are outputs.

Recursively calls get_all_outputs() on each child device. Output’s will return a list containing just themselves.

Returns:

List of children Output.

Return type:

list

get_properties(location=None)

Get all properties in location.

Parameters:

location (str, optional) – Location to get properties from. If None, return all properties.

Returns:

Dictionary of properties.

Return type:

dict

get_property(name, location=None, *args, **kwargs)

Method to get a property of this device already set using Device.set_property().

If the property is not already set, a default value will be returned if specified as the argument after ‘name’, if there is only one argument after ‘name’ and the argument is either not a keyword argurment or is a keyword argument with the name ‘default’.

Parameters:
  • name (str) – Name of property to get.

  • location (str, optional) – If not None, only search for name in location.

  • default – The default value. If not provided, an exception is raised if the value is not set.

Returns:

Property value.

Raises:

LabscriptError – If property not set and default not provided, or default conventions not followed.

Examples

Examples of acceptable signatures:

>>> get_property('example')             # 'example' will be returned if set, or an exception raised
>>> get_property('example', 7)          # 7 returned if 'example' is not set
>>> get_property('example', default=7)  # 7 returnd if 'example' is not set

Example signatures that WILL ALWAYS RAISE AN EXCEPTION:

>>> get_property('example', 7, 8)
>>> get_property('example', 7, default=9)
>>> get_property('example', default=7, x=9)
init_device_group(hdf5_file)

Creates the device group in the shot file.

Parameters:

hdf5_file (h5py:h5py.File) – File handle to create the group in.

Returns:

Created group handle.

Return type:

h5py:h5py.Group

property parent_clock_line

Stores the clocking clockline, which may be itself.

Type:

ClockLine

property pseudoclock_device

Stores the clocking pseudoclock, which may be itself.

Type:

PseudoclockDevice

quantise_to_pseudoclock(times)

Quantises times to the resolution of the controlling pseudoclock.

Parameters:

times (numpy:numpy.ndarray or list or set or float) – Time, in seconds, to quantise.

Returns:

Quantised times.

Return type:

same type as times

set_properties(properties_dict, property_names, overwrite=False)

Add one or a bunch of properties packed into properties_dict

Parameters:
  • properties_dict (dict) – Dictionary of properties and their values.

  • property_names (dict) – Is a dictionary {key:val, …} where each val is a list [var1, var2, …] of variables to be pulled from properties_dict and added to the property localtion with name key

  • overwrite (bool, optional) – Toggles overwriting of existing properties.

set_property(name, value, location=None, overwrite=False)

Method to set a property for this device.

Property will be stored in the connection table and used during connection table comparisons.

Value must satisfy eval(repr(value)) == value.

Parameters:
  • name (str) – Name to save property value to.

  • value – Value to set property to.

  • location (str, optional) – Specify a location to save property to, such as ‘device_properties’ or ‘connection_table_properties’.

  • overwrite (bool, optional) – If True, allow overwriting a property already set.

Raises:

LabscriptError – If ‘location’ is not valid or trying to overwrite an existing property with ‘overwrite’=False.

property t0

The earliest time output can be commanded from this device at the start of the experiment. This is nonzero on secondary pseudoclock devices due to triggering delays.

Type:

float

class naqs_devices.KeysightXSeries.labscript_devices.KeysightXScope(name, VISA_name, trigger_device, trigger_connection, num_AI=4, DI=True, trigger_duration=0.001, compression=None, compression_opts=None, shuffle=False, **kwargs)[source]

Bases: TriggerableDevice

VISA_name can be full VISA connection string or NI-MAX alias. Trigger Device should be fast clocked device. num_AI sets number of analog input channels, default 4 DI sets if DI are present, default True trigger_duration set scope trigger duration, default 1ms Compression of traces in h5 file controlled by: compression: ‘lzf’, ‘gzip’, None compression_opts: 0-9 for gzip shuffle: True/False

description = 'Keysight X Series Digital Oscilliscope'

Brief description of the device.

allowed_children = [<class 'naqs_devices.KeysightXSeries.labscript_devices.ScopeChannel'>]

Defines types of devices that are allowed to be children of this device.

Type:

list

add_device(device)

Adds a child device to this device.

Parameters:

device (Device) – Device to add.

Raises:

LabscriptError – If device is not an allowed child of this device.

do_checks()

Check that all devices sharing a trigger device have triggers when this device has a trigger.

Raises:

LabscriptError – If correct triggers do not exist for all devices.

get_all_children()

Get all children devices for this device.

Returns:

List of children Device.

Return type:

list

get_all_outputs()

Get all children devices that are outputs.

Recursively calls get_all_outputs() on each child device. Output’s will return a list containing just themselves.

Returns:

List of children Output.

Return type:

list

get_properties(location=None)

Get all properties in location.

Parameters:

location (str, optional) – Location to get properties from. If None, return all properties.

Returns:

Dictionary of properties.

Return type:

dict

get_property(name, location=None, *args, **kwargs)

Method to get a property of this device already set using Device.set_property().

If the property is not already set, a default value will be returned if specified as the argument after ‘name’, if there is only one argument after ‘name’ and the argument is either not a keyword argurment or is a keyword argument with the name ‘default’.

Parameters:
  • name (str) – Name of property to get.

  • location (str, optional) – If not None, only search for name in location.

  • default – The default value. If not provided, an exception is raised if the value is not set.

Returns:

Property value.

Raises:

LabscriptError – If property not set and default not provided, or default conventions not followed.

Examples

Examples of acceptable signatures:

>>> get_property('example')             # 'example' will be returned if set, or an exception raised
>>> get_property('example', 7)          # 7 returned if 'example' is not set
>>> get_property('example', default=7)  # 7 returnd if 'example' is not set

Example signatures that WILL ALWAYS RAISE AN EXCEPTION:

>>> get_property('example', 7, 8)
>>> get_property('example', 7, default=9)
>>> get_property('example', default=7, x=9)
init_device_group(hdf5_file)

Creates the device group in the shot file.

Parameters:

hdf5_file (h5py:h5py.File) – File handle to create the group in.

Returns:

Created group handle.

Return type:

h5py:h5py.Group

minimum_recovery_time = 0

Minimum time required before another trigger can occur.

Type:

float

property parent_clock_line

Stores the clocking clockline, which may be itself.

Type:

ClockLine

property pseudoclock_device

Stores the clocking pseudoclock, which may be itself.

Type:

PseudoclockDevice

quantise_to_pseudoclock(times)

Quantises times to the resolution of the controlling pseudoclock.

Parameters:

times (numpy:numpy.ndarray or list or set or float) – Time, in seconds, to quantise.

Returns:

Quantised times.

Return type:

same type as times

set_properties(properties_dict, property_names, overwrite=False)

Add one or a bunch of properties packed into properties_dict

Parameters:
  • properties_dict (dict) – Dictionary of properties and their values.

  • property_names (dict) – Is a dictionary {key:val, …} where each val is a list [var1, var2, …] of variables to be pulled from properties_dict and added to the property localtion with name key

  • overwrite (bool, optional) – Toggles overwriting of existing properties.

set_property(name, value, location=None, overwrite=False)

Method to set a property for this device.

Property will be stored in the connection table and used during connection table comparisons.

Value must satisfy eval(repr(value)) == value.

Parameters:
  • name (str) – Name to save property value to.

  • value – Value to set property to.

  • location (str, optional) – Specify a location to save property to, such as ‘device_properties’ or ‘connection_table_properties’.

  • overwrite (bool, optional) – If True, allow overwriting a property already set.

Raises:

LabscriptError – If ‘location’ is not valid or trying to overwrite an existing property with ‘overwrite’=False.

property t0

The earliest time output can be commanded from this device at the start of the experiment. This is nonzero on secondary pseudoclock devices due to triggering delays.

Type:

float

trigger(t, duration)

Request parent trigger device to produce a trigger.

Parameters:
  • t (float) – Time, in seconds, to produce a trigger.

  • duration (float) – Duration, in seconds, of the trigger pulse.

trigger_edge_type = 'rising'

Type of trigger. Must be ‘rising’ or ‘falling’.

Type:

str

generate_code(hdf5_file)[source]

Automatically called by compiler to write acquisition instructions to h5 file. Configures counters, analog and digital acquisitions.

acquire(start_time)[source]

Call to define time when trigger will happen for scope.