scpi_commands

A collection of classes and other helpful objects to use when generating SCPI drivers.

THIS FILE IS AUTO-GENERATED, IT SHOULD NOT BE MANUALLY MODIFIED.

Please report an issue if one is found.

BaseSCPICmd

Bases: BaseCmd

A class to better type hint a member of a SCPI command tree.

DefaultDictDeviceCommunication

Bases: ParentDefaultDictClass

A custom default dictionary that can be used to send/receive commands to/from a device.

The .query() method is used when __getitem__() is called and the result of the query is returned instead of a standard value.

The .write() method is used when __setitem__() is called.

SCPICmdRead

Bases: BaseSCPICmd

A class defining a queryable SCPI command.

query

query() -> str

Return the result of the SCPI query.

Sends the query .cmd_syntax + '?'.

This method will query the device using the device.query() method and return the result after stripping out leading and trailing whitespace.

Returns:
  • str

    The query response from the device.

Raises:

verify

verify(value: float | str) -> tuple[bool, str]

Verify the return value from the SCPI query matches the value.

Sends the query .cmd_syntax + '?'.

This method will use the device.query_response() method to verify that the value returned by the device matches the expected value. An AssertionError will be raised by default if the values don’t match.

Parameters:
  • value (float | str) –

    The value to verify against the returned value from the device.

Returns:
  • bool

    A tuple containing a boolean indicating if the values match and a string with the actual

  • str

    return value from the device.

Raises:

SCPICmdReadWithArguments

Bases: BaseSCPICmd

A class defining a SCPI command that can be queried with arguments.

query

query(argument: str) -> str

Return the result of the SCPI query.

Sends the query .cmd_syntax + '? argument'.

This method will query the device using the device.query() method and return the result after stripping out leading and trailing whitespace.

Parameters:
  • argument (str) –

    The argument to send with the query.

Returns:
  • str

    The query response from the device.

Raises:

verify

verify(argument: str, value: float | str) -> tuple[bool, str]

Verify the return value from the SCPI query matches the value.

Sends the query .cmd_syntax + '? argument'.

This method will use the device.query_response() method to verify that the value returned by the device matches the expected value. An AssertionError will be raised by default if the values don’t match.

Parameters:
  • argument (str) –

    The argument to send with the query.

  • value (float | str) –

    The value to verify against the returned value from the device.

Returns:
  • bool

    A tuple containing a boolean indicating if the values match and a string with the actual

  • str

    return value from the device.

Raises:

SCPICmdWrite

Bases: BaseSCPICmd

A class defining a writable SCPI command.

write

write(value: float | str, verify: bool = False) -> str

Send the SCPI command (.cmd_syntax) with the provided value to the device.

Parameters:
  • value (float | str) –

    The value to write to the device.

  • verify (bool, default: False ) –

    A boolean indicating that device.set_and_check() should be used.

Returns:
  • str

    The value from the query when verification is enabled, otherwise an empty string.

Raises:

SCPICmdWriteNoArguments

Bases: BaseSCPICmd

A class defining a writable SCPI command which doesn’t have any arguments.

write

write() -> None

Send the SCPI command (.cmd_syntax) to the device.

This method will use the device.write() method to send the command.

Raises:

ValidatedChannel

Bases: BaseCmd

A mixin class that is used to validate the channel is valid.

This class checks the channel number (or string) at the end of the syntax (.cmd_syntax attribute) to determine if it is a valid channel number (within the range of the available channels on the device).

ValidatedDigitalBit

Bases: BaseSCPICmd

A mixin class that is used to validate the digital bit is valid.

This class checks the digital bit number at the end of the SCPI syntax (.cmd_syntax attribute) to determine if it is a valid digital bit number (within the range of 0 to the maximum number of digital bits on the device).