Facility
To begin, it is recommended to use Python version 3.8 and the PyCharm IDE, Community Edition. This configuration requires the Python RsInstrument module (version 1.55 or higher), as well as the R&S VISA.
The Python module RsInstrument can be installed or updated via PyPI, the Python package index. Once installed, users can harness the power of Python to control their Rohde & Schwarz oscilloscopes. Ready-to-use examples for oscilloscopes and other R&S instruments are available in our GitHub repository.
Additionally, we recommend using the R&S Instrument Control Pycharm plugin (RsIC). It is designed for Pycharm users to write remote instrument control scripts in Python. It is optimized for, but not exclusively designed for, use with our RsInstrument Python package.
One of the main advantages of using the RsInstrument Python module is the reduction in time spent testing the correct SCPI (Standard Commands for Programmable Instruments) sequences. The module ensures that parameters not explicitly specified use correct default values that comply with the specification. In the event of invalid parameters, an error handling procedure is triggered, providing a detailed exception message.
The RsInstrument Python module also includes an "Introduction" remote control example that uses Python in PyCharm: https://rsinstrument.readthedocs.io
By downloading the Python package, users agree to the Terms and Conditions of the royalty-free software. This allows Rohde & Schwarz to offer a robust and reliable solution for remotely controlling their oscilloscopes.

Instrument connection
To connect to a Rohde & Schwarz oscilloscope using the RsInstrument Python module, you first need to know the oscilloscope's IP address or hostname. This can be found in the oscilloscope's network settings. Once you have the IP address or hostname, you can establish a connection using the RsInstrument Python module. The connection is established by creating a new "RsInstrument" object, which takes the oscilloscope's IP address or hostname as a parameter.
Below is a simple example script that connects to the oscilloscope and retrieves the instrument identification string:
from RsInstrument import *
# Replace "192.168.1.100" with your oscilloscope's IP address
instr = RsInstrument("TCPIP::192.168.1.100::INSTR")
# Retrieve the instrument's ID string
idn_string = instr.query("*IDN?")
print(f'Connected to: {idn_string}')
In this script, we first import the RsInstrument module. Next, we create an instance of the RsInstrument class, passing the oscilloscope's IP address to the constructor. Finally, we use the `query()` method to send the command `*IDN?` to the oscilloscope, which returns the instrument's identification string.
Remember to replace `192.168.1.100` with your oscilloscope's actual IP address or hostname. The IP address and hostname can be found in the oscilloscope's network settings.
Examples
On the popular open-source platform GitHub, you can find numerous basic examples demonstrating the use of Rohde & Schwarz oscilloscopes through remote programming with Python. Furthermore, the manual for each oscilloscope contains a complete catalog of SCPI commands tailored to each user's scripts.
Powerful Python remote programming of R&S oscilloscopes
In conclusion, the RsInstrument Python module offers a powerful and efficient way to remotely control Rohde & Schwarz oscilloscopes. With its easy setup and comprehensive support, it is an invaluable tool for any user looking to automate and optimize their testing and measurement processes. It enables simple automation of end-of-line production testing and other applications.
