# devices.keysight:PSA_E4440A


The device class for the Agilent PSA E4440A - Spectrum Analyzer.


Usage

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


It can possibly be used with different models 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 PSA will trigger that many sweeps, so the averaging requirement for each channel is satisfied.


## Methods

| Name | Description |
|----|----|
| [__init__()](#__init__) | Initialize the device. |
| [configureSweep()](#configureSweep) | Configure sweep settings for the spectrum analyzer. |
| [getData()](#getData) | Transfer measurement data from the PSA. |
| [getSweepData()](#getSweepData) | Prepare, trigger, and get data from a sweep operation. |
| [readSweepParams()](#readSweepParams) | Read the current sweep parameters from the PSA. |
| [reset()](#reset) | Reset the PSA using the SYST:PRES command. |
| [startSweep()](#startSweep) | Prepare the PSA for triggering a sweep. |
| [trigger()](#trigger) | Trigger a sweep and wait for completion. |

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


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


Initialize the 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.168.5.52::5025::SOCKET

`reset: bool = ``True`  
If true, the PSA 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.


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


### configureSweep()


Configure sweep settings for the spectrum analyzer.


Usage

``` python
configureSweep(
    fCent,
    fSpan,
    fPoints,
    refLev,
    resBW,
    vidBW,
    average=None,
    avgType="rms",
    scale="log",
    getData=False,
)
```


Sets frequency, bandwidth, averaging, and display parameters. Frequency units are in Hz. 'MIN'/'MAX' can be used instead of actual numbers to select the lowest/highest setting the PSA is capable of.


#### Parameters


`fCent: float`  
Center frequency of the sweep in Hz.

`fSpan: float`  
Frequency span of the sweep in Hz.

`fPoints: int`  
Number of points per sweep.

`refLev: float`  
Reference level for the display in dBm.

`resBW: float`  
Resolution bandwidth in Hz.

`vidBW: float`  
Video bandwidth in Hz.

`average: int = None`  
Number of averages which make up the final values. Default is None (no averaging).

`avgType: (rms, log, scalar) = ``"rms"`  
'rms' power (RMS) averaging, 'log' log-power (video) averaging, 'scalar' voltage averaging. Default is 'rms'.

`scale: (log, lin) = ``"log"`  
Display format: 'lin' linear, 'log' logarithmic. Default is 'log'.

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


#### Returns


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


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


### getData()


Transfer measurement data from the PSA.


Usage

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


Reads trace data in different formats based on the precision parameter.


#### Parameters


`precision: (single, double, ascii) = ``"single"`  
The data format precision to use: '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


`numpy.ndarray`  
The measured data from the spectrum analyzer.


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


### getSweepData()


Prepare, trigger, and get data from a sweep operation.


Usage

``` python
getSweepData()
```


This is a convenience method that combines startSweep(), trigger(), and getData() operations into a single call.


#### Returns


`numpy.ndarray`  
The measured data from the spectrum analyzer.


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


### readSweepParams()


Read the current sweep parameters from the PSA.


Usage

``` python
readSweepParams()
```


Queries the center frequency, span, and number of points settings and calculates the start/stop frequencies. All frequencies are returned in Hz.


#### Returns


`tuple`  
A tuple containing (fStart, fStop, fPoints) where:

- fStart (float): The frequency at which the sweep starts in Hz
- fStop (float): The frequency at which the sweep stops in Hz
- fPoints (int): The number of points in the sweep


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


### reset()


Reset the PSA using the SYST:PRES command.


Usage

``` python
reset()
```


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


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


### startSweep()


Prepare the PSA for triggering a sweep.


Usage

``` python
startSweep()
```


The PSA disables the continuous trigger and therefore enables manual triggering. Any currently running sweeps are aborted.


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


### trigger()


Trigger a sweep and wait for completion.


Usage

``` python
trigger()
```


Adjusts the connection timeout based on the sweep parameters to ensure the operation completes successfully.
