Spectrum Analyzer · SCPI command comparison

Keysight N9000B vs N9020B: SCPI commands and remote control compared

In TestFlow's instrument library, the Keysight N9000B takes 84 SCPI commands, 27 of them queries, and the Keysight N9020B takes 103 SCPI commands, 22 of them queries. That is 19 more on the N9020B. Counting distinct command headers (the command path without its arguments), 59 are accepted by both, 14 exist only on the N9000B, and 28 only on the N9020B. 81% of the N9000B's command headers also exist on the N9020B.

Both libraries have commands under SENSe, CALCulate, INITiate, CONFigure, DISPlay, TRACe, INSTrument, and TRIGger, plus 3 more roots. Only the N9000B has FETCh and SYSTem. Only the N9020B has FORMat, ABORt, INPut, and MMEMory.

Both libraries synchronise with *OPC?. Only the N9000B library has an error-queue read (SYSTem:ERRor?); the N9020B library has none.

TestFlow's library gives the N9021B, N9030B, N9038A, N9040B, N9041B, and N9048B the same command set as the N9020B, so the N9020B column applies to them too.

N9000B commands
84
N9020B commands
103
Shared headers
59
Unique headers
42

Run this on your bench

Describe the test; TestFlow's agent uses these command sets to drive your Keysight N9000B or Keysight N9020B and writes the report from the measured results.

Get started

N9000B vs N9020B at a glance

Counts come from TestFlow's instrument library, the command sets its AI agent uses to drive each instrument. A distinct command header is the command path without its arguments, so :OUTPut ON and :OUTPut OFF count once.

Keysight N9000BKeysight N9020B
Commands in TestFlow's library84103
Queries (read a value or state)2722
Settings and actions5781
Subsystems1719
Distinct command headers7387
Headers the other lacks1428
Command languageSCPISCPI
Operation complete*OPC?*OPC?
Error queueSYSTem:ERRor?Not in library
Models on this command setN9000BN9020B, N9021B, N9030B, N9038A, N9040B, N9041B, N9048B

Commands both accept

59 command headers are in both libraries. Here are 12, taken across subsystems. Where the N9020B library writes the command differently, its form is shown under the N9000B's.

CommandWhat it does
:SENSe:FREQuency:CENTer <Frequency>Set Center Freq. Sets the center frequency of the displayed span in Hz.
:CALCulate:MARKer1:STATe ONN9020B: :CALCulate:MARKer<MkrNum>:STATe ONMarker On. Turns marker 1 on (normal marker).
:INITiate:CONTinuous ONContinuous Sweep On. Sets the analyzer to continuous (free-run) sweep mode.
:CONFigure:CHPowerConfig Channel Power. Selects and configures the Channel Power measurement.
:DISPlay:WINDow:TRACe:Y:SCALe:RLEVel <Level>Set Ref Level. Sets the amplitude reference level (top of the graticule) in the current Y-axis units.
:TRACe1:TYPE <Type>N9020B: :TRACe<TraceNum>:TYPE <TraceType>Set Trace Type. Sets trace 1 update type (clear write, average, max hold, or min hold).
:INSTrument:SELect SASelect SA Mode. Selects the Spectrum Analyzer (SA) mode on the X-Series analyzer.
:TRIGger:SOURce <Source>Set Trigger Source. Selects the trigger source for the sweep.
:READ:CHPower?Measure Channel Power. Initiates a Channel Power measurement and returns the result.
:UNIT:POWer <Units>Set Y Units. Sets the amplitude (Y-axis) measurement units.
:CALibration:ALL?Self Calibration. Runs the full internal alignment (calibration) and returns 0 on success.
*IDN?Identify. Returns the instrument identification string (manufacturer, model, serial, firmware).

Only on the Keysight N9000B

14 command headers in the N9000B library have no match in the N9020B library. Below are 12 of them from the 6 largest subsystems; the full list is in the Keysight N9000B command reference.

SENSe (4 only on the N9000B)

CommandWhat it does
:SENSe:AVERage:COUNt?Read Average Count. Returns the configured number of averages.
:SENSe:AVERage:CLEarAverage Clear. Clears and restarts the average accumulation.
:SENSe:DETector:FUNCtion <Detector>Set Detector. Sets the trace detector function.
:SENSe:DETector:FUNCtion?Read Detector. Returns the current trace detector function.

CALCulate (3 only on the N9000B)

CommandWhat it does
:CALCulate:MARKer1:SET:CENTerMarker To Center. Sets the center frequency equal to the marker 1 frequency.
:CALCulate:MARKer1:SET:RLEVelMarker To Ref Level. Sets the reference level equal to the marker 1 amplitude.
:CALCulate:DATA?Read Measurement Data. Returns the calculated data for the active measurement.

FETCh (2 only on the N9000B)

CommandWhat it does
:FETCh:CHPower?Read Channel Power. Returns the most recent Channel Power measurement result.
:FETCh:OBWidth?Read OBW. Returns the most recent Occupied Bandwidth measurement result.

CONFigure (1 only on the N9000B)

CommandWhat it does
:CONFigure:SANalyzerConfig Swept SA. Selects and configures the Swept SA measurement with its default settings.

INITiate (1 only on the N9000B)

CommandWhat it does
:INITiate:RESTartRestart Sweep. Restarts the current sweep/measurement from the beginning.

INSTrument (1 only on the N9000B)

CommandWhat it does
:INSTrument:SELect?Read Mode. Queries the currently selected instrument mode.

Only on the Keysight N9020B

28 command headers in the N9020B library have no match in the N9000B library. Below are 16 of them from the 6 largest subsystems; the full list is in the Keysight N9020B command reference.

CALCulate (10 only on the N9020B)

CommandWhat it does
:CALCulate:MARKer<MkrNum>:MAXimum:LEFTMarker Peak Left. Moves the specified marker to the next peak to the left.
:CALCulate:MARKer<MkrNum>:MAXimum:RIGHtMarker Peak Right. Moves the specified marker to the next peak to the right.
:CALCulate:MARKer<MkrNum>:CENTerMarker To Center. Sets the center frequency to the marker's current frequency.
:CALCulate:MARKer<MkrNum>:RLEVelMarker To Ref Level. Sets the reference level to the marker's current amplitude.

SENSe (6 only on the N9020B)

CommandWhat it does
:SENSe:FREQuency:OFFSet <Offset>Set Freq Offset. Sets a frequency offset added to all displayed frequency readouts in Hz.
:SENSe:DETector:TRACe <Detector>Set Detector. Sets the detector type used to reduce sweep data to trace points.
:SENSe:DETector:AUTO ONSet Detector Auto. Enables automatic detector selection based on the trace and measurement.
:SENSe:CORRection:IMPedance:INPut:MAGNitude <Impedance>Set Input Impedance. Sets the input impedance reference (50 or 75 ohms) for amplitude correction.

CONFigure (3 only on the N9020B)

CommandWhat it does
:CONFigure:ACPowerConfig ACP. Configures the analyzer for the Adjacent Channel Power (ACP) measurement.
:CONFigure:TOIConfig TOI. Configures the analyzer for the third-order intercept (TOI) measurement.
:CONFigure:HARMonicsConfig Harmonics. Configures the analyzer for the harmonic distortion measurement.

READ (3 only on the N9020B)

CommandWhat it does
:READ:ACPower?Read ACP. Initiates and reads the adjacent channel power ratio results.
:READ:TOI?Read TOI. Initiates and reads the third-order intercept measurement results.
:READ:HARMonics:DISTortion?Read Harmonics. Initiates and reads the total harmonic distortion result.

ABORt (1 only on the N9020B)

CommandWhat it does
:ABORtAbort. Aborts the current sweep or measurement in progress.

DISPlay (1 only on the N9020B)

CommandWhat it does
:DISPlay:ENABle ONDisplay All On. Turns the front-panel display update on.

Control both from Python

With PyVISA and any VISA backend, this opens both instruments, identifies them, sends one setting, and reads one value from each. For the setting, both libraries hold :SENSe:FREQuency:SPAN:FULL (set full span), and the same line runs on each. For the reading, both libraries hold :SENSe:FREQuency:CENTer? (read center freq), and the same line runs on each. For the basics, see the PyVISA tutorial.

import pyvisa

rm = pyvisa.ResourceManager()
print(rm.list_resources())  # find both VISA addresses

a = rm.open_resource("PASTE_N9000B_ADDRESS")  # Keysight N9000B
b = rm.open_resource("PASTE_N9020B_ADDRESS")  # Keysight N9020B
for inst in (a, b):
    inst.timeout = 5000  # ms
    print(inst.query("*IDN?"))

# The same setting on both: Set Full Span
a.write(":SENSe:FREQuency:SPAN:FULL")
b.write(":SENSe:FREQuency:SPAN:FULL")

# The same reading on both: Read Center Freq
print(a.query(":SENSe:FREQuency:CENTer?"))
print(b.query(":SENSe:FREQuency:CENTer?"))

a.close()
b.close()

Run this on your bench

Describe the test; TestFlow's agent uses these command sets to drive your Keysight N9000B or Keysight N9020B and writes the report from the measured results.

Get started

Frequently asked questions

What is the difference between the Keysight N9000B and the Keysight N9020B for remote control?

In TestFlow's library the N9000B has 84 SCPI commands and the N9020B has 103 SCPI commands. 59 command headers are common to both, 14 are only on the N9000B (mostly SENSe and CALCulate), and 28 are only on the N9020B (mostly CALCulate and SENSe).

Can I use the same SCPI code for the Keysight N9000B and the Keysight N9020B?

Partly. 59 command headers are accepted by both, including :SENSe:FREQuency:CENTer, :CALCulate:MARKer1:STATe, and :INITiate:CONTinuous. 42 are not, for example :SENSe:AVERage:COUNt? on the N9000B and :CALCulate:MARKer<MkrNum>:MAXimum:LEFT on the N9020B, so a script that uses those needs a separate branch for each instrument.

Which has more remote commands, the N9000B or the N9020B?

The N9020B: 84 commands for the N9000B against 103 for the N9020B in TestFlow's library. Of those, 27 on the N9000B and 22 on the N9020B are queries that read a value or state, and the library splits them into 17 and 19 subsystems.

How do the N9000B and N9020B signal operation complete and report errors?

Both libraries synchronise with *OPC?. Only the N9000B library has an error-queue read (SYSTem:ERRor?); the N9020B library has none. Each command named here is listed in the tables on this page and on each instrument's command reference.

Your next test, automated today

Describe the test. TestFlow builds the workflow, runs it on your instruments, and writes the report. See it on a bench like yours.