The Rohde & Schwarz RTA4004 oscilloscope is controlled remotely with SCPI commands. TestFlow's instrument library holds 83 commands for it, 30 of them queries that read values or state, grouped below by subsystem with their arguments. It is the same library TestFlow's AI agent uses to drive the RTA4004 on a real bench.
With PyVISA, any VISA backend, and the instrument on USB, LAN or GPIB, this opens a session, identifies the instrument, sends one setting, and reads one value. Every command in it comes from the reference below. For a full walkthrough, see the PyVISA tutorial and the SCPI command cheat sheet.
import pyvisa
rm = pyvisa.ResourceManager()
print(rm.list_resources()) # find the Rohde & Schwarz RTA4004's VISA address
# Paste the address of your Rohde & Schwarz RTA4004 (USB, LAN or GPIB).
inst = rm.open_resource("PASTE_VISA_ADDRESS_HERE")
inst.timeout = 5000 # ms
print(inst.query("*IDN?")) # identify the instrument
inst.write("SPECtrum:FREQuency:FULLspan") # Spectrum Full Span
print(inst.query("TIMebase:SCALe?")) # Read Timebase Scale
inst.close()Describe the test in a sentence, for example “spectrum full span on the RTA4004, then read timebase scale and log it against a limit”. TestFlow's agent builds the steps from this command library, runs them on your bench through the TestFlow desktop app, and writes the report from the measured values. See AI test automation for lab instruments for how that works and where it stops.
83 commands in 16 groups. A ? marks a query that returns a value. Placeholders in angle brackets take the listed values.
| Command | What it does | Arguments |
|---|---|---|
| SPECtrum:STATe <OnOff> | Spectrum Enable. Enable/disable spectrum (FFT) analysis. | Text: ON,OFF |
| SPECtrum:SOURce <Source> | Spectrum Source. Set spectrum analysis source waveform. | Text: CH1,CH2,CH3,CH4 |
| SPECtrum:FREQuency:CENTer <CenterHz> | Spectrum Center Frequency. Set center frequency (Hz). | Number |
| SPECtrum:FREQuency:SPAN <SpanHz> | Spectrum Span. Set frequency span (Hz). | Number |
| SPECtrum:FREQuency:STARt <StartHz> | Spectrum Start Frequency. Set start frequency (Hz). | Number |
| SPECtrum:FREQuency:STOP <StopHz> | Spectrum Stop Frequency. Set stop frequency (Hz). | Number |
| SPECtrum:FREQuency:FULLspan | Spectrum Full Span. Calculate / display full frequency span. | None |
| SPECtrum:FREQuency:BANDwidth:RESolution:VALue <RBWHz> | Spectrum RBW Value. Set resolution bandwidth (RBW) (Hz). | Number |
| SPECtrum:FREQuency:BANDwidth:RESolution:RATio <Ratio> | Spectrum Span RBW Ratio. Set span/RBW ratio (2^n steps). | Number: 1024,2048,4096,8192,16384,32768 |
| SPECtrum:TIME:POSition <Seconds> | Spectrum Time Position. Set time gate position for FFT analysis. | Number |
| SPECtrum:TIME:RANGe <Seconds> | Spectrum Time Range. Set time gate width/range for FFT analysis. | Number |
| SPECtrum:WAVeform:AVERage:ENABle <OnOff> | Spectrum Enable Average. Enable/disable Average waveform. | Text: ON,OFF |
| SPECtrum:WAVeform:MAXimum:ENABle <OnOff> | Spectrum Enable MaxHold. Enable/disable Max Hold waveform. | Text: ON,OFF |
| SPECtrum:WAVeform:MINimum:ENABle <OnOff> | Spectrum Enable MinHold. Enable/disable Min Hold waveform. | Text: ON,OFF |
| SPECtrum:WAVeform:SPECtrum:ENABle <OnOff> | Spectrum Enable Spectrum. Enable/disable Spectrum waveform. | Text: ON,OFF |
| SPECtrum:FREQuency:AVERage:COUNt <Count> | Spectrum Average Count. Set number of spectrums used for averaging. | Number |
| SPECtrum:FREQuency:AVERage:COMPlete? | Spectrum Average Complete. Query whether averaging is complete. | None |
| SPECtrum:FREQuency:RESet | Spectrum Reset Traces. Reset Min Hold, Max Hold, Spectrum and Average waveforms to current waveform. | None |
| SPECtrum:WAVeform:<Data>:DATA? | Spectrum Data. Query spectrum,average,max-hold or min-hold waveform data (block data). | Text: SPECtrum,AVERage,MAXimum,MINimum |
| SPECtrum:WAVeform:SPECtrum:DATA? | Spectrum Data Spectrum. Query spectrum waveform data (block data). | None |
| SPECtrum:WAVeform:AVERage:DATA? | Spectrum Data Average. Query average spectrum waveform data (block data). | None |
| SPECtrum:WAVeform:MAXimum:DATA? | Spectrum Data Maximum. Query max-hold spectrum waveform data (block data). | None |
| SPECtrum:WAVeform:MINimum:DATA? | Spectrum Data Minimum. Query min-hold spectrum waveform data (block data). | None |
| Command | What it does | Arguments |
|---|---|---|
| CHANnel<Channel>:STATe <OnOff> | Channel Enable. Enable/disable an analog channel. | Number: 1,2,3,4; Text: ON,OFF |
| CHANnel<Channel>:STATe? | Read Channel Enable. Query enable/disable state of an analog channel. | Number: 1,2,3,4 |
| CHANnel<Channel>:SCALe <VoltsDiv> | Channel Scale. Set vertical scale (volts per division). | Number: 1,2,3,4; Number |
| CHANnel<Channel>:SCALe? | Read Channel Scale. Query vertical scale (volts per division). | Number: 1,2,3,4 |
| CHANnel<Channel>:OFFSet <Volts> | Channel Offset. Set vertical offset (volts). | Number: 1,2,3,4; Number |
| CHANnel<Channel>:OFFSet? | Read Channel Offset. Query vertical offset (volts). | Number: 1,2,3,4 |
| CHANnel<Channel>:POSition <Div> | Channel Position. Set channel trace position (div). | Number: 1,2,3,4; Number |
| CHANnel<Channel>:POSition? | Read Channel Position. Query channel trace position (div). | Number: 1,2,3,4 |
| CHANnel<Channel>:COUPling <Coupling> | Channel Coupling. Set input coupling. | Number: 1,2,3,4; Text: DCLimit,ACLimit,GND,DC |
| CHANnel<Channel>:COUPling? | Read Channel Coupling. Query input coupling. | Number: 1,2,3,4 |
| CHANnel<Channel>:LABel <Label> | Channel Label. Set channel label. | Number: 1,2,3,4; Text |
| CHANnel<Channel>:LABel? | Read Channel Label. Query channel label. | Number: 1,2,3,4 |
| Command | What it does | Arguments |
|---|---|---|
| MMEMory:NAME <FileName> | Screenshot FileName. Set the filename used by HCOPy[:IMMediate]. | Text |
| MMEMory:DRIVes? | List Drives. List available storage devices/drives. | None |
| MMEMory:MDIRectory <DirPath> | Make Directory. Create a directory. | Text |
| MMEMory:CDIRectory <DirPath> | Change Directory. Change current directory. | Text |
| MMEMory:DCATalog? "<DirPath>" | Read Directory. Query current directory. | Text |
| MMEMory:CATalog? "<PathName>" | Directory Catalog. List files in current directory. | Text |
| MMEMory:COPY <Source>,<Destination> | Copy File. Copy a file. | Text; Text |
| MMEMory:MOVE <Source>,<Destination> | Move File. Move a file. | Text; Text |
| MMEMory:DELete <FilePath> | Delete File. Delete a file. | Text |
| MMEMory:DATA? "<FilePath>" | Read File Data. Read file data as block data (for supported file types). | Text |
| Command | What it does | Arguments |
|---|---|---|
| TRIGger:A:TYPE <Type> | Trigger Type. Set trigger type (edge/pulse/etc.). | Text |
| TRIGger:A:TYPE? | Read Trigger Type. Query trigger type. | None |
| TRIGger:A:SOURce <Source> | Trigger Source. Set trigger source. | Text: CH1,CH2,CH3,CH4,EXTernanalog,LINE |
| TRIGger:A:SOURce? | Read Trigger Source. Query trigger source. | None |
| TRIGger:A:MODE <Mode> | Trigger Mode. Set trigger mode. | Text: AUTO,NORMal |
| TRIGger:A:MODE? | Read Trigger Mode. Query trigger mode. | None |
| TRIGger:A:LEVel<Channel> <Level> | Trigger Level. Set trigger level for a channel trigger source. | Number: 1,2,3,4; Number |
| TRIGger:A:LEVel<Channel>? | Read Trigger Level. Query trigger level for a channel trigger source. | Number: 1,2,3,4 |
| Command | What it does | Arguments |
|---|---|---|
| HCOPy:CWINdow <OnOff> | Screenshot Close Windows. Close dialog boxes/menus before saving screenshot. | Text: ON,OFF |
| HCOPy:IMMediate | Screenshot Save To File. Save screenshot to file using current directory and filename settings. | None |
| HCOPy:FORMat PNG | Capture. Return screenshot image data as IEEE 488.2 block data. | None |
| HCOPy:COLor:SCHeme <ColorScheme> | Screenshot Color Scheme. Set screenshot color scheme. | Text: COLor,GRAYscale,INVerted |
| HCOPy:SIZE:X? | Read Screenshot X Size. Query horizontal pixel resolution of screenshots. | None |
| HCOPy:SIZE:Y? | Read Screenshot Y Size. Query vertical pixel resolution of screenshots. | None |
| Command | What it does | Arguments |
|---|---|---|
| EXPort:WAVeform:SOURce <WaveformSource> | Waveform Export Source. Select waveform source for export. | Text: CH1,CH2,CH3,CH4,D70,D158,MA1,RE1,RE2,RE3,RE4 |
| EXPort:WFMSave:DESTination <DirPath> | Waveform Export Destination. Set directory path where waveform files are saved (must exist). | Text |
| EXPort:WAVeform:NAME <FileName> | Waveform Export Name. Set waveform file path/name (extension defined by FORMat[DATA]). | Text |
| EXPort:WAVeform:SAVE | Waveform Export Save. Execute saving waveform to the previously defined name/path. | None |
| EXPort:SCRSave:DESTination <DirPath> | Screenshot Destination. Set directory path where screenshots are saved (must exist). | Text |
| Command | What it does | Arguments |
|---|---|---|
| TIMebase:SCALe <SecDiv> | Timebase Scale. Set horizontal time scale (seconds per division). | Number |
| TIMebase:SCALe? | Read Timebase Scale. Query horizontal time scale (seconds per division). | None |
| TIMebase:POSition <Seconds> | Timebase Position. Set horizontal position (time offset). | Number |
| TIMebase:POSition? | Read Timebase Position. Query horizontal position (time offset). | None |
| Command | What it does | Arguments |
|---|---|---|
| SYSTem:ERRor? | System Error Query. Query the next error from the error queue. | None |
| SYSTem:VERSion? | System Version Query. Query SCPI version supported. | None |
| Command | What it does | Arguments |
|---|---|---|
| RUN | Run Continuous. Start continuous acquisition (Run). | None |
| Command | What it does | Arguments |
|---|---|---|
| STOP | Stop Acquisition. Stop acquisition. | None |
| Command | What it does | Arguments |
|---|---|---|
| SINGle | Single Acquisition. Acquire a single sequence. | None |
| Command | What it does | Arguments |
|---|---|---|
| MEASurement1:SOURce CH<Channel> ; MEASurement1:MAIN <Measurment_type> ; MEASurement1:ENABle ON ; wait(100) ; MEASurement1:RESult:ACTual? | Measurment. Sets the measurment channel, type and returns the value | Number: 1,2,3,4; Text: FREQuency,PERiod,PEAK,UPEakvalue,LPEakvalue,PPCount,NPCount,RECount,FECount,HIGH,LOW,AMPLitude,MEAN,RMS,RTIMe,FTIMe,SRRise,SRFall,PDCYcle,NDCYcle,PPWidth,NPWidth,CYCMean,CYCRms,STDDev,CYCStddev,POVershoot,NOVershoot,BWIDth |
| Command | What it does | Arguments |
|---|---|---|
| <Output Variable>=<Equation> | Math. Variable equals an equation like (${Var_name}= ${Var_name}/2) | Number; Text |
| Command | What it does | Arguments |
|---|---|---|
| wait(<ms>) | Wait. Waits for number of milliseconds | Number |
| Command | What it does | Arguments |
|---|---|---|
| save2var <Variable_name> | Save2Variable. Saves last mearurment to a variable | Text |
| Command | What it does | Arguments |
|---|---|---|
| *IDN? | Identify. Query the instrument identification string. | None |
| *RST | Reset. Reset the instrument. | None |
| *CLS | Clear Status. Clear status registers and error queue. | None |
| *OPC? | Operation Complete. Query operation complete flag. | None |
| *WAI | Wait To Continue. Wait until pending operations are complete. | None |
| *STB? | Read Status Byte. Query the status byte register. | None |
This reference is generated from TestFlow's instrument library, which is drafted from Rohde & Schwarz's programming documentation for the RTA4004 and checked when the agent runs it. Ranges, timing, and option-dependent commands are defined by Rohde & Schwarz's programming manual: check it before you rely on an edge case. Last updated November 17, 2026.
Yes. The Rohde & Schwarz RTA4004 accepts SCPI commands over its remote interfaces. TestFlow's instrument library holds 83 SCPI commands for it: 30 queries that read values or state, and 53 settings and actions.
Install PyVISA and a VISA backend, find the instrument's address with ResourceManager().list_resources(), open it, then send commands with write() and read values with query(). The example on this page sends *IDN?, SPECtrum:FREQuency:FULLspan and TIMebase:SCALe?.
TIMebase:SCALe? (read timebase scale). Query horizontal time scale (seconds per division). The full list of queries is in the command reference on this page, grouped by subsystem.
Yes. TestFlow is an AI agent for electronics testing: you describe the test, and it builds the automation from this command library, runs it on the Rohde & Schwarz RTA4004 through the TestFlow desktop app, and writes the report from the measured results.
Describe the test. TestFlow builds the workflow, runs it on your instruments, and writes the report. See it on a bench like yours.