hvl_ccb.dev.rs_rto1024.rs_rto1024

Inheritance diagram of hvl_ccb.dev.rs_rto1024.rs_rto1024

Python module for the Rhode & Schwarz RTO 1024 oscilloscope. The communication to the device is through VISA, type TCPIP / INSTR.

class RTO1024(com: RTO1024VisaCommunication | RTO1024VisaCommunicationConfig | dict, dev_config: RTO1024Config | dict)[source]

Bases: VisaDevice

Device class for the Rhode & Schwarz RTO 1024 oscilloscope.

class TriggerModes(value=<no_arg>, names=None, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: AutoNumberNameEnum

Enumeration for the three available trigger modes.

AUTO = 1
FREERUN = 3
NORMAL = 2
classmethod names()[source]

Returns a list of the available trigger modes. :return: list of strings

activate_measurements(meas_n: int, source: str, measurements: list[str], category: str = 'AMPTime')[source]

Activate the list of ‘measurements’ of the waveform ‘source’ in the measurement box number ‘meas_n’. The list ‘measurements’ starts with the main measurement and continues with additional measurements of the same ‘category’.

Parameters:
  • meas_n – measurement number 1..8

  • source – measurement source, for example C1W1

  • measurements – list of measurements, the first one will be the main measurement.

  • category – the category of measurements, by default AMPTime

backup_waveform(filename: str) None[source]

Backup a waveform file from the standard directory specified in the device configuration to the standard backup destination specified in the device configuration. The filename has to be specified without .bin or path.

Parameters:

filename – The waveform filename without extension and path

static config_cls()[source]

Return the default configdataclass class.

Returns:

a reference to the default configdataclass class

static default_com_cls()[source]

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

Returns:

the VisaCommunication class

file_copy(source: str, destination: str) None[source]

Copy a file from one destination to another on the oscilloscope drive. If the destination file already exists, it is overwritten without notice.

Parameters:
  • source – absolute path to the source file on the DSO filesystem

  • destination – absolute path to the destination file on the DSO filesystem

Raises:

RTO1024Error – if the operation did not complete

get_acquire_length() float[source]

Gets the time of one acquisition, that is the time across the 10 divisions of the diagram.

  • Range: 250E-12 … 500 [s]

  • Increment: 1E-12 [s]

Returns:

the time for one acquisition. Range: 250e-12 … 500 [s]

get_channel_offset(channel: int) float[source]

Gets the voltage offset of the indicated channel.

Parameters:

channel – is the channel number (1..4)

Returns:

channel offset voltage in V (value between -1 and 1)

get_channel_position(channel: int) float[source]

Gets the vertical position of the indicated channel.

Parameters:

channel – is the channel number (1..4)

Returns:

channel position in div (value between -5 and 5)

get_channel_range(channel: int) float[source]

Queries the channel range in V.

Parameters:

channel – is the input channel (1..4)

Returns:

channel range in V

get_channel_scale(channel: int) float[source]

Queries the channel scale in V/div.

Parameters:

channel – is the input channel (1..4)

Returns:

channel scale in V/div

get_channel_state(channel: int) bool[source]

Queries if the channel is active or not.

Parameters:

channel – is the input channel (1..4)

Returns:

True if active, else False

get_reference_point() int[source]

Gets the reference point of the time scale in % of the display. If the “Trigger offset” is zero, the trigger point matches the reference point. ReferencePoint = zero pint of the time scale

  • Range: 0 … 100 [%]

  • Increment: 1 [%]

Returns:

the reference in %

get_repetitions() int[source]

Get the number of acquired waveforms with RUN Nx SINGLE. Also defines the number of waveforms used to calculate the average waveform.

  • Range: 1 … 16777215

  • Increment: 10

  • *RST = 1

Returns:

the number of waveforms to acquire

get_timestamps() list[float][source]

Gets the timestamps of all recorded frames in the history and returns them as a list of floats.

Returns:

list of timestamps in [s]

Raises:

RTO1024Error – if the timestamps are invalid

list_directory(path: str) list[tuple[str, str, int]][source]

List the contents of a given directory on the oscilloscope filesystem.

Parameters:

path – is the path to a folder

Returns:

a list of filenames in the given folder

load_configuration(filename: str) None[source]

Load current settings from a configuration file. The filename has to be specified without base directory and ‘.dfl’ extension.

Information from the manual ReCaLl calls up the instrument settings from an intermediate memory identified by the specified number. The instrument settings can be stored to this memory using the command *SAV with the associated number. It also activates the instrument settings which are stored in a file and loaded using MMEMory:LOAD:STATe .

Parameters:

filename – is the name of the settings file without path and extension

local_display(state: bool) None[source]

Enable or disable local display of the scope.

Parameters:

state – is the desired local display state

prepare_ultra_segmentation() None[source]

Make ready for a new acquisition in ultra segmentation mode. This function does one acquisition without ultra segmentation to clear the history and prepare for a new measurement.

read_measurement(meas_n: int, name: str) float[source]
Parameters:
  • meas_n – measurement number 1..8

  • name – measurement name, for example “MAX”

Returns:

measured value

run_continuous_acquisition() None[source]

Start acquiring continuously.

run_single_acquisition() None[source]

Start a single or Nx acquisition.

save_configuration(filename: str) None[source]

Save the current oscilloscope settings to a file. The filename has to be specified without path and ‘.dfl’ extension, the file will be saved to the configured settings directory.

Information from the manual SAVe stores the current instrument settings under the specified number in an intermediate memory. The settings can be recalled using the command *RCL with the associated number. To transfer the stored instrument settings to a file, use MMEMory:STORe:STATe .

Parameters:

filename – is the name of the settings file without path and extension

save_waveform_history(filename: str, channel: int, waveform: int = 1) None[source]

Save the history of one channel and one waveform to a .bin file. This function is used after an acquisition using sequence trigger mode (with or without ultra segmentation) was performed.

Parameters:
  • filename – is the name (without extension) of the file

  • channel – is the channel number

  • waveform – is the waveform number (typically 1)

Raises:

RTO1024Error – if storing waveform times out

set_acquire_length(timerange: float) None[source]

Defines the time of one acquisition, that is the time across the 10 divisions of the diagram.

  • Range: 250E-12 … 500 [s]

  • Increment: 1E-12 [s]

  • *RST = 0.5 [s]

Parameters:

timerange – is the time for one acquisition. Range: 250e-12 … 500 [s]

set_channel_offset(channel: int, offset: float) None[source]

Sets the voltage offset of the indicated channel.

  • Range: Dependent on the channel scale and coupling [V]

  • Increment: Minimum 0.001 [V], may be higher depending on the channel scale and coupling

  • *RST = 0

Parameters:
  • channel – is the channel number (1..4)

  • offset – Offset voltage. Positive values move the waveform down, negative values move it up.

set_channel_position(channel: int, position: float) None[source]

Sets the vertical position of the indicated channel as a graphical value.

  • Range: -5.0 … 5.0 [div]

  • Increment: 0.02

  • *RST = 0

Parameters:
  • channel – is the channel number (1..4)

  • position – is the position. Positive values move the waveform up, negative values move it down.

set_channel_range(channel: int, v_range: float) None[source]

Sets the voltage range across the 10 vertical divisions of the diagram. Use the command alternatively instead of set_channel_scale.

  • Range for range: Depends on attenuation factors and coupling. With 1:1 probe and external attenuations and 50 Ω input coupling, the range is 10 mV to 10 V. For 1 MΩ input coupling, it is 10 mV to 100 V. If the probe and/or external attenuation is changed, multiply the range values by the attenuation factors.

  • Increment: 0.01

  • *RST = 0.5

Parameters:
  • channel – is the channel number (1..4)

  • v_range – is the vertical range [V]

set_channel_scale(channel: int, scale: float) None[source]

Sets the vertical scale for the indicated channel. The scale value is given in volts per division.

  • Range for scale: depends on attenuation factor and coupling. With 1:1 probe and external attenuations and 50 Ω input coupling, the vertical scale (input sensitivity) is 1 mV/div to 1 V/div. For 1 MΩ input coupling, it is 1 mV/div to 10 V/div. If the probe and/or external attenuation is changed, multiply the values by the attenuation factors to get the actual scale range.

  • Increment: 1e-3

  • *RST = 0.05

See also: set_channel_range

Parameters:
  • channel – is the channel number (1..4)

  • scale – is the vertical scaling [V/div]

set_channel_state(channel: int, state: bool) None[source]

Switches the channel signal on or off.

Parameters:
  • channel – is the input channel (1..4)

  • state – is True for on, False for off

set_reference_point(percentage: int) None[source]

Sets the reference point of the time scale in % of the display. If the “Trigger offset” is zero, the trigger point matches the reference point. ReferencePoint = zero pint of the time scale

  • Range: 0 … 100 [%]

  • Increment: 1 [%]

  • *RST = 50 [%]

Parameters:

percentage – is the reference in %

set_repetitions(number: int) None[source]

Set the number of acquired waveforms with RUN Nx SINGLE. Also defines the number of waveforms used to calculate the average waveform.

  • Range: 1 … 16777215

  • Increment: 10

  • *RST = 1

Parameters:

number – is the number of waveforms to acquire

set_trigger_level(channel: int, level: float, event_type: int = 1) None[source]

Sets the trigger level for the specified event and source.

  • Range: -10 to 10 V

  • Increment: 1e-3 V

  • *RST = 0 V

Parameters:
  • channel

    indicates the trigger source.

    • 1..4 = channel 1 to 4, available for all event types 1..3

    • 5 = external trigger input on the rear panel for analog signals, available for A-event type = 1

    • 6..9 = not available

  • level – is the voltage for the trigger level in [V].

  • event_type – is the event type. 1: A-Event, 2: B-Event, 3: R-Event

set_trigger_mode(mode: str | TriggerModes) None[source]

Sets the trigger mode which determines the behavior of the instrument if no trigger occurs.

Parameters:

mode – is either auto, normal, or freerun.

Raises:

RTO1024Error – if an invalid triggermode is selected

set_trigger_source(channel: int, event_type: int = 1) None[source]

Set the trigger (Event A) source channel.

Parameters:
  • channel – is the channel number (1..4)

  • event_type – is the event type. 1: A-Event, 2: B-Event, 3: R-Event

start() None[source]

Start the RTO1024 oscilloscope and bring it into a defined state and remote mode.

stop() None[source]

Stop the RTO1024 oscilloscope, reset events and close communication. Brings back the device to a state where local operation is possible.

stop_acquisition() None[source]

Stop any acquisition.

class RTO1024Config(waveforms_path: str, settings_path: str, backup_path: str, spoll_interval: int | float = 0.5, spoll_start_delay: int | float = 2, command_timeout_seconds: int | float = 60, wait_sec_short_pause: int | float = 0.1, wait_sec_enable_history: int | float = 1, wait_sec_post_acquisition_start: int | float = 2)[source]

Bases: VisaDeviceConfig, _RTO1024ConfigDefaultsBase, _RTO1024ConfigBase

Configdataclass for the RTO1024 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.

exception RTO1024Error[source]

Bases: DeviceError

class RTO1024VisaCommunication(configuration)[source]

Bases: VisaCommunication

Specialization of VisaCommunication for the RTO1024 oscilloscope

static config_cls()[source]

Return the default configdataclass class.

Returns:

a reference to the default configdataclass class

class RTO1024VisaCommunicationConfig(host: str | ~ipaddress.IPv4Address | ~ipaddress.IPv6Address, interface_type: str | ~hvl_ccb.comm.visa.VisaCommunicationConfig.InterfaceType = <InterfaceType.TCPIP_INSTR: 2>, board: int = 0, port: int = 5025, timeout: int = 5000, chunk_size: int = 204800, open_timeout: int = 1000, write_termination: str = '\n', read_termination: str = '\n', visa_backend: str = '')[source]

Bases: VisaCommunicationConfig

Configuration dataclass for VisaCommunication with specifications for the RTO1024 device class.

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

interface_type: str | InterfaceType = 2

Interface type of the VISA connection, being one of InterfaceType.

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.