hvl_ccb.dev.visa

digraph inheritance07878e4e4d { bgcolor=transparent; rankdir=TB; size=""; "ABC" [fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",tooltip="Helper class that provides a standard way to create an ABC using"]; "ConfigurationMixin" [URL="../hvl_ccb.configuration.html#hvl_ccb.configuration.ConfigurationMixin",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Mixin providing configuration to a class."]; "ABC" -> "ConfigurationMixin" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Device" [URL="../hvl_ccb.dev.base.html#hvl_ccb.dev.base.Device",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Base class for devices. Implement this class for a concrete device,"]; "ConfigurationMixin" -> "Device" [arrowsize=0.5,style="setlinewidth(0.5)"]; "ABC" -> "Device" [arrowsize=0.5,style="setlinewidth(0.5)"]; "SingleCommDevice" [URL="../hvl_ccb.dev.base.html#hvl_ccb.dev.base.SingleCommDevice",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Base class for devices with a single communication protocol."]; "Device" -> "SingleCommDevice" [arrowsize=0.5,style="setlinewidth(0.5)"]; "ABC" -> "SingleCommDevice" [arrowsize=0.5,style="setlinewidth(0.5)"]; "VisaDevice" [URL="../hvl_ccb.dev.visa.html#hvl_ccb.dev.visa.VisaDevice",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Device communicating over the VISA protocol using VisaCommunication."]; "SingleCommDevice" -> "VisaDevice" [arrowsize=0.5,style="setlinewidth(0.5)"]; "VisaDeviceConfig" [URL="../hvl_ccb.dev.visa.html#hvl_ccb.dev.visa.VisaDeviceConfig",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Configdataclass for a VISA device."]; }
class VisaDevice(com: VisaCommunication | VisaCommunicationConfig | dict, dev_config: VisaDeviceConfig | dict | None = None)[source]

Bases: SingleCommDevice

Device communicating over the VISA protocol using VisaCommunication.

static config_cls()[source]

Return the default configdataclass class.

Returns:

a reference to the default configdataclass class

static default_com_cls() type[hvl_ccb.comm.visa.VisaCommunication][source]

Return the default communication protocol for this device type, which is VisaCommunication.

Returns:

the VisaCommunication class

get_error_queue() str[source]

Read out error queue and logs the error.

Returns:

Error string

get_identification() str[source]

Queries “*IDN?” and returns the identification string of the connected device.

Returns:

the identification string of the connected device

reset() None[source]

Send “*RST” and “*CLS” to the device. Typically sets a defined state.

spoll_handler()[source]

Reads the status byte and decodes it. The status byte STB is defined in IEEE 488.2. It provides a rough overview of the instrument status.

Returns:

start() None[source]

Start the VisaDevice. Sets up the status poller and starts it.

Returns:

stop() None[source]

Stop the VisaDevice. Stops the polling thread and closes the communication protocol.

Returns:

wait_operation_complete(timeout: float | None = None) bool[source]

Waits for a operation complete event. Returns after timeout [s] has expired or the operation complete event has been caught.

Parameters:

timeout – Time in seconds to wait for the event; None for no timeout.

Returns:

True, if OPC event is caught, False if timeout expired

class VisaDeviceConfig(spoll_interval: int | float = 0.5, spoll_start_delay: int | float = 2)[source]

Bases: _VisaDeviceConfigDefaultsBase, _VisaDeviceConfigBase

Configdataclass for a VISA device.

force_value(fieldname, value)

Forces a value to a dataclass field despite the class being frozen.

NOTE: you can define post_force_value method with same signature as this method to do extra processing after value has been forced on fieldname.

Parameters:
  • fieldname – name of the field

  • value – value to assign

classmethod keys() Sequence[str]

Returns a list of all configdataclass fields key-names.

Returns:

a list of strings containing all keys.

classmethod optional_defaults() dict[str, object]

Returns a list of all configdataclass fields, that have a default value assigned and may be optionally specified on instantiation.

Returns:

a list of strings containing all optional keys.

classmethod required_keys() Sequence[str]

Returns a list of all configdataclass fields, that have no default value assigned and need to be specified on instantiation.

Returns:

a list of strings containing all required keys.