Agilent E5062A Vector Network Analyzer

class pymeasure.instruments.agilent.AgilentE5062A(adapter, name='Agilent E5062A Vector Network Analyzer', **kwargs)

Bases: SCPIMixin, Instrument

Represents the Agilent E5062A Vector Network Analyzer

This VNA has 4 separate channels, each of which has its own sweep. The channels are stored in the channels dictionary. Channels can be enabled even if not displayed. Many trace-specific operations, including reading out data, happen at the channel level, but pertain to only the active trace.

Each channel can display up to 4 traces (controlled via the visible_traces parameter). Each channel also has a display_layout property that controls the layout of the traces in the channel. The traces are accessed via the traces dictionary (i.e. vna.channels[1].traces[1]).

The VNA supports multiple transfer formats. This API only supports the IEEE 64-bit floating point format. The VNA is configured for this format during initialization, and the data transfer format is not a publicly accessible property.

This class implements only a subset of the total E5062A functionality. The more significant missing functionality includes (TODO):

  • editing the scale of the display

  • markers

  • calibration

  • power sweeps

# connect to the VNA and make a measurement consisting of 10 averages
vna = AgilentE5062A("TCPIP::192.168.2.233::INSTR")
ch = vna.channels[1]            # use channel 1
ch.visible_traces = 4            # use all 4 traces
for i, (tr, parameter) in enumerate(zip(
        ch.traces.values(),
        ['S11', 'S12', 'S21', 'S22'])):
    tr.parameter = parameter

ch.averages = 10                # use 10x averaging
ch.averaging_enabled = True     # turn averaging on
ch.trigger_continuous = False   # turn off continuous triggering
vna.trigger_source = 'BUS'      # require remote trigger
vna.abort()                     # stop the current sweep
ch.restart_averaging()          # clear current averaging
for _ in range(ch.averages):
    ch.trigger_initiate()       # arm channel 1 for single sweep
    vna.trigger_single()        # send a trigger
    vna.wait_for_complete()     # wait until the sweep is complete

# see `agilentE5062A.data` for an example of saving the measurement
ch_1
Channel

VNAChannel

ch_2
Channel

VNAChannel

ch_3
Channel

VNAChannel

ch_4
Channel

VNAChannel

abort()

Abort the current sweep (affects the trigger fsm, see page 80 of the programmer’s manual for details)

property display_layout

Control the layout of the windows (channels) on the display (str). See the list of valid options below:

  • D1

  • D12

  • D1_2

  • D112

  • D1_1_2

  • D123

  • D1_2_3

  • D12_33

  • D11_23

  • D13_23

  • D12_13

  • D1234

  • D1_2_3_4

  • D12_34

In general, an occurance of a number denotes the associated channel being visible and an occurence of ‘_’ denotes a vertical split. Multiple occurences of the same number denote the channel having a larger window than the other channels. Refer to Figure 3-1 in the the programmer’s manual for details.

Note that this splits windows for multiple channels, not traces. Basic S-param measurements most likely want to use only a single channel, but with multuple traces instead. See e.g. AgilentE5062A.channels[1].visible_traces

property output_enabled

Control whether to turn on the RF stimulus (bool). The stimulus needs to be on to perform any measurement. Beware that the stimulus is on by default! (i.e. after reset())

pop_err()

Pop an error off the error queue. Returns a tuple containing the code and error description. An error code 0 indicates success.

The Error queue can be cleared using the standard SCPI agilentE5062A.clear() method.

trigger()

Regardless of the trigger setting, generate a trigger (if the trigger has been initialized, i.e. is in the trigger wait state)

trigger_bus()

If the trigger source is BUS and the VNA is waiting for a trigger (the trigger has been initialized), generate a trigger.

trigger_single()

like trigger(), but the complete SCPI property (synchronization bit) waits for the sweep to be complete (see agilentE5062A.wait_for_complete()).

property trigger_source

Control the trigger source (str). From the documentation:

  • INT: Uses the internal trigger to generate continuous triggers automatically (default).

  • EXT: Generates a trigger when the trigger signal is inputted externally via the Ext Trig connector or the handler interface.

  • MAN: Generates a trigger when the key operation of [Trigger] - Trigger is executed from the front panel.

  • BUS: Generates a trigger when the *TRG command is executed.

wait_for_complete(attempt=1, max_attempts=20)

Wait a potentially long time for the synchronization bit. This is useful in conjunction with agilentE5062A.trigger_single() to wait for a single sweep to complete.

class pymeasure.instruments.agilent.agilentE5062A.VNAChannel(*args, **kwargs)

Bases: Channel

A measurement channel of the E5061A/E5062A

property IF_bandwidth

Control the IF bandwidth in Hz (int), from 10 Hz to 30 kHz. Default 30 kHz.

activate()

Activate (select) the current channel. Note that the channel must first be displayed (via AgilentE5062A.display_layout) for it to be activatable.

property attenuation

Control the stimulus attenuation in dB (positive int), from 0 to 40 in incrememnts of 10. Default is 0 dB. The allowable stimulus power range is a 15 dB range: (attenuation - 5 dB, attenuation + 10 dB).

This requires the power range extension, and the command is ignored if the extension is not installed.

property averages

Control how many averages to take, from 1-999 (int). Note that averaging_enabled needs to be true for averaging to be enabled.

property averaging_enabled

Control whether to average the measurement data (bool).

property data

Measure the Formatted Data of the active trace.

Each trace consists of scan_points plotted either vs. frequency or in something like a smith-chart configuration. This property does not access any frequency information. So for rectangular plots, this query returns only the y-values of the trace (no frequency information). For smith- and polar- plots, this two values per data point.

This function returns a tuple containing both a primary and a secondary data numpy array. The secondary data is all zeros for all trace formats that are not smith or polar. The implication for this is that the best way to save complex S-parameter data in one go is to use a Smith (Real/Imag) or Polar (Real/Imag) trace format, (SCOMplex and POLar, respectively).

The formatted data array is settable in the VNA but not implemented in this python API.

Frequency data is accessed via the frequencies property.

# build an s-parameter matrix by measuring the trace data,
# where s_matrix[i] = [[S11, S12], [S21, S22]] @ freqs[i]
freqs = ch.frequencies
s_matrix = np.empty((freqs.size, 4), dtype=np.complex64)
for i, tr in enumerate(ch.traces.values()):
    tr.activate()
    ch.trace_format = 'POL'
    re, im = ch.data
    s_matrix[:, i] = re + 1j * im
s_matrix = s_matrix.reshape(-1, 2, 2)  # ready for use with e.g. skrf
property display_layout

Control the graph layout of the traces in the channel (str). Does not affect how many traces are active. See the list of valid options:

  • D1

  • D12

  • D1_2

  • D112

  • D1_1_2

  • D123

  • D1_2_3

  • D12_33

  • D11_23

  • D13_23

  • D12_13

  • D1234

  • D1_2_3_4

  • D12_34

In general, an occurance of a number denotes the associated trace having it’s own subplot and an occurence of ‘_’ denotes a vertical split. Multiple occurences of the same number denote the trace having a larger window than the other traces. Refer to Figure 3-1 in the the programmer’s manual for details. If a trace is active but it’s associated number is not present in the display_layout identifier, it is plotted in the first subplot.

property frequencies

Measure the frequency in Hz associated with each data point of the active trace. Returns a numpy array.

property power

Control the simulus power in dBm (float). The allowable range is influenced by the value of attenuation. (dynamic)

restart_averaging()

Clear averaging history.

property scan_points

Control the number of points used in a sweep (int). Valid range 2 - 1601.

property start_frequency

Control the start frequency in Hz (float).

property stop_frequency

Control the stop frequency in Hz (float).

property sweep_time

Control the sweep time in seconds (float). The allowable range varies on config and the set value is truncated. Note that sweep_time_auto_enabled needs to be False for changes to this property to have an effect.

property sweep_time_auto_enabled

Control whether to automatically set the sweep time (bool). You probably want this on to always keep the sweep time to a minimum (given the range, IF BW, and sweep delay time).

property sweep_type

Control the type of the sweep (string).

Setting

Description

LIN

Linear

LOG

Logarithmic

SEGM

Segment

POW

Power

Defaults to linear. Note that the API for configuring segment type sweeps is not implememented in this class.

property trace_format

Control the data format of the active trace of the channel (str). Default is MLOGarithmic. From the programmer’s manual:

Setting

Description

MLOG

Specifies the logarithmic magnitude format.

PHAS

Specifies the phase format.

GDEL

Specifies the group delay format.

SLIN

Specifies the Smith chart format (Lin/Phase).

SLOG

Specifies the Smith chart format (Log/Phase).

SCOM

Specifies the Smith chart format (Real/Imag).

SMIT

Specifies the Smith chart format (R+jX).

SADM

Specifies the Smith chart format (G+jB).

PLIN

Specifies the polar format (Lin).

PLOG

Specifies the polar format (Log).

POr

Specifies the polar format (Re/Im).

MLI

Specifies the linear magnitude format.

SWR

Specifies the SWR format.

REAL

Specifies the real format.

IMAG

Specifies the imaginary format.

UPH

Specifies the expanded phase format.

PPH

Specifies the positive phase format.

property trigger_continuous

Control whether the channel triggers continuously (bool). If not, after a sweep is complete, the global trigger enters the hold state, and will not respond to triggers.

trigger_initiate()

If the trigger is in the hold state (i.e. trigger_continuous is off and the measurement has completed), re-initialize the trigger for a single measurement.

property visible_traces

Control the number of traces visible in the channel (int).

class pymeasure.instruments.agilent.agilentE5062A.VNATrace(parent, id)

Bases: Channel

A trace (of a channel) of the E5061A/E5062A

activate()

Select this trace.

property parameter

Control the measurement parameter of the trace (str). Can be S11, S21, S12, or S22