# devices.keysight:PNA5225b


The device class for the Keysight VNA 5225b.


Usage

``` python
devices.keysight:PNA5225b(
    interface,
    reset=True,
    timeout=10000.0,
    **kwargs,
)
```


It can possibly be used with different models from Keysight with little changes.


## Attributes

| Name | Description |
|----|----|
| [maxAverage](#maxAverage) | The maximum average setting of all configured channels. |

------------------------------------------------------------------------


### maxAverage


The maximum average setting of all configured channels.


`maxAverage=``1`


The VNA will trigger that many sweeps, so the averaging requirement for each channel is satisfied.


## Methods

| Name | Description |
|----|----|
| [__init__()](#__init__) | Initialize a PNA5225b device. |
| [configureCW()](#configureCW) | Configure the VNA to output a wave with a constant frequency. |
| [configureSweep()](#configureSweep) | Change the sweep settings in the given channel. |
| [configureVNA()](#configureVNA) | Change the sweep settings in the given channel. |
| [createParam()](#createParam) | Create a new measurement parameter. |
| [createTrace()](#createTrace) | Create a trace on the VNA display. |
| [deleteTrace()](#deleteTrace) | Delete a trace from the VNA display. |
| [getComplexData()](#getComplexData) | Transfer complex measurement data from the VNA. |
| [getData()](#getData) | Transfer measurement data from the VNA. |
| [getSourcePower()](#getSourcePower) | Get the VNA output power setting. |
| [getSweepData()](#getSweepData) | Prepare, trigger and fetch sweep data. |
| [readSweepParams()](#readSweepParams) | Read the sweep parameters from the VNA. |
| [reset()](#reset) | Reset the VNA using the SYST:FPRESET command. |
| [selectTrace()](#selectTrace) | Select a trace for subsequent operations. |
| [setSourcePower()](#setSourcePower) | Configure the VNA output power. |
| [startSweep()](#startSweep) | Prepare the VNA for triggering a sweep. |
| [stopSweep()](#stopSweep) | Turn the VNA output off. |
| [trigger()](#trigger) | Trigger the sweep(s). |

------------------------------------------------------------------------


### \_\_init\_\_()


Initialize a PNA5225b device.


Usage

``` python
__init__(
    interface,
    reset=True,
    timeout=10000.0,
    **kwargs,
)
```


#### Parameters


`interface: str`  
The IP address and port where the device is located. e.g. TCPIP::192.98.143.1::5025::SOCKET

`reset: bool = ``True`  
If true, the VNA is reset on object creation using the reset method. Default is True.

`timeout: int = ``10000.0`  
The timeout of the ethernet connection in milliseconds. Default is 10e3 ms.

`**kwargs`  
Keyword arguments passed to the VisaDevice constructor. 'open' : bool, optional If true, the connection to the VNA is opened on object creation. Default is True.


------------------------------------------------------------------------


### configureCW()


Configure the VNA to output a wave with a constant frequency.


Usage

``` python
configureCW(
    channel,
    freq,
    activate=True,
)
```


#### Parameters


`channel: int`  
The desired channel.

`freq: int or MIN / MAX`  
The frequency in Hz.

`activate: bool = ``True`  
If true, activate the output after configuration. Default is True.


------------------------------------------------------------------------


### configureSweep()


Change the sweep settings in the given channel.


Usage

``` python
configureSweep(
    channel,
    fStart,
    fStop,
    getData=False,
)
```


Frequency units are in Hz. 'MIN'/'MAX' arguments can be used instead of actual numbers, and use the highest/lowest setting the VNA is capable of.


#### Parameters


`channel: int`  
The desired channel.

`fStart: int`  
The frequency on which the sweep starts.

`fStop: int`  
The frequency on which the sweep ends.

`getData: bool = ``False`  
If true, trigger a sweep and return the results directly. Default is False.


#### Returns


`np.ndarray or None`  
The sweep data if getData is True, None otherwise.


------------------------------------------------------------------------


### configureVNA()


Change the sweep settings in the given channel.


Usage

``` python
configureVNA(
    channel,
    fPoints,
    if_bw,
    average=None,
)
```


Frequency units are in Hz. 'MIN'/'MAX' arguments can be used instead of actual numbers, and use the highest/lowest setting the VNA is capable of.


#### Parameters


`channel: int`  
The desired channel.

`fPoints: int or MIN / MAX`  
The number of points per sweep.

`if_bw: int`  
The bandwidth of the digital IF filter. A lower value usually means a slower, but more accurate measurement.

`average: int = None`  
The number of averages which make up the final values. Default is None.


#### Returns


`None`  


------------------------------------------------------------------------


### createParam()


Create a new measurement parameter.


Usage

``` python
createParam(
    channel,
    param,
    name=None,
    scale="lin",
    createTrace=True,
)
```


#### Parameters


`channel: int`  
The Channel on which the parameter is created.

`param: str`  
The name of the parameter to be measured. e.g S12

`name: str = None`  
The name the parameter will be assigned. If None, a name will be automatically generated from the selected parameter and the channel. e.g. channel=1, param=S12 =\> name=ch1_S12 Default is None.

`scale: str = ``"lin"`  
The display format of the measurement. Currently implemented are 'lin': linear and 'log': logarithmic scale. Default is 'lin'.

`createTrace: bool = ``True`  
If true, a trace of the parameter is created using the createTrace method. Default is True.


------------------------------------------------------------------------


### createTrace()


Create a trace on the VNA display.


Usage

``` python
createTrace(
    name,
    param,
)
```


Currently, the method will display the reflection parameters in window 1 and the transmission parameters in window 2. At the moment it has no defined behavior for measurement of parameters other than the Sij.


#### Parameters


`name: str`  
The name of the measurement parameter, by default ch\_.

`param: str`  
The measured parameter.


------------------------------------------------------------------------


### deleteTrace()


Delete a trace from the VNA display.


Usage

``` python
deleteTrace(
    winNum,
    tracNum,
)
```


#### Parameters


`winNum: int`  
The window number in which the trace is displayed.

`tracNum: int`  
The number of the trace.


------------------------------------------------------------------------


### getComplexData()


Transfer complex measurement data from the VNA.


Usage

``` python
getComplexData(
    channel,
    precision="single",
)
```


#### Parameters


`channel: int`  
The desired channel.

`precision: str = ``"single"`  
One of {'single', 'double', 'ascii'}. 'single' and 'double' precisions are transferred as binary data, and achieve much faster transfer speeds. 'ascii' is only implemented as a fallback method, as it is much easier to debug. Default is 'single'.


#### Returns


`np.ndarray`  
The complex measured data from the specified channel as a 2xN array where the first row is the real part and the second row is the imaginary part.


------------------------------------------------------------------------


### getData()


Transfer measurement data from the VNA.


Usage

``` python
getData(
    channel,
    precision="single",
)
```


#### Parameters


`channel: int`  
The desired channel.

`precision: str = ``"single"`  
One of {'single', 'double', 'ascii'}. 'single' and 'double' precisions are transferred as binary data, and achieve much faster transfer speeds. 'ascii' is only implemented as a fallback method, as it is much easier to debug. Default is 'single'.


#### Returns


`np.ndarray`  
The measured data from the specified channel.


------------------------------------------------------------------------


### getSourcePower()


Get the VNA output power setting.


Usage

``` python
getSourcePower(channel=1)
```


#### Parameters


`channel: int = ``1`  
The desired channel. Default is 1.


#### Returns


`float`  
Current power setting in dBm.


------------------------------------------------------------------------


### getSweepData()


Prepare, trigger and fetch sweep data.


Usage

``` python
getSweepData(channel)
```


This is a convenience method to prepare and trigger the sweep and transfer the data afterwards.


#### Parameters


`channel: int`  
The used channel.


#### Returns


`np.ndarray`  
The measured data from the specified channel.


------------------------------------------------------------------------


### readSweepParams()


Read the sweep parameters from the VNA.


Usage

``` python
readSweepParams(channel)
```


Frequencies are returned in Hz.


#### Parameters


`channel: int`  
The channel for which the sweep parameters should be returned.


#### Returns


`fStart: float`  
The frequency at which the sweep starts.

`fStop: float`  
The frequency at which the sweep stops.

`fPoints: int`  
The number of points in the sweep.


------------------------------------------------------------------------


### reset()


Reset the VNA using the SYST:FPRESET command.


Usage

``` python
reset()
```


Note that this does not reset the data transfer format! Use \*RST for this.


------------------------------------------------------------------------


### selectTrace()


Select a trace for subsequent operations.


Usage

``` python
selectTrace(
    channel,
    trace,
)
```


#### Parameters


`channel: int`  
The channel number.

`trace: int`  
The trace number to select.


------------------------------------------------------------------------


### setSourcePower()


Configure the VNA output power.


Usage

``` python
setSourcePower(
    power,
    channel=1,
)
```


#### Parameters


`power: int`  
Power in dBm (setpoint between +30 and -30 dBm).

`channel: int = ``1`  
The desired channel. Default is 1.


------------------------------------------------------------------------


### startSweep()


Prepare the VNA for triggering a sweep.


Usage

``` python
startSweep()
```


The VNA activates the output, disables the continuous trigger and therefore enables manual triggering. Any currently running sweeps are aborted.


------------------------------------------------------------------------


### stopSweep()


Turn the VNA output off.


Usage

``` python
stopSweep()
```


------------------------------------------------------------------------


### trigger()


Trigger the sweep(s).


Usage

``` python
trigger(channel=1)
```


#### Parameters


`channel: int = ``1`  
The desired channel. Default is 1.
