devctrl.devices.oscilloscope.impl.rta4000.RTA4000#

class RTA4000(ip_address: str = '192.109.209.99', name: str | None = None)[source]#

Bases: Oscilloscope

Wrapper class for a Rohde & Schwarz RTA4000 series oscilloscope controlled via pyvisa.

Connect to an RTA4000 series oscilloscope via VXI-11 (LXI).

Parameters:
  • ip_address – IP address of the instrument

  • name – Optional display name of the device

Methods

add_device

Manually add a specific device.

allow_only_dummy_devices

connect

Connect a device of this class.

connect_device

Create an instance from a device name containing the IP address.

connect_dummy

Connect an instance of the device's dummy implementation

exit

Properly close the instrument connection

get_acquisition_time_s

get_base_classes

Return a flat dictionary of all base classes below this class

get_channel_count

get_device_name

get_device_type_name

get_status

Query the SCPI error queue of the instrument.

get_time_axis_s

Get the time axis matching get_waveform_V() of a channel.

get_waveform_V

Get the waveform of the last capture of a channel.

is_capture_ready

Query whether the data of the last capture can be retrieved.

is_connected

list_devices

Get a list of all devices for this type.

reset_averaging

Restart the average calculation, discarding all averaged waveforms so far.

set_acquisition_time_s

Set the time span acquired per capture.

set_average_count

Set the number of acquisitions averaged in hardware per capture.

set_channel_coupling

Set the input coupling of a channel.

set_channel_enabled

Enable or disable the input of a channel.

set_channel_offset_V

Set the vertical offset of a channel.

set_channel_range_V

Set the vertical range (full-scale voltage across all divisions) of a channel.

set_record_length

Set the number of samples per capture, disabling the automatic record length.

set_sample_rate

Set the sample rate, keeping the current acquisition time (the record length is adapted).

set_trigger_edge_V

Configure an edge trigger on an analog channel or the external trigger input.

set_trigger_free_run

Set whether the acquisition uses free-run (immediate/software) triggering.

start_capture

Start a capture.

stop_capture

Stop the acquisition and freeze the currently acquired data.

wait_for_capture

Wait until the capture has completed and the data can be retrieved.

_CLASS_TYPE = 'implementation'#
__abstractmethods__ = frozenset({})#
__annotations__ = {'_manual_devices': list[str]}#
__del__()[source]#
__dict__ = mappingproxy({'__module__': 'devctrl.devices.oscilloscope.impl.rta4000', '__firstlineno__': 13, '__doc__': '\nWrapper class for a Rohde & Schwarz RTA4000 series oscilloscope controlled via pyvisa.\n', '_CLASS_TYPE': 'implementation', '__init__': <function RTA4000.__init__>, '_parse_channel_count': <function RTA4000._parse_channel_count>, 'is_connected': <function RTA4000.is_connected>, 'get_status': <function RTA4000.get_status>, '_enumerate_devices': <classmethod(<function RTA4000._enumerate_devices>)>, 'connect_device': <classmethod(<function RTA4000.connect_device>)>, '__repr__': <function RTA4000.__repr__>, '__del__': <function RTA4000.__del__>, 'exit': <function RTA4000.exit>, 'get_channel_count': <function RTA4000.get_channel_count>, 'set_channel_enabled': <function RTA4000.set_channel_enabled>, 'set_channel_range_V': <function RTA4000.set_channel_range_V>, 'set_channel_coupling': <function RTA4000.set_channel_coupling>, 'set_channel_offset_V': <function RTA4000.set_channel_offset_V>, 'set_acquisition_time_s': <function RTA4000.set_acquisition_time_s>, 'get_acquisition_time_s': <function RTA4000.get_acquisition_time_s>, 'set_record_length': <function RTA4000.set_record_length>, 'set_trigger_edge_V': <function RTA4000.set_trigger_edge_V>, 'set_average_count': <function RTA4000.set_average_count>, 'reset_averaging': <function RTA4000.reset_averaging>, 'start_capture': <function RTA4000.start_capture>, 'stop_capture': <function RTA4000.stop_capture>, 'is_capture_ready': <function RTA4000.is_capture_ready>, 'get_waveform_V': <function RTA4000.get_waveform_V>, 'get_time_axis_s': <function RTA4000.get_time_axis_s>, '__static_attributes__': ('_average_count', '_channel_count', '_dev', '_ip_address', '_name'), '__abstractmethods__': frozenset(), '_abc_impl': <_abc._abc_data object>, '_children': {}, '_manual_devices': []})#
__firstlineno__ = 13#
__init__(ip_address: str = '192.109.209.99', name: str | None = None)[source]#

Connect to an RTA4000 series oscilloscope via VXI-11 (LXI).

Parameters:
  • ip_address – IP address of the instrument

  • name – Optional display name of the device

__module__ = 'devctrl.devices.oscilloscope.impl.rta4000'#
__repr__()[source]#
Returns:

The name of the device. If applicable, this should include serial port, GPIB address, etc.

__slots__ = ()#
__static_attributes__ = ('_average_count', '_channel_count', '_dev', '_ip_address', '_name')#
__weakref__#

list of weak references to the object

_abc_impl = <_abc._abc_data object>#
_children = {}#
_dummies_only = False#
classmethod _enumerate_devices() → list[str][source]#

Return an empty list, since network instruments are addressed by IP address instead of enumerated.

_manual_devices: list[str] = []#
_parse_channel_count(idn: str) → int[source]#

Determine the number of analog input channels from the identification, e.g. RTA4004 -> 4.

Parameters:

idn – Response of a *IDN? query

Returns:

Number of analog input channels, 4 if the model number could not be parsed

classmethod add_device(connect_info)#

Manually add a specific device. The device will show up when list_devices() is called for the device type. Call this from the device class implementation, e.g. use ModelXYZ9000.add_device('GPIB:1234:5678') to add a specific device with a fixed GPIB address. This is useful when automatic discovery is undesired/impossible, either because it is not implemented or it disturbs other devices which can’t handle a identification request. :param cls: The device implementation class :param connect_info: A string argument that is passed to the connect() method of the device implementation, when the device is being connected.

static allow_only_dummy_devices()#
classmethod connect(device_type_name: str, device_name: str | None, **kwargs) → Device#

Connect a device of this class.

Parameters:
  • device_type_name – The name of the device class

  • device_name – The name of the device class

classmethod connect_device(device_name: str, **kwargs) → RTA4000[source]#

Create an instance from a device name containing the IP address.

Parameters:
  • device_name – Device name with the IP address given as ‘ip=<address>’

  • kwargs – Additional keyword arguments passed to the constructor

Returns:

A connected RTA4000 instance

classmethod connect_dummy(**kwargs) → Device#

Connect an instance of the device’s dummy implementation

exit() → None[source]#

Properly close the instrument connection

get_acquisition_time_s() → float[source]#
Returns:

Actual (coerced) acquisition time in seconds

classmethod get_base_classes(recurse=True) → dict[str, type[Device]]#

Return a flat dictionary of all base classes below this class

Parameters:

recurse – If True, recursively search for base classes

Returns:

dict of {class name: class}

get_channel_count() → int[source]#
Returns:

Number of analog input channels

classmethod get_device_name() → str#
Returns:

The specific type name of the device, e.g., SR830 or Keithly2600

classmethod get_device_type_name() → str#
Returns:

The general type name of the device, e.g., Oscilloscope

get_status() → str[source]#

Query the SCPI error queue of the instrument.

Each query pops one entry from the queue, so a clean readout also clears it.

Returns:

All queued errors in the format <code>,"<message>", joined by ‘; ‘, or ‘’ if the instrument reports no errors

get_time_axis_s(channel: int) → ndarray[source]#

Get the time axis matching get_waveform_V() of a channel.

The axis is relative to the trigger: 0 s is the trigger position, negative values are pre-trigger samples.

Parameters:

channel – Channel number (1-based)

Returns:

Time axis in seconds

get_waveform_V(channel: int) → ndarray[source]#

Get the waveform of the last capture of a channel.

The data is transferred as IEEE 754 single precision floats in volt. Call stop_capture() before retrieving data, since all samples of the record are only available while the acquisition is stopped.

Parameters:

channel – Channel number (1-based)

Returns:

Waveform in volt

is_capture_ready() → bool[source]#

Query whether the data of the last capture can be retrieved.

Returns:

True if the acquisition has completed or was stopped, False while it is still running

is_connected() → bool[source]#
Returns:

True if the instrument responds to a *IDN? query

classmethod list_devices() → list[tuple[str, str]]#

Get a list of all devices for this type.

The list made up of:

  • Manually added devices

  • Available devices (those returned by _enumerate_devices)

  • A dummy device (if a dummy implementation exists)

  • List of all devices of child classes

Returns:

list of available devices

reset_averaging() → None[source]#

Restart the average calculation, discarding all averaged waveforms so far.

set_acquisition_time_s(seconds: float) → None[source]#

Set the time span acquired per capture. The sample rate is adapted accordingly.

Parameters:

seconds – Acquisition time in seconds

set_average_count(count: int) → None[source]#

Set the number of acquisitions averaged in hardware per capture.

With count 1, each capture is a single acquisition (acquisition type REFresh). With count > 1, start_capture() continuously runs a hardware-averaged acquisition.

Parameters:

count – Number of acquisitions to average, 1 to disable averaging

Raises:

ValueError – If the count is smaller than 1

set_channel_coupling(channel: int, coupling: str) → None[source]#

Set the input coupling of a channel.

Note that ‘DC’ connects the signal directly with 50 Ω termination, while ‘DCLimit’ and ‘AC’ use the 1 MΩ input.

Parameters:
  • channel – Channel number (1-based)

  • coupling – ‘DC’ (50 Ω), ‘DCLimit’ (1 MΩ, DC), ‘AC’ (1 MΩ, AC-coupled) or ‘GND’

Raises:

ValueError – If the coupling is not supported

set_channel_enabled(channel: int, enabled: bool = True) → None[source]#

Enable or disable the input of a channel.

Parameters:
  • channel – Channel number (1-based)

  • enabled – True to enable the channel input, False to disable it

set_channel_offset_V(channel: int, offset_V: float) → None[source]#

Set the vertical offset of a channel.

Parameters:
  • channel – Channel number (1-based)

  • offset_V – Offset in volt

set_channel_range_V(channel: int, range_V: float) → None[source]#

Set the vertical range (full-scale voltage across all divisions) of a channel.

Parameters:
  • channel – Channel number (1-based)

  • range_V – Full-scale range in volt

set_record_length(points: int) → None[source]#

Set the number of samples per capture, disabling the automatic record length.

The instrument coerces the record length to the next supported value.

Parameters:

points – Record length in samples

set_sample_rate(sample_rate_Hz: float) → None#

Set the sample rate, keeping the current acquisition time (the record length is adapted).

Parameters:

sample_rate_Hz – Sample rate in Hz

set_trigger_edge_V(source: int | str, level_V: float, slope: str = 'rising') → None[source]#

Configure an edge trigger on an analog channel or the external trigger input.

The trigger level is set on the input selected by source, since the level command addresses the trigger inputs individually (1..4 analog channels, 5 external input).

Parameters:
  • source – Trigger source, either a channel number (1-based) or ‘external’

  • level_V – Trigger level in volt

  • slope – Trigger slope, ‘rising’ or ‘falling’

Raises:

ValueError – If the source or slope is invalid

set_trigger_free_run(enabled: bool) → None#

Set whether the acquisition uses free-run (immediate/software) triggering.

With free-run enabled, each start_capture() begins acquiring immediately, without waiting for a trigger edge on a channel or the external input, i.e. continuous trigger mode that needs no trigger input. With free-run disabled (the default), the configured edge trigger (set_trigger_edge_V()) applies.

Parameters:

enabled – True to trigger immediately on every capture, False to use the edge trigger.

Raises:

NotImplementedError – If the device does not support disabling the trigger.

start_capture() → None[source]#

Start a capture.

With average count 1, starts a single acquisition and blocks until it has completed. Otherwise, restarts and continuously runs the averaged acquisition; use is_capture_ready() to check for completion.

stop_capture() → None[source]#

Stop the acquisition and freeze the currently acquired data.

wait_for_capture(timeout: float | None = None) → None#

Wait until the capture has completed and the data can be retrieved.

When hardware averaging is active, it is recommended to call stop_capture() before retrieving the data, since some devices deliver stale data or raise errors when read out while still acquiring.

Parameters:

timeout – Timeout in seconds, or None to wait indefinitely

Raises:

TimeoutError – If the capture is not ready within the timeout