dpo7ax

DPO7AX device driver module.

DPO7AX

DPO7AX(
    config_entry: DeviceConfigEntry,
    verbose: bool,
    visa_resource: MessageBasedResource,
    default_visa_timeout: int,
)

Bases: DPO7AXMixin, DPO7

flowchart LR tm_devices.drivers.scopes.tekscope.dpo7ax.DPO7AX[DPO7AX] tm_devices.commands.dpo7ax_commands.DPO7AXMixin[DPO7AXMixin] tm_devices.drivers.scopes.tekscope.dpo7.DPO7[DPO7] tm_devices.drivers.scopes.tekscope.tekscope.TekScope[TekScope] tm_devices.driver_mixins.abstract_device_functionality.signal_generator_mixin.SignalGeneratorMixin[SignalGeneratorMixin] tm_devices.drivers.scopes.tekscope.tekscope.AbstractTekScope[AbstractTekScope] tm_devices.driver_mixins.shared_implementations._tektronix_pi_scope_mixin._TektronixPIScopeMixin[_TektronixPIScopeMixin] tm_devices.driver_mixins.device_control.pi_control.PIControl[PIControl] tm_devices.driver_mixins.device_control._abstract_device_visa_write_query_control._AbstractDeviceVISAWriteQueryControl[_AbstractDeviceVISAWriteQueryControl] tm_devices.drivers.scopes.scope.Scope[Scope] tm_devices.drivers.device.Device[Device] tm_devices.driver_mixins.device_control._abstract_device_control._AbstractDeviceControl[_AbstractDeviceControl] tm_devices.driver_mixins.shared_implementations._extension_mixin._ExtendableMixin[_ExtendableMixin] tm_devices.driver_mixins.abstract_device_functionality.analysis_object_mixins.BusMixin[BusMixin] tm_devices.driver_mixins.abstract_device_functionality.analysis_object_mixins.HistogramMixin[HistogramMixin] tm_devices.driver_mixins.abstract_device_functionality.licensed_mixin.LicensedMixin[LicensedMixin] tm_devices.driver_mixins.abstract_device_functionality.analysis_object_mixins.MathMixin[MathMixin] tm_devices.driver_mixins.abstract_device_functionality.analysis_object_mixins.MeasurementsMixin[MeasurementsMixin] tm_devices.driver_mixins.abstract_device_functionality.analysis_object_mixins.ReferenceMixin[ReferenceMixin] tm_devices.driver_mixins.abstract_device_functionality.analysis_object_mixins.SearchMixin[SearchMixin] tm_devices.driver_mixins.abstract_device_functionality.analysis_object_mixins.PlotMixin[PlotMixin] tm_devices.driver_mixins.abstract_device_functionality.analysis_object_mixins.PowerMixin[PowerMixin] tm_devices.driver_mixins.abstract_device_functionality.usb_drives_mixin.USBDrivesMixin[USBDrivesMixin] tm_devices.driver_mixins.abstract_device_functionality.channel_control_mixin.ChannelControlMixin[ChannelControlMixin] tm_devices.driver_mixins.abstract_device_functionality.screen_capture_mixin.ScreenCaptureMixin[ScreenCaptureMixin] tm_devices.commands.dpo7ax_commands.DPO7AXMixin --> tm_devices.drivers.scopes.tekscope.dpo7ax.DPO7AX tm_devices.drivers.scopes.tekscope.dpo7.DPO7 --> tm_devices.drivers.scopes.tekscope.dpo7ax.DPO7AX tm_devices.drivers.scopes.tekscope.tekscope.TekScope --> tm_devices.drivers.scopes.tekscope.dpo7.DPO7 tm_devices.driver_mixins.abstract_device_functionality.signal_generator_mixin.SignalGeneratorMixin --> tm_devices.drivers.scopes.tekscope.tekscope.TekScope tm_devices.driver_mixins.shared_implementations._extension_mixin._ExtendableMixin --> tm_devices.driver_mixins.abstract_device_functionality.signal_generator_mixin.SignalGeneratorMixin tm_devices.drivers.scopes.tekscope.tekscope.AbstractTekScope --> tm_devices.drivers.scopes.tekscope.tekscope.TekScope tm_devices.driver_mixins.shared_implementations._tektronix_pi_scope_mixin._TektronixPIScopeMixin --> tm_devices.drivers.scopes.tekscope.tekscope.AbstractTekScope tm_devices.driver_mixins.device_control._abstract_device_visa_write_query_control._AbstractDeviceVISAWriteQueryControl --> tm_devices.driver_mixins.shared_implementations._tektronix_pi_scope_mixin._TektronixPIScopeMixin tm_devices.driver_mixins.device_control._abstract_device_control._AbstractDeviceControl --> tm_devices.driver_mixins.device_control._abstract_device_visa_write_query_control._AbstractDeviceVISAWriteQueryControl tm_devices.driver_mixins.device_control.pi_control.PIControl --> tm_devices.drivers.scopes.tekscope.tekscope.AbstractTekScope tm_devices.driver_mixins.device_control._abstract_device_visa_write_query_control._AbstractDeviceVISAWriteQueryControl --> tm_devices.driver_mixins.device_control.pi_control.PIControl tm_devices.driver_mixins.device_control._abstract_device_control._AbstractDeviceControl --> tm_devices.driver_mixins.device_control._abstract_device_visa_write_query_control._AbstractDeviceVISAWriteQueryControl tm_devices.driver_mixins.shared_implementations._extension_mixin._ExtendableMixin --> tm_devices.driver_mixins.device_control.pi_control.PIControl tm_devices.drivers.scopes.scope.Scope --> tm_devices.drivers.scopes.tekscope.tekscope.AbstractTekScope tm_devices.drivers.device.Device --> tm_devices.drivers.scopes.scope.Scope tm_devices.driver_mixins.device_control._abstract_device_control._AbstractDeviceControl --> tm_devices.drivers.device.Device tm_devices.driver_mixins.shared_implementations._extension_mixin._ExtendableMixin --> tm_devices.drivers.device.Device tm_devices.driver_mixins.abstract_device_functionality.analysis_object_mixins.BusMixin --> tm_devices.drivers.scopes.tekscope.tekscope.AbstractTekScope tm_devices.driver_mixins.abstract_device_functionality.analysis_object_mixins.HistogramMixin --> tm_devices.drivers.scopes.tekscope.tekscope.AbstractTekScope tm_devices.driver_mixins.abstract_device_functionality.licensed_mixin.LicensedMixin --> tm_devices.drivers.scopes.tekscope.tekscope.AbstractTekScope tm_devices.driver_mixins.abstract_device_functionality.analysis_object_mixins.MathMixin --> tm_devices.drivers.scopes.tekscope.tekscope.AbstractTekScope tm_devices.driver_mixins.abstract_device_functionality.analysis_object_mixins.MeasurementsMixin --> tm_devices.drivers.scopes.tekscope.tekscope.AbstractTekScope tm_devices.driver_mixins.abstract_device_functionality.analysis_object_mixins.ReferenceMixin --> tm_devices.drivers.scopes.tekscope.tekscope.AbstractTekScope tm_devices.driver_mixins.abstract_device_functionality.analysis_object_mixins.SearchMixin --> tm_devices.drivers.scopes.tekscope.tekscope.AbstractTekScope tm_devices.driver_mixins.abstract_device_functionality.analysis_object_mixins.PlotMixin --> tm_devices.drivers.scopes.tekscope.tekscope.AbstractTekScope tm_devices.driver_mixins.abstract_device_functionality.analysis_object_mixins.PowerMixin --> tm_devices.drivers.scopes.tekscope.tekscope.AbstractTekScope tm_devices.driver_mixins.abstract_device_functionality.usb_drives_mixin.USBDrivesMixin --> tm_devices.drivers.scopes.tekscope.tekscope.AbstractTekScope tm_devices.driver_mixins.abstract_device_functionality.channel_control_mixin.ChannelControlMixin --> tm_devices.drivers.scopes.tekscope.tekscope.AbstractTekScope tm_devices.driver_mixins.abstract_device_functionality.screen_capture_mixin.ScreenCaptureMixin --> tm_devices.drivers.scopes.tekscope.tekscope.AbstractTekScope click tm_devices.drivers.scopes.tekscope.dpo7ax.DPO7AX href "" "tm_devices.drivers.scopes.tekscope.dpo7ax.DPO7AX" click tm_devices.commands.dpo7ax_commands.DPO7AXMixin href "" "tm_devices.commands.dpo7ax_commands.DPO7AXMixin" click tm_devices.drivers.scopes.tekscope.dpo7.DPO7 href "" "tm_devices.drivers.scopes.tekscope.dpo7.DPO7" click tm_devices.drivers.scopes.tekscope.tekscope.TekScope href "" "tm_devices.drivers.scopes.tekscope.tekscope.TekScope" click tm_devices.driver_mixins.abstract_device_functionality.signal_generator_mixin.SignalGeneratorMixin href "" "tm_devices.driver_mixins.abstract_device_functionality.signal_generator_mixin.SignalGeneratorMixin" click tm_devices.drivers.scopes.tekscope.tekscope.AbstractTekScope href "" "tm_devices.drivers.scopes.tekscope.tekscope.AbstractTekScope" click tm_devices.driver_mixins.shared_implementations._tektronix_pi_scope_mixin._TektronixPIScopeMixin href "" "tm_devices.driver_mixins.shared_implementations._tektronix_pi_scope_mixin._TektronixPIScopeMixin" click tm_devices.driver_mixins.device_control.pi_control.PIControl href "" "tm_devices.driver_mixins.device_control.pi_control.PIControl" click tm_devices.driver_mixins.device_control._abstract_device_visa_write_query_control._AbstractDeviceVISAWriteQueryControl href "" "tm_devices.driver_mixins.device_control._abstract_device_visa_write_query_control._AbstractDeviceVISAWriteQueryControl" click tm_devices.drivers.scopes.scope.Scope href "" "tm_devices.drivers.scopes.scope.Scope" click tm_devices.drivers.device.Device href "" "tm_devices.drivers.device.Device" click tm_devices.driver_mixins.device_control._abstract_device_control._AbstractDeviceControl href "" "tm_devices.driver_mixins.device_control._abstract_device_control._AbstractDeviceControl" click tm_devices.driver_mixins.shared_implementations._extension_mixin._ExtendableMixin href "" "tm_devices.driver_mixins.shared_implementations._extension_mixin._ExtendableMixin" click tm_devices.driver_mixins.abstract_device_functionality.analysis_object_mixins.BusMixin href "" "tm_devices.driver_mixins.abstract_device_functionality.analysis_object_mixins.BusMixin" click tm_devices.driver_mixins.abstract_device_functionality.analysis_object_mixins.HistogramMixin href "" "tm_devices.driver_mixins.abstract_device_functionality.analysis_object_mixins.HistogramMixin" click tm_devices.driver_mixins.abstract_device_functionality.licensed_mixin.LicensedMixin href "" "tm_devices.driver_mixins.abstract_device_functionality.licensed_mixin.LicensedMixin" click tm_devices.driver_mixins.abstract_device_functionality.analysis_object_mixins.MathMixin href "" "tm_devices.driver_mixins.abstract_device_functionality.analysis_object_mixins.MathMixin" click tm_devices.driver_mixins.abstract_device_functionality.analysis_object_mixins.MeasurementsMixin href "" "tm_devices.driver_mixins.abstract_device_functionality.analysis_object_mixins.MeasurementsMixin" click tm_devices.driver_mixins.abstract_device_functionality.analysis_object_mixins.ReferenceMixin href "" "tm_devices.driver_mixins.abstract_device_functionality.analysis_object_mixins.ReferenceMixin" click tm_devices.driver_mixins.abstract_device_functionality.analysis_object_mixins.SearchMixin href "" "tm_devices.driver_mixins.abstract_device_functionality.analysis_object_mixins.SearchMixin" click tm_devices.driver_mixins.abstract_device_functionality.analysis_object_mixins.PlotMixin href "" "tm_devices.driver_mixins.abstract_device_functionality.analysis_object_mixins.PlotMixin" click tm_devices.driver_mixins.abstract_device_functionality.analysis_object_mixins.PowerMixin href "" "tm_devices.driver_mixins.abstract_device_functionality.analysis_object_mixins.PowerMixin" click tm_devices.driver_mixins.abstract_device_functionality.usb_drives_mixin.USBDrivesMixin href "" "tm_devices.driver_mixins.abstract_device_functionality.usb_drives_mixin.USBDrivesMixin" click tm_devices.driver_mixins.abstract_device_functionality.channel_control_mixin.ChannelControlMixin href "" "tm_devices.driver_mixins.abstract_device_functionality.channel_control_mixin.ChannelControlMixin" click tm_devices.driver_mixins.abstract_device_functionality.screen_capture_mixin.ScreenCaptureMixin href "" "tm_devices.driver_mixins.abstract_device_functionality.screen_capture_mixin.ScreenCaptureMixin"

DPO7AX device driver.

Parameters:
  • config_entry (DeviceConfigEntry) –

    A config entry object parsed by the DMConfigParser.

  • verbose (bool) –

    A boolean indicating if verbose output should be printed.

  • visa_resource (MessageBasedResource) –

    The VISA resource object.

  • default_visa_timeout (int) –

    The default VISA timeout value in milliseconds.

address property

address: str

Return the device address as defined in the config_entry.

This could be an IP address, hostname, or USB device address.

alias cached property

alias: str

Return the alias if it exists, otherwise an empty string.

all_channel_names_list property

all_channel_names_list: tuple[str, ...]

Return a tuple containing all the channel names.

channel cached property

Mapping of channel names to any detectable properties, attributes, and settings.

command_argument_constants cached property

command_argument_constants: DPO7AXCommandConstants

Return the DPO7AX command argument constants.

This provides access to all the string constants which can be used as arguments for DPO7AX commands.

command_syntax_enabled property

command_syntax_enabled: bool

Return a string containing the syntax of the command being accessed.

This property indicates when the syntax should be returned instead of writing/querying the device and returning the result.

command_verification_enabled property

command_verification_enabled: bool

Indicate if command verification is enabled.

This property only applies to commands sent using the .commands property of the device.

Notes
  • If .enable_verification is set to False, then no verification will happen at all.
  • If .enable_verification is set to True and this property is True, then verification will happen for commands sent using the .commands property of the device.
  • If .enable_verification is set to True and this property is False, then verification will not happen for commands sent using the .commands property of the device.

commands cached property

commands: DPO7AXCommands

Return the DPO7AX commands.

This provides access to all the commands for the DPO7AX device. See the documentation of each sub-property for more usage information.

Sub-properties
  • .acquire: The ACQuire command.
  • .actonevent: The ACTONEVent command tree.
  • .afg: The AFG command tree.
  • .alias: The ALIas command.
  • .allev: The ALLEv command.
  • .application: The APPLication command tree.
  • .autosavepitimeout: The AUTOSAVEPITIMEOUT command.
  • .autosaveuitimeout: The AUTOSAVEUITIMEOUT command.
  • .autoset: The AUTOSet command.
  • .auxin: The AUXIn command tree.
  • .auxout: The AUXout command tree.
  • .bus: The BUS command tree.
  • .bustable: The BUSTABle command tree.
  • .busy: The BUSY command.
  • .cal: The *CAL command.
  • .calibrate: The CALibrate command.
  • .callouts: The CALLOUTS command tree.
  • .ch: The CH<x> command.
  • .clear: The CLEAR command.
  • .cls: The *CLS command.
  • .configuration: The CONFIGuration command tree.
  • .connected: The CONNected command tree.
  • .curvestream: The CURVEStream command.
  • .customtable: The CUSTOMTABle command tree.
  • .data: The DATa command.
  • .date: The DATE command.
  • .ddt: The *DDT command.
  • .dese: The DESE command.
  • .diag: The DIAg command tree.
  • .diggrp: The DIGGRP<x> command tree.
  • .display: The DISplay command.
  • .ese: The *ESE command.
  • .esr: The *ESR command.
  • .ethernet: The ETHERnet command tree.
  • .event: The EVENT command.
  • .evmsg: The EVMsg command.
  • .evqty: The EVQty command.
  • .eyemask: The EYEMASK command tree.
  • .factory: The FACtory command.
  • .filesystem: The FILESystem command.
  • .fpanel: The FPAnel command tree.
  • .header: The HEADer command.
  • .histogram: The HISTogram command tree.
  • .horizontal: The HORizontal command.
  • .hostprocessor: The HOSTProcessor command.
  • .hsinterface: The HSInterface command tree.
  • .id: The ID command.
  • .idn: The *IDN command.
  • .license: The LICense command.
  • .lock: The LOCk command.
  • .lrn: The *LRN command.
  • .mainwindow: The MAINWindow command tree.
  • .mask: The MASK command tree.
  • .math: The MATH command tree.
  • .matharbflt: The MATHArbflt<x> command tree.
  • .meastable: The MEASTABle command tree.
  • .measurement: The MEASUrement command.
  • .newpass: The NEWpass command.
  • .opc: The *OPC command.
  • .opt: The *OPT command.
  • .password: The PASSWord command.
  • .pause: The PAUSe command.
  • .peakstable: The PEAKSTABle command tree.
  • .pilogger: The PILOGger command tree.
  • .plot: The PLOT command tree.
  • .psc: The *PSC command.
  • .pud: The *PUD command.
  • .recall: The RECAll command tree.
  • .ref: The REF command tree.
  • .refx: The REF<x> command tree.
  • .rem: The REM command.
  • .rosc: The ROSc command tree.
  • .rst: The *RST command.
  • .save: The SAVe command tree.
  • .saveon: The SAVEON command tree.
  • .saveonevent: The SAVEONEVent command tree.
  • .search: The SEARCH command tree.
  • .searchtable: The SEARCHTABle command tree.
  • .security: The SECurity command tree.
  • .select: The SELect command tree.
  • .set: The SET command.
  • .socketserver: The SOCKETServer command tree.
  • .sre: The *SRE command.
  • .stb: The *STB command.
  • .sv: The SV command tree.
  • .teksecure: The TEKSecure command.
  • .time: The TIMe command.
  • .totaluptime: The TOTaluptime command.
  • .touchscreen: The TOUCHSCReen command tree.
  • .trg: The *TRG command.
  • .trigger: The TRIGger command.
  • .tst: The *TST command.
  • .undo: The UNDO command.
  • .unlock: The UNLock command.
  • .usbdevice: The USBDevice command tree.
  • .verbose: The VERBose command.
  • .vertical: The VERTical command tree.
  • .visual: The VISual command tree.
  • .vxi: The VXI command tree.
  • .wai: The *WAI command.
  • .wavfrm: The WAVFrm command.
  • .wfmoutpre: The WFMOutpre command.

config_entry cached property

config_entry: DeviceConfigEntry

Return the device config.

connection_type property

connection_type: str

Return a string indicating the connection type.

default_visa_timeout property

default_visa_timeout: int

Return the default VISA timeout value in milliseconds.

device_number property

device_number: int

Return the device number, if it was not created by the DeviceManager it will be -1.

device_type cached property

device_type: str

Return a string representing the device type.

enable_verification property writable

enable_verification: bool

Return the boolean which indicates if verification checks should happen.

This can be disabled after developing a script in order to increase the speed of the script.

Notes
  • If .enable_verification is set to False, then no verification of any commands sent using the .set_and_check() method will occur (the “check” portion of “set” and “check” will be skipped).
  • If .enable_verification is set to True, then verification will happen for commands sent using the .set_and_check() method (both the “set” and “check” portions will be executed).

hostname cached property

hostname: str

Return the hostname of the device or an empty string if unable to fetch that.

idn_string cached property

idn_string: str

Return the string returned from the *IDN? query when the device was created.

ieee_cmds property

ieee_cmds: IEEE4882Commands

Return an internal class containing methods for the standard IEEE 488.2 command set.

internal_afg cached property

internal_afg: InternalAFGChannel

The scope’s internal AFG.

ip_address cached property

ip_address: str

Return the IPv4 address of the device or an empty string if unable to fetch that.

is_open property

is_open: bool

Indicate if the connection to the device is currently open.

license_list cached property

license_list: tuple[str, ...]

Return the list of license AppIDs installed on the scope.

manufacturer cached property

manufacturer: str

Return the manufacturer of the device.

model cached property

model: str

Return the full model of the device.

name cached property

name: str

Return the device name.

Usually something like “SCOPE 1”

name_and_alias cached property

name_and_alias: str

Return string for easy ID of device in console output prints.

num_dig_bits_in_ch property

num_dig_bits_in_ch: int

Return the number of digital bits expected in a digital channel.

port property

port: int | None

Return the device port, or None if the device doesn’t have a port.

resource_expression property

resource_expression: str

Return the VISA resource expression.

serial cached property

serial: str

Return the serial number of the device.

series cached property

series: str

Return the series of the device.

Returns:
  • str

    The series of the device, e.g. MSO5, TSOVu, TEKSCOPE, AFG3K, AWG5200

source_device_constants property

source_device_constants: TekScopeSourceDeviceConstants

The constants defining what functions and memory sizes are allowed for the device.

sw_version cached property

sw_version: Version

Return the software version of the device.

total_channels cached property

total_channels: int

Return the total number of channels (all types).

usb_drives cached property

usb_drives: tuple[str, ...]

Return a list of all connected USB drives.

valid_image_extensions property

valid_image_extensions: tuple[str, ...]

Return a tuple of valid image extensions for this device.

The extensions will be in the format ‘.ext’, where ‘ext’ is the lowercase extension, e.g. (“.png”, “.jpg”).

Returns:
  • tuple[str, ...]

    Tuple[str, …]: A tuple of valid, lowercase image extensions for this device.

verbose property

verbose: bool

Return the verbose attribute of the device.

visa_backend cached property

visa_backend: str

Return the VISA backend in use.

visa_resource property

visa_resource: MessageBasedResource

Return the VISA resource object.

This gives access to all the attributes and methods that PyVISA provides.

visa_timeout property writable

visa_timeout: float

Return the current VISA timeout of the device in milliseconds.

add_bus

add_bus(bus_num: int) -> None

Add a new bus.

Parameters:
  • bus_num (int) –

    The number of the bus to add.

add_histogram

add_histogram(hist_num: int) -> None

Add a new histogram.

Parameters:
  • hist_num (int) –

    The number of the histogram to add.

add_math

add_math(math_num: int) -> None

Add a new math.

Parameters:
  • math_num (int) –

    The number of the math to add.

add_measurement

add_measurement(measurement_num: int) -> None

Add a new measurement.

Parameters:
  • measurement_num (int) –

    The number of the measurement to add.

add_measurement_table

add_measurement_table(meas_table_num: int) -> None

Add a new measurement table.

Parameters:
  • meas_table_num (int) –

    The number of the measurement table to add.

add_method classmethod

add_method(method: Callable[Concatenate[Self, _P], _T]) -> None

Add a method to the class.

This class method is best used as a decorator on functions in order to add them to a class.

Examples:

>>> from tm_devices.drivers.device import Device
>>>
>>> @Device.add_method
... def print_hello(self: Device, var: str):
...     print("Hello World!")
...     print(f"I am a {self.__class__.__name__}!")
...     print(f"My var is {var}")
Parameters:

add_new_bus

add_new_bus(bus_name: str, bus_type: str) -> None

Add a new bus with the given name, and type.

Parameters:
  • bus_name (str) –

    The name of the new bus.

  • bus_type (str) –

    The type of the new bus.

add_new_math

add_new_math(math_name: str, math_expression: str) -> None

Add a new math with the given expression.

Parameters:
  • math_name (str) –

    The name of the math.

  • math_expression (str) –

    The math expression.

add_new_measurement

add_new_measurement(meas_name: str, meas_type: str, meas_source: str | None = None) -> None

Add a new measurement with the given name, type, and source.

Parameters:
  • meas_name (str) –

    The name of the new measurement.

  • meas_type (str) –

    The type of the new measurement.

  • meas_source (str | None, default: None ) –

    The source of the new measurement. If None, the currently selected waveform (or first available valid source) will be used as the source.

add_new_plot

add_new_plot(plot_name: str, plot_type: str) -> None

Add a new plot with the given name, and type.

Parameters:
  • plot_name (str) –

    The name of the new plot.

  • plot_type (str) –

    The type of the new plot.

add_plot

add_plot(plot_num: int) -> None

Add a new plot.

Parameters:
  • plot_num (int) –

    The number of the plot to add.

add_power

add_power(power_meas_num: int) -> None

Add a new power measurement.

Parameters:
  • power_meas_num (int) –

    The number of the power measurement to add.

add_property classmethod

add_property(method: Callable[Concatenate[_EM, _P], _T]) -> None
add_property(
    method: None = None, /, *, is_cached: bool = False
) -> Callable[[Callable[Concatenate[_EM, _P], _T]], None]
add_property(
    method: Callable[[Self], _T] | None = None, /, *, is_cached: bool = False
) -> Callable[[Callable[[Self], _T]], None] | None

Add a property to the class.

This class method is best used as a decorator on functions in order to add them to a class.

Examples:

>>> from tm_devices.drivers.device import Device
>>>
>>> @Device.add_property
... def foo(self: Device):
...     return "bar"
>>>
>>> @Device.add_property(is_cached=True)
... def foo(self: Device):
...     return self.name + self.address
Parameters:
  • method (Callable[[Self], _T] | None, default: None ) –

    The property to add to the class.

  • is_cached (bool, default: False ) –

    Whether the property is only evaluated once and cached.

add_ref

add_ref(ref_num: int) -> None

Add a new ref.

Parameters:
  • ref_num (int) –

    The number of the ref to add.

add_search(search_num: int) -> None

Add a new search.

Parameters:
  • search_num (int) –

    The number of the search to add.

check_network_connection

check_network_connection() -> tuple[bool, str]

Check the network connection to the device using an external ping command.

Wrapper function for check_network_connection.

Returns:
  • tuple[bool, str]

    A tuple containing a boolean indicating if there is a network connection and a string with the result of the ping command.

check_port_connection

check_port_connection(port: int, timeout_seconds: int = 5) -> bool

Check if the given port is open on the device.

Wrapper function for check_port_connection.

Parameters:
  • port (int) –

    The port to check.

  • timeout_seconds (int, default: 5 ) –

    The number of seconds to use as the socket timeout.

Returns:
  • bool

    A boolean indicating if the port is open.

check_visa_connection

check_visa_connection() -> bool

Check if a VISA connection can be made to the device.

Wrapper function for check_visa_connection.

cleanup

cleanup(verbose: bool = True) -> None

Perform the cleanup defined for the device.

Parameters:
  • verbose (bool, default: True ) –

    Set this to False in order to disable printouts.

close

close() -> None

Close this device and all its used resources and components.

command_syntax

command_syntax() -> Generator[None, None, None]

Enable command syntax for the duration of this context manager.

This method is designed to be used as a context manager (with device.command_syntax():) around any blocks of code where the literal syntax of commands accessed using the .commands property is desired.

This is accomplished by setting the .command_syntax_enabled property to True for the duration of the context manager.

command_verification

command_verification() -> Generator[None, None, None]

Enable command verification for the duration of this context manager.

This method is designed to be used as a context manager (with device.command_verification():) around any blocks of code where verification of commands sent using the .commands property is desired.

This is accomplished by setting the .command_verification_enabled property to True for the duration of the context manager.

curve_query

curve_query(
    channel_num: int,
    wfm_type: str = "TimeDomain",
    output_csv_file: str | PathLike[str] | None = None,
) -> list[Any]

Perform a curve query on a specific channel.

Parameters:
  • channel_num (int) –

    The channel number to perform the curve query on.

  • wfm_type (str, default: 'TimeDomain' ) –

    The type of waveform to query.

  • output_csv_file (str | PathLike[str] | None, default: None ) –

    An optional file path to a csv file to save the curve query data in.

Returns:
  • list[Any]

    List of waveform data

Raises:
  • AssertionError

    Indicates that an invalid waveform type was passed in to the method.

delete_bus

delete_bus(bus_num: int) -> None

Delete a bus.

Parameters:
  • bus_num (int) –

    The number of the bus to delete.

delete_histogram

delete_histogram(hist_num: int) -> None

Delete a histogram.

Parameters:
  • hist_num (int) –

    The number of the histogram to delete.

delete_math

delete_math(math_num: int) -> None

Delete a math.

Parameters:
  • math_num (int) –

    The number of the math to delete.

delete_measurement

delete_measurement(measurement_num: int) -> None

Delete a measurement.

Parameters:
  • measurement_num (int) –

    The number of the measurement to delete.

delete_measurement_table

delete_measurement_table(measurement_table_num: int) -> None

Delete a measurement table.

Parameters:
  • measurement_table_num (int) –

    The number of the measurement table to delete.

delete_plot

delete_plot(plot_num: int) -> None

Delete a plot.

Parameters:
  • plot_num (int) –

    The number of the plot to delete.

delete_power

delete_power(power_num: int) -> None

Delete a power.

Parameters:
  • power_num (int) –

    The number of the power to delete.

delete_ref

delete_ref(ref_num: int) -> None

Delete a ref.

Parameters:
  • ref_num (int) –

    The number of the ref to delete.

delete_search(search_num: int) -> None

Delete a search.

Parameters:
  • search_num (int) –

    The number of the search to delete.

device_clear

device_clear() -> None

Clear the input and output buffers of the VISA device.

disable_srq_events

disable_srq_events() -> None

Disable the service request event for the device.

enable_srq_events

enable_srq_events() -> None

Enable the service request event for the device.

expect_esr

expect_esr(
    esr: int, error_messages: tuple[str, ...] = (), *, use_regex_match: bool = False
) -> bool

Checks for the expected esr value and queued error messages.

Parameters:
  • esr (int) –

    Expected *ESR? value as a decimal-weighted integer.

  • error_messages (tuple[str, ...], default: () ) –

    Expected error buffer messages in a tuple.

  • use_regex_match (bool, default: False ) –

    A boolean indicating if the messages should be compared using regular expressions. Does not affect the esr value comparison.

Returns:
  • bool

    Boolean True when all checks pass. False means the checks failed (however, failing a check will always result in an AssertionError being raised, so the result will not really be usable).

Raises:
  • AssertionError

    Indicating that the device’s error code and messages don’t match the expected values.

factory_reset

factory_reset() -> None

Send the FACTORY command followed by an *OPC? query.

This command is equivalent to pressing the DEFAULT SETUP button located on the instrument front panel or selected Default Setup from the File menu.

It recalls the instrument to factory default settings.

In addition to what *RST does, this command also performs the following operations:

  • Clears any pending OPC operations
  • Resets the following IEEE488.2 registers:
  • *ESR 0 (Event Status Enable Register)
  • *SRE 0 (Service Request Enable Register)
  • DESE 255 (Device Event Status Enable Register)
  • *PSC 1 (Power-on Status Clear Flag)
  • Deletes all defined aliases.
  • Enables command headers (:HEADer 1).

FACTORY only resets the programmable interface settings, it does not change the user interface settings.

generate_burst

generate_burst() -> None

Generate a burst of waveforms by forcing trigger.

generate_function

generate_function(
    frequency: float,
    function: SignalGeneratorFunctionsIAFG,
    amplitude: float,
    offset: float,
    channel: str = "all",
    output_signal_path: SignalGeneratorOutputPathsBase | None = None,
    termination: Literal["FIFTY", "HIGHZ"] = "FIFTY",
    duty_cycle: float = 50.0,
    polarity: Literal["NORMAL", "INVERTED"] = "NORMAL",
    symmetry: float = 50.0,
) -> None

Generate a predefined waveform given the following parameters.

Parameters:
  • frequency (float) –

    The frequency of the waveform to generate.

  • function (SignalGeneratorFunctionsIAFG) –

    The function to generate.

  • amplitude (float) –

    The amplitude of the signal to generate.

  • offset (float) –

    The offset of the signal to generate.

  • channel (str, default: 'all' ) –

    Unused in this class.

  • output_signal_path (SignalGeneratorOutputPathsBase | None, default: None ) –

    Unused in this class.

  • termination (Literal['FIFTY', 'HIGHZ'], default: 'FIFTY' ) –

    The impedance to set the channel to.

  • duty_cycle (float, default: 50.0 ) –

    The duty cycle to set the signal to.

  • polarity (Literal['NORMAL', 'INVERTED'], default: 'NORMAL' ) –

    Unused in this class.

  • symmetry (float, default: 50.0 ) –

    The symmetry to set the signal to, only applicable to certain functions.

get_errors

get_errors() -> tuple[int, tuple[str, ...]]

Get the current errors from the device.

Note

This method will clear out the error queue after reading the current errors.

Returns:
  • tuple[int, tuple[str, ...]]

    A tuple containing the current error code alongside a tuple of the current error messages.

get_visa_stb

get_visa_stb() -> int

Return the VISA status byte.

get_waveform_constraints

get_waveform_constraints(
    function: SignalGeneratorFunctionsIAFG | None = None,
    waveform_length: int | None = None,
    frequency: float | None = None,
    output_signal_path: SignalGeneratorOutputPathsBase | None = None,
    load_impedance: LoadImpedanceAFG = HIGHZ,
) -> ExtendedSourceDeviceConstants

Get the constraints that restrict the waveform to certain parameter ranges.

Parameters:
  • function (SignalGeneratorFunctionsIAFG | None, default: None ) –

    The function that needs to be generated.

  • waveform_length (int | None, default: None ) –

    Unused in this class.

  • frequency (float | None, default: None ) –

    The frequency of the waveform that needs to be generated.

  • output_signal_path (SignalGeneratorOutputPathsBase | None, default: None ) –

    Unused in this class.

  • load_impedance (LoadImpedanceAFG, default: HIGHZ ) –

    The suggested impedance on the source.

Returns:

has_errors

has_errors() -> bool

Check if the device has any errors.

Note

This method will clear out the error queue after reading the current errors.

Returns:
  • bool

    A boolean indicating if any errors were found in the device. True means there were errors, False means no errors were found.

has_license

has_license(license_name: str) -> bool

Check if the given license name is in the license list of the device.

Parameters:
  • license_name (str) –

    The name of the license to check for in the license list.

Returns:
  • bool

    A boolean indicating if the license name is in the list.

poll_query

poll_query(
    number_of_polls: int,
    query: str,
    wanted_val: float | str,
    sleep_time: float = 0.4,
    tolerance: float = 0,
    percentage: bool = False,
    invert_range: bool = False,
    invalid_values: list[float | str] | None = None,
) -> None

Poll the query until the wanted value appears.

Parameters:
  • number_of_polls (int) –

    The number of times to poll the query.

  • query (str) –

    The query to poll.

  • wanted_val (float | str) –

    The desired value to poll for.

  • sleep_time (float, default: 0.4 ) –

    The time to wait between polls (in seconds).

  • tolerance (float, default: 0 ) –

    The acceptable difference between two floating point values.

  • percentage (bool, default: False ) –

    A boolean indicating what kind of tolerance check to perform. False means absolute tolerance: +/- tolerance. True means percent tolerance: +/- (tolerance / 100) * value.

  • invert_range (bool, default: False ) –

    A boolean indicating when to stop polling. False means polling until the wanted value appears. True means polling until a different value from the wanted value appears.

  • invalid_values (list[float | str] | None, default: None ) –

    A list of values that should never be received when polling.

Raises:
  • AssertionError

    Indicating that the device never reached the wanted value.

query

query(
    query: str, *, verbose: bool = True, remove_quotes: bool = False, allow_empty: bool = False
) -> str

Send a query to the device and return the result.

Parameters:
  • query (str) –

    The query to send to the device.

  • verbose (bool, default: True ) –

    Set this to False in order to disable printouts.

  • remove_quotes (bool, default: False ) –

    Set this to True to remove all double quotes from the returned value.

  • allow_empty (bool, default: False ) –

    Set this to True if an empty return string is permitted.

Returns:
  • str

    The results of the query.

Raises:
  • Error

    An error occurred while sending the command.

  • SystemError

    An empty string was returned from the device.

query_binary

query_binary(
    query: str,
    verbose: bool = True,
    datatype: BINARY_DATATYPES = "f",
    is_big_endian: bool = False,
    container: type[T] | Callable[[Iterable[Any]], T] = list,
    delay: float | None = None,
    header_fmt: BINARY_HEADERS = "ieee",
    expect_termination: bool = True,
    data_points: int = 0,
    chunk_size: int | None = None,
) -> T

Send a query to the device and return the binary values.

Parameters:
  • query (str) –

    The query to send to the device.

  • verbose (bool, default: True ) –

    Set this to False in order to disable printouts.

  • datatype (BINARY_DATATYPES, default: 'f' ) –

    Format string for a single element. See struct module. ‘h’ by default.

  • is_big_endian (bool, default: False ) –

    Are the data in big or little endian order. Defaults to False.

  • container (type[T] | Callable[[Iterable[Any]], T], default: list ) –

    Container type to use for the output data. Possible values are: list, tuple, np.ndarray, etc. Default to list.

  • delay (float | None, default: None ) –

    Delay in seconds between write and read operations. If None, defaults to self.query_delay.

  • header_fmt (BINARY_HEADERS, default: 'ieee' ) –

    Format of the header prefixing the data. Defaults to ‘ieee’.

  • expect_termination (bool, default: True ) –

    When set to False, the expected length of the binary values block does not account for the final termination character (the read termination). Defaults to True.

  • data_points (int, default: 0 ) –

    Number of points expected in the block. This is used only if the instrument does not report it itself. This will be converted in a number of bytes based on the datatype. Defaults to 0.

  • chunk_size (int | None, default: None ) –

    Size of the chunks to read from the device. Using larger chunks may be faster for large amount of data.

Returns:
  • T

    The results of the query.

Raises:
  • Error

    An error occurred while sending the command.

  • SystemError

    An empty string was returned from the device.

query_expect_timeout

query_expect_timeout(invalid_command: str, timeout_ms: int = 200, verbose: bool = True) -> str

Send a query expecting it to time out and fail.

Parameters:
  • invalid_command (str) –

    The bad command to query.

  • timeout_ms (int, default: 200 ) –

    The VISA timeout duration for this function (in milliseconds).

  • verbose (bool, default: True ) –

    A flag to decide if we should print out a message indicating what query was sent.

Returns:
  • str

    The timeout error or the response to the query.

Raises:
  • Error

    Any non-timeout error will be re-raised.

query_less_than

query_less_than(
    query: str,
    value: float | str,
    tolerance: float = 0,
    percentage: bool = False,
    allow_equal: bool = False,
) -> bool

Send the given query and verify the result is less than the expected response.

Parameters:
  • query (str) –

    The command that is being checked.

  • value (float | str) –

    The expected value of the query.

  • tolerance (float, default: 0 ) –

    The acceptable difference between two floating point values.

  • percentage (bool, default: False ) –

    A boolean indicating what kind of tolerance check to perform. False means absolute tolerance: +/- tolerance. True means percent tolerance: +/- (tolerance / 100) * value.

  • allow_equal (bool, default: False ) –

    A boolean indicating if equal results should be allowed.

Returns:
  • bool

    Boolean indicating whether the check passed or failed.

query_raw_binary

query_raw_binary(query: str, verbose: bool = True) -> bytes

Send a command to the device and then read and return the raw binary values.

Parameters:
  • query (str) –

    The query to send to the device.

  • verbose (bool, default: True ) –

    Set this to False in order to disable printouts.

Returns:
  • bytes

    The raw results of the query.

Raises:
  • Error

    An error occurred while sending the command.

  • SystemError

    An empty string was returned from the device.

query_response

query_response(
    query: str,
    value: str | float,
    tolerance: float = 0,
    percentage: bool = False,
    remove_quotes: bool = False,
    custom_message_prefix: str = "",
    allow_empty: bool = False,
) -> tuple[bool, str]

Query the device and verify the result.

Parameters:
  • query (str) –

    The query that is being checked.

  • value (str | float) –

    The expected value of the query.

  • tolerance (float, default: 0 ) –

    The acceptable difference between two floating point values.

  • percentage (bool, default: False ) –

    A boolean indicating what kind of tolerance check to perform. False means absolute tolerance: +/- tolerance. True means percent tolerance: +/- (tolerance / 100) * value.

  • remove_quotes (bool, default: False ) –

    Set this to True to remove all double quotes from the returned value.

  • custom_message_prefix (str, default: '' ) –

    A custom message to be prepended to the failure message.

  • allow_empty (bool, default: False ) –

    Set this to True if an empty return string is permitted.

Returns:
  • tuple[bool, str]

    Tuple containing the boolean verification result and the value returned from the query.

query_response_not

query_response_not(
    query: str, value: str, remove_quotes: bool = False, custom_message_prefix: str = ""
) -> tuple[bool, str]

Query the device and verify the result is not the given value.

Parameters:
  • query (str) –

    The query that is being checked.

  • value (str) –

    The value that the query should not return.

  • remove_quotes (bool, default: False ) –

    Set this to True to remove all double quotes from the returned value.

  • custom_message_prefix (str, default: '' ) –

    A custom message to be prepended to the failure message.

Returns:
  • tuple[bool, str]

    Tuple containing the boolean verification result and the value returned from the query.

read

read() -> str

Return the read results from the VISA resource.

read_raw

read_raw(size: int | None = None) -> bytes

Return the read_raw results from the VISA resource.

Parameters:
  • size (int | None, default: None ) –

    The chunk size to use to perform the reading. Defaults to None, meaning the resource wide set value is set.

Returns:
  • bytes

    The bytes read from the device.

reboot

reboot(quiet_period: int = 0) -> bool

Reboot the device and reconnect all its used resources and components.

Parameters:
  • quiet_period (int, default: 0 ) –

    Optional sleep after the reboot in seconds.

Returns:
  • bool

    A boolean representing the status of the reboot.

recall_reference

recall_reference(reference_path: str, ref_number: int | str) -> None

Recall a reference waveform file.

Parameters:
  • reference_path (str) –

    The path to the reference waveform file.

  • ref_number (int | str) –

    The REF number to recall the waveform to.

recall_session

recall_session(session_path: str) -> None

Recall a session file.

Parameters:
  • session_path (str) –

    The path to the session file.

reset

reset() -> None

Send the *RST command followed by an *OPC? query.

*RST only resets the programmable interface settings, it does not change the user interface settings.

reset_visa_timeout

reset_visa_timeout() -> None

Reset the VISA timeout to the default value.

save_screenshot

save_screenshot(
    filename: str | PathLike[str] | None = None,
    *,
    colors: str | None = None,
    view_type: str | None = None,
    local_folder: str | PathLike[str] = "./",
    device_folder: str | PathLike[str] = "./",
    keep_device_file: bool = False
) -> None

Capture a screenshot from the device and save it locally.

Parameters:
  • filename (str | PathLike[str] | None, default: None ) –

    The name of the file to save the screenshot as. Defaults to a timestamped name using the first valid image extension.

  • colors (str | None, default: None ) –

    The color scheme to use for the screenshot. (Not used by all devices)

  • view_type (str | None, default: None ) –

    The type of view to capture. (Not used by all devices)

  • local_folder (str | PathLike[str], default: './' ) –

    The local folder to save the screenshot in. Defaults to “./”.

  • device_folder (str | PathLike[str], default: './' ) –

    The folder on the device to save the screenshot in. Defaults to “./”.

  • keep_device_file (bool, default: False ) –

    Whether to keep the file on the device after downloading it. Defaults to False.

save_waveform_to_reference

save_waveform_to_reference(waveform: str, reference: str) -> None

Save the specified waveform to a reference.

This uses a workaround by saving the waveform to a file and then recalling that file to a reference because the PI command :SAVE:WAVEFORM CH1,REF1 is not available currently. If it gets added later this function should be updated. Recalling a file to a ref turns on ref, so :REF:ADDNEW is not needed.

Parameters:
  • waveform (str) –

    The name of the waveform to save, e.g. CH1, MATH1, etc.

  • reference (str) –

    The name of the target reference, e.g. REF1.

set_and_check

set_and_check(
    command: str,
    value: str | float,
    tolerance: float = 0,
    percentage: bool = False,
    remove_quotes: bool = False,
    custom_message_prefix: str = "",
    *,
    expected_value: str | float | None = None,
    opc: bool = False
) -> str

Send the given command with the given value and then verify the results.

Parameters:
  • command (str) –

    The command to send. For example: :AFG:FUNCTION

  • value (str | float) –

    The value being set by the command. For example: SINE

  • tolerance (float, default: 0 ) –

    The acceptable difference between two floating point values.

  • percentage (bool, default: False ) –

    A boolean indicating what kind of tolerance check to perform. False means absolute tolerance: +/- tolerance. True means percent tolerance: +/- (tolerance / 100) * value.

  • remove_quotes (bool, default: False ) –

    Set this to True to remove all double quotes from the returned value.

  • custom_message_prefix (str, default: '' ) –

    A custom message to be prepended to the failure message.

  • expected_value (str | float | None, default: None ) –

    An optional, alternative value expected to be returned.

  • opc (bool, default: False ) –

    Boolean indicating if *OPC? should be queried after sending the command.

Returns:
  • str

    The output of the query portion of the method.

set_if_needed

set_if_needed(
    command: str,
    value: str | float,
    tolerance: float = 0,
    percentage: bool = False,
    remove_quotes: bool = False,
    custom_message_prefix: str = "",
    *,
    expected_value: str | float | None = None,
    opc: bool = False,
    allow_empty: bool = False,
    verify_value: bool = False
) -> tuple[bool, str]

Query the command’s field and update it if the value does not match the input.

Parameters:
  • command (str) –

    The command to send. For example: :AFG:FUNCTION

  • value (str | float) –

    The value being set by the command. For example: SINE

  • tolerance (float, default: 0 ) –

    The acceptable difference between two floating point values.

  • percentage (bool, default: False ) –

    A boolean indicating what kind of tolerance check to perform. False means absolute tolerance: +/- tolerance. True means percent tolerance: +/- (tolerance / 100) * value.

  • remove_quotes (bool, default: False ) –

    Set this to True to remove all double quotes from the returned value.

  • custom_message_prefix (str, default: '' ) –

    A custom message to be prepended to the failure message.

  • expected_value (str | float | None, default: None ) –

    An optional, alternative value expected to be returned.

  • opc (bool, default: False ) –

    Boolean indicating if *OPC? should be queried after sending the command.

  • allow_empty (bool, default: False ) –

    Set this to True if an empty return string is permitted.

  • verify_value (bool, default: False ) –

    Boolean indicating to verify value after write.

Returns:
  • tuple[bool, str]

    Tuple containing the boolean value indicating if the command needed to be set and the value returned from the query.

setup_burst

setup_burst(
    frequency: float,
    function: SignalGeneratorFunctionsIAFG,
    amplitude: float,
    offset: float,
    burst_count: int,
    channel: str = "all",
    output_signal_path: SignalGeneratorOutputPathsBase | None = None,
    termination: Literal["FIFTY", "HIGHZ"] = "FIFTY",
    duty_cycle: float = 50.0,
    polarity: Literal["NORMAL", "INVERTED"] = "NORMAL",
    symmetry: float = 50.0,
) -> None

Set up the Internal AFG for sending a burst of waveforms given the following parameters.

Parameters:
  • frequency (float) –

    The frequency of the waveform to generate.

  • function (SignalGeneratorFunctionsIAFG) –

    The function to generate.

  • amplitude (float) –

    The amplitude of the signal to generate.

  • offset (float) –

    The offset of the signal to generate.

  • burst_count (int) –

    The number of wavelengths to be generated.

  • channel (str, default: 'all' ) –

    Unused in this class.

  • output_signal_path (SignalGeneratorOutputPathsBase | None, default: None ) –

    Unused in this class.

  • termination (Literal['FIFTY', 'HIGHZ'], default: 'FIFTY' ) –

    The impedance to set the channel to.

  • duty_cycle (float, default: 50.0 ) –

    The duty cycle to set the signal to.

  • polarity (Literal['NORMAL', 'INVERTED'], default: 'NORMAL' ) –

    Unused in this class.

  • symmetry (float, default: 50.0 ) –

    The symmetry to set the signal to, only applicable to certain functions.

single_sequence

single_sequence() -> None

Perform a single sequence.

temporary_enable_verification

temporary_enable_verification(temporary_enable_verification: bool) -> Generator[None, None, None]

Enable (or disable) all verification of communication for the duration of the context.

This will temporarily set the Device.enable_verification property to the specified value, and then reset it to the previous value when the context exits.

Parameters:
  • temporary_enable_verification (bool) –

    The temporary verification value (True or False).

temporary_verbose

temporary_verbose(temporary_verbose: bool) -> Generator[None, None, None]

Set a temporary console output verbosity for the duration of the context.

This will reset the verbosity to the previous value when the context exits.

Parameters:
  • temporary_verbose (bool) –

    The temporary verbosity value.

temporary_visa_timeout

temporary_visa_timeout(temporary_timeout_ms: float) -> Generator[None, None, None]

Set a temporary VISA timeout value for the duration of the context.

This will reset the VISA timeout to the previous value when the context exits.

Parameters:
  • temporary_timeout_ms (float) –

    The temporary VISA timeout value, in milliseconds.

turn_all_channels_off

turn_all_channels_off() -> None

Turn all channels off.

turn_all_channels_on

turn_all_channels_on() -> None

Turn all channels on.

turn_channel_off

turn_channel_off(channel_str: str) -> None

Turn off the specified channel.

Parameters:
  • channel_str (str) –

    The name of the channel to turn off.

turn_channel_on

turn_channel_on(channel_str: str) -> None

Turn on the specified channel.

Parameters:
  • channel_str (str) –

    The name of the channel to turn on.

wait_for_network_connection

wait_for_network_connection(
    wait_time: float, sleep_seconds: int = 2, accept_immediate_connection: bool = False
) -> bool

Wait for a network connection to the device.

Parameters:
  • wait_time (float) –

    The number of seconds to wait for the network connection.

  • sleep_seconds (int, default: 2 ) –

    The number of seconds to sleep in between connection attempts.

  • accept_immediate_connection (bool, default: False ) –

    A boolean indicating if a connection on the first attempt is a valid connection.

Returns:
  • bool

    A boolean indicating if a network connection was made within the given time limit.

Raises:
  • AssertionError

    Indicating that the device erroneously connected on the first try.

wait_for_port_connection

wait_for_port_connection(
    port: int, wait_time: float, sleep_seconds: int = 5, accept_immediate_connection: bool = False
) -> bool

Wait for a connection to be made to the given port on the device.

Parameters:
  • port (int) –

    The port to check.

  • wait_time (float) –

    The maximum time to wait in seconds.

  • sleep_seconds (int, default: 5 ) –

    The number of seconds to sleep in between connection attempts.

  • accept_immediate_connection (bool, default: False ) –

    A boolean indicating if a connection on the first attempt is a valid connection.

Returns:
  • bool

    A boolean indicating if a connection was made to the port within the given time limit.

Raises:
  • AssertionError

    Indicating that the device erroneously connected on the first try.

wait_for_srq_event

wait_for_srq_event(timeout: int) -> WaitResponse

Wait for the service request event to happen, up to the given timeout.

Parameters:
  • timeout (int) –

    Time to wait (in seconds).

Returns:
  • WaitResponse

    The WaitResponse for the SRQ event.

wait_for_visa_connection

wait_for_visa_connection(
    wait_time: float, sleep_seconds: int = 5, accept_immediate_connection: bool = False
) -> bool

Wait for a VISA connection to be made to the device.

Parameters:
  • wait_time (float) –

    The maximum time to wait in seconds.

  • sleep_seconds (int, default: 5 ) –

    The number of seconds to sleep in between connection attempts.

  • accept_immediate_connection (bool, default: False ) –

    A boolean indicating if a connection on the first attempt is a valid connection.

Returns:
  • bool

    A boolean indicating if a VISA connection was made within the given time limit.

Raises:
  • AssertionError

    Indicating that the device erroneously connected on the first try.

write

write(command: str, opc: bool = False, verbose: bool = True) -> None

Write a command to the device.

Parameters:
  • command (str) –

    The command to write to the device

  • opc (bool, default: False ) –

    Boolean indicating if *OPC? should be queried after sending the command.

  • verbose (bool, default: True ) –

    Set this to False in order to disable printouts.

Raises:
  • Error

    An error occurred while sending the command.

  • SystemError

    *OPC? did not return “1” after sending the command.

write_raw

write_raw(command: bytes, verbose: bool = True) -> None

Write a raw command to the device.

Parameters:
  • command (bytes) –

    The command to write to the device

  • verbose (bool, default: True ) –

    Set this to False in order to disable printouts.

Raises:
  • Error

    An error occurred while sending the command.