RsNgx API Structure

class RsNgx(resource_name: str, id_query: bool = True, reset: bool = False, options: Optional[str] = None, direct_session: Optional[object] = None)[source]

289 total commands, 21 Subgroups, 1 group commands

Initializes new RsNgx session.

Parameter options tokens examples:
  • Simulate=True - starts the session in simulation mode. Default: False

  • SelectVisa=socket - uses no VISA implementation for socket connections - you do not need any VISA-C installation

  • SelectVisa=rs - forces usage of RohdeSchwarz Visa

  • SelectVisa=ivi - forces usage of National Instruments Visa

  • QueryInstrumentStatus = False - same as driver.utilities.instrument_status_checking = False. Default: True

  • WriteDelay = 20, ReadDelay = 5 - Introduces delay of 20ms before each write and 5ms before each read. Default: 0ms for both

  • OpcWaitMode = OpcQuery - mode for all the opc-synchronised write/reads. Other modes: StbPolling, StbPollingSlow, StbPollingSuperSlow. Default: StbPolling

  • AddTermCharToWriteBinBLock = True - Adds one additional LF to the end of the binary data (some instruments require that). Default: False

  • AssureWriteWithTermChar = True - Makes sure each command/query is terminated with termination character. Default: Interface dependent

  • TerminationCharacter = "\r" - Sets the termination character for reading. Default: \n (LineFeed or LF)

  • DataChunkSize = 10E3 - Maximum size of one write/read segment. If transferred data is bigger, it is split to more segments. Default: 1E6 bytes

  • OpcTimeout = 10000 - same as driver.utilities.opc_timeout = 10000. Default: 30000ms

  • VisaTimeout = 5000 - same as driver.utilities.visa_timeout = 5000. Default: 10000ms

  • ViClearExeMode = Disabled - viClear() execution mode. Default: execute_on_all

  • OpcQueryAfterWrite = True - same as driver.utilities.opc_query_after_write = True. Default: False

  • StbInErrorCheck = False - if true, the driver checks errors with *STB? If false, it uses SYST:ERR?. Default: True

  • LoggingMode = On - Sets the logging status right from the start. Default: Off

  • LoggingName = 'MyDevice' - Sets the name to represent the session in the log entries. Default: 'resource_name'

  • LogToGlobalTarget = True - Sets the logging target to the class-property previously set with RsNgx.set_global_logging_target() Default: False

  • LoggingToConsole = True - Immediately starts logging to the console. Default: False

  • LoggingToUdp = True - Immediately starts logging to the UDP port. Default: False

  • LoggingUdpPort = 49200 - UDP port to log to. Default: 49200

Parameters
  • resource_name – VISA resource name, e.g. ‘TCPIP::192.168.2.1::INSTR’

  • id_query – if True, the instrument’s model name is verified against the models supported by the driver and eventually throws an exception.

  • reset – Resets the instrument (sends *RST command) and clears its status sybsystem.

  • options – string tokens alternating the driver settings.

  • direct_session – Another driver object or pyVisa object to reuse the session instead of opening a new session.

class Measurement[source]

Response structure. Fields:

  • Voltage: float: No parameter help available

  • Current: float: No parameter help available

static assert_minimum_version(min_version: str) None[source]

Asserts that the driver version fulfills the minimum required version you have entered. This way you make sure your installed driver is of the entered version or newer.

classmethod clear_global_logging_relative_timestamp() None[source]

Clears the global relative timestamp. After this, all the instances using the global relative timestamp continue logging with the absolute timestamps.

close() None[source]

Closes the active RsNgx session.

classmethod from_existing_session(session: object, options: Optional[str] = None) RsNgx[source]

Creates a new RsNgx object with the entered ‘session’ reused.

Parameters
  • session – can be another driver or a direct pyvisa session.

  • options – string tokens alternating the driver settings.

classmethod get_global_logging_relative_timestamp() datetime[source]

Returns global common relative timestamp for log entries.

classmethod get_global_logging_target()[source]

Returns global common target stream.

get_persistent_channel() int[source]

Returns the current persistent channel. If the persistence is switched off, the method returns 0.

get_session_handle() object[source]

Returns the underlying session handle.

get_total_execution_time() timedelta[source]

Returns total time spent by the library on communicating with the instrument. This time is always shorter than get_total_time(), since it does not include gaps between the communication. You can reset this counter with reset_time_statistics().

get_total_time() timedelta[source]

Returns total time spent by the library on communicating with the instrument. This time is always shorter than get_total_time(), since it does not include gaps between the communication. You can reset this counter with reset_time_statistics().

static list_resources(expression: str = '?*::INSTR', visa_select: Optional[str] = None) List[str][source]
Finds all the resources defined by the expression
  • ‘?*’ - matches all the available instruments

  • ‘USB::?*’ - matches all the USB instruments

  • ‘TCPIP::192?*’ - matches all the LAN instruments with the IP address starting with 192

Parameters
  • expression – see the examples in the function

  • visa_select – optional parameter selecting a specific VISA. Examples: @ivi’, @rs

read() Measurement[source]
# SCPI: READ
value: Measurement = driver.read()

Queries for the next available readback for voltage and current of the selected channel.

return

structure: for return value, see the help for Measurement structure arguments.

reset_time_statistics() None[source]

Resets all execution and total time counters. Affects the results of get_total_time() and get_total_execution_time()

classmethod set_global_logging_relative_timestamp(timestamp: datetime) None[source]

Sets global common relative timestamp for log entries. To use it, call the following: io.utilities.logger.set_relative_timestamp_global()

classmethod set_global_logging_relative_timestamp_now() None[source]

Sets global common relative timestamp for log entries to this moment. To use it, call the following: io.utilities.logger.set_relative_timestamp_global().

classmethod set_global_logging_target(target) None[source]

Sets global common target stream that each instance can use. To use it, call the following: io.utilities.logger.set_logging_target_global(). If an instance uses global logging target, it automatically uses the global relative timestamp (if set). You can set the target to None to invalidate it.

set_persistent_channel(channel: int) None[source]

If set to 0 (default value), the driver behaves exactly as the SCPI interface - you can select the addressed channel with rsnrx.instrument.select.set(). If you set this property to 1 .. 8 (depending on how many channels your device has), the drivers makes sure that for each function you call, this channel is preselected, no matter which channel is currently active. In this mode you can not use the rsnrx.instrument.select.set()

Subgroups