smu24xx_standard
¶
SMU24xxStandard device driver module.
SMU24xxStandard
¶
SMU24xxStandard(
config_entry: DeviceConfigEntry,
verbose: bool,
visa_resource: MessageBasedResource,
default_visa_timeout: int,
)
Bases: CommonPISystemErrorCheckMixin, PIControl, SourceMeasureUnit, ABC
Base SMU24xxStandard device driver.
| Parameters: |
|
|---|
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.
all_channel_names_list
property
¶
Return a tuple containing all the channel names.
command_argument_constants
cached
property
¶
command_argument_constants: Any
Return the device command argument constants.
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_verificationis set toFalse, then no verification will happen at all. - If
.enable_verificationis set toTrueand this property isTrue, then verification will happen for commands sent using the.commandsproperty of the device. - If
.enable_verificationis set toTrueand this property isFalse, then verification will not happen for commands sent using the.commandsproperty of the device.
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.
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_verificationis set toFalse, 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_verificationis set toTrue, 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.
ip_address
cached
property
¶
ip_address: str
Return the IPv4 address of the device or an empty string if unable to fetch that.
name_and_alias
cached
property
¶
name_and_alias: str
Return string for easy ID of device in console output prints.
series
cached
property
¶
series: str
Return the series of the device.
| Returns: |
|
|---|
total_channels
cached
property
¶
total_channels: int
Return the total number of channels (all types).
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_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_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: |
|---|
check_network_connection
¶
Check the network connection to the device using an external ping command.
Wrapper function for
check_network_connection.
| Returns: |
|---|
check_port_connection
¶
Check if the given port is open on the device.
Wrapper function for check_port_connection.
| Parameters: |
|---|
| Returns: |
|
|---|
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: |
|
|---|
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.
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: |
|
|---|
| Returns: |
|
|---|
| Raises: |
|
|---|
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:
*ESR0 (Event Status Enable Register)*SRE0 (Service Request Enable Register)- DESE 255 (Device Event Status Enable Register)
*PSC1 (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.
get_errors
¶
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: |
|
|---|
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: |
|
|---|
| Raises: |
|
|---|
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: |
|
|---|
| Returns: |
|
|---|
| Raises: |
|
|---|
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: |
|
|---|
| Returns: |
|
|---|
| Raises: |
|
|---|
query_expect_timeout
¶
Send a query expecting it to time out and fail.
| Parameters: |
|---|
| Returns: |
|
|---|
| Raises: |
|
|---|
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: |
|
|---|
| Returns: |
|
|---|
query_raw_binary
¶
Send a command to the device and then read and return the raw binary values.
| Parameters: |
|---|
| Returns: |
|
|---|
| Raises: |
|
|---|
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: |
|
|---|
| Returns: |
|---|
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: |
|
|---|
| Returns: |
|---|
read_raw
¶
reboot
¶
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.
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: |
|
|---|
| Returns: |
|
|---|
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: |
|
|---|
| Returns: |
|---|
temporary_enable_verification
¶
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_verbose
¶
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_visa_timeout
¶
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: |
|
|---|
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: |
|
|---|
| Returns: |
|
|---|
| Raises: |
|
|---|
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: |
|
|---|
| Returns: |
|
|---|
| Raises: |
|
|---|
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: |
|
|---|
| Returns: |
|
|---|
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: |
|---|
| Returns: |
|
|---|
| Raises: |
|
|---|
write
¶
Write a command to the device.
| Parameters: |
|---|
| Raises: |
|
|---|