Keysight PNA Vector Network Analyzers

class pymeasure.instruments.keysight.KeysightPNA(adapter, name='Keysight PNA', data_format='real64', byte_order_swapped=True, **kwargs)

Bases: SCPIMixin, Instrument

A class representing a Keysight PNA vector network analyzer.

Parameters:
  • data_format (str) – set the data_format attribute to strictly ascii, real32 or real64.

  • byte_order_swapped (bool) – Set the byte_order_swapped attribute for the real32 or real64 data format.

pna = KeysightPNA("GPIB0::16::INSTR",
                  timeout=5000,
                  )

pna.load_state("D:/States/MyState.csa")
pna.adapter.connection.timeout = 20000  # set a new timeout to 20 sec
pna.ch_1.single()  # execute a single trigger of channel 1
pna.complete  # wait till the sweep has finished
x_data = pna.ch_1.tr_1.x_data  # get the X data of trace 1 in channel 1
y_data = pna.ch_2.tr_5.y_data  # get the Y data of trace 5 in channel 2
y_complex = pna.ch_2.tr_5.y_data_complex  # get the complex Y data of trace 5 in channel 2
pna.ch_1.tr_1.mkr_1.enabled = True  # Activate marker 1 on trace 1 in channel 1
pna.ch_1.tr_1.mkr_1.x = 123e6  # Set marker 1 to 123 MHz
mkr_y = pna.ch_1.tr_1.mkr_1.y  # Read the marker 1 y data
Workflow:
  • Configure the channels/measurements directly on the PNA

  • Calibrate the PNA

  • Save the state as csa file

  • Perform single triggers for the different channels

  • Measurement data can be accessed with the channel and trace numbers

abort()

Stop all sweeps.

Note that the configured trigger will restart the sweeps.

property byte_order_swapped: Any

Control whether the byte order is swapped for data transfer (bool).

Some computers read data from the analyzer in the reverse order. This property is only effective if data_format set to real32 or real64. If data_format is set to ascii, byte_order_swapped is ignored.

  • True: Use for IBM compatible computers.

  • False: The controller is anything other than an IBM compatible computers

    or when using VEE, LabView, or T&M Tool kit.

property data_format: Any

Control the data format (strictly ascii, real32 or real64).

  • ascii is but slow. Use it when you have to transfer small amounts data.

  • real32 is best for transferring large amounts of measurement data. It can cause rounding errors in frequency data.

  • real64 is slower than real32 but has more significant digits. It is required to accurately represent frequency data.

In the PNA, measurement data is stored as 32 bit and frequencies stored as 64 bit. Therefore, use real32 when getting data and real64 when getting frequencies. It avoids losing any precision as well as getting the maximum speed on the data transfer.

Note

Executing reset() sets data_format to ascii.

load_state(file_name)

Load an instrument state from file.

Parameters:

file_name (str) – e.g. D:/my_pna_state.csa

property measurement_channels: Any

Get the channel numbers that are currently in use (list of int).

property options: Any

Get the device options installed.

property output_enabled: Any

Control whether the RF power output of the sources is enabled (bool).

reset()

Reset the instrument.

update_channels()

Update the channel instances of the PNA driver to reflect the current channel configuration.

class pymeasure.instruments.keysight.keysightPNA.MeasurementChannel(*args, **kwargs)

Bases: Channel

A class representing a Keysight PNA measurement channel.

continuous()

Set the channel to CONTINUOUS mode.

hold()

Set the channel on HOLD mode.

initiate()

Initiate an immidiate trigger.

Note

The trigger source has to be set to MANUAL for this command. One trigger signal is sent each time initiate() is executed.

property measurements: Any

Get the measurement trace numbers of the channel (list of int).

property number_of_points: Any

Get the number of points of the channel (int).

single()

Trigger a single sweep.

update_traces()

Update the trace instances of the channel to reflect the current trace configuration.

class pymeasure.instruments.keysight.keysightPNA.Trace(parent, id, **kwargs)

Bases: Channel

A class representing a Keysight PNA measurement trace.

property parameter: Any

Get the measurement parameter of the trace (str).

read_buffer(data_format='ascii')

Read the data buffer of the PNA.

Parameters:

data_format – str, strictly ascii, real32 or real64 (default: 'ascii')

Returns:

ndarray

property x_data

Get the X data of the trace (ndarray).

The data type of the array elements is equal to the currently set data_format.

property x_unit: Any

Get the X unit of the trace (str).

Returns:

FREQ, POW, PHAS, DC, POIN or DEF

property y_data

Get the Y data of the trace in the displayed format (ndarray).

The data type of the array elements is equal to the currently set data_format. The method returns the data from access point 2. Please check PNA help for further information about the data access map.

property y_data_complex

Get the complex Y data of the trace (2D ndarray).

The data type of the array elements is equal to the currently set data_format. The method returns the data from access point 1. Please check PNA help for further information about the data access map.

property y_unit: Any

Get the Y unit of the trace (str).

Returns:

HZ, SEC, MIN, HOUR, DAY, DB, DBM, DBMV, WATT, FAR, HENR, OHM, MHO, SIEM, VOLT, DEGR, RAD, MET, DPHZ, UNIT, NON, TNOR, NTEM, KELV, CENT, FAHR, FEET, INCH, DBMAAMP, VOLTA, DBUV, PERC, DMVR, DUVR, DMAR, WPHZ, VRO, ARO, DBC, DVP, DCP, DBP, HZP, PRH, VPH, DBV or DEF

class pymeasure.instruments.keysight.keysightPNA.Marker(parent, id, **kwargs)

Bases: Channel

A class representing a marker on a measurement trace.

property enabled: Any

Control the status of the marker (bool).

property is_discrete: Any

Control the discrete status of the marker (bool).

  • True: The marker snaps to the closest actual data point.

  • False: The data is interpolated between data points.

property x: Any

Control the marker’s X value (float).

property y: Any

Get the marker’s Y value ([float, float]).