# devices.keysight:PSG8257D


Keysight PSG 8257D-521 microwave signal generator.


Usage

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


## Methods

| Name | Description |
|----|----|
| [__init__()](#__init__) | Initialize a PSG8257D device. |
| [configureAmpMod()](#configureAmpMod) | Configure the PSG amplitude modulation (AmpMod). |
| [configureCW()](#configureCW) | Configure the PSG to output a wave with a constant frequency. |
| [configurePulseMod()](#configurePulseMod) | Configure the pulse modulation of the output signal. |
| [configureSweep()](#configureSweep) | Change the sweep settings in the given channel. |
| [getSourcePower()](#getSourcePower) | Get the PSG output power. |
| [output()](#output) | Set the output state of the PSG. |
| [readFreq()](#readFreq) | Read the frequency parameter from the PSG. |
| [readSweepParams()](#readSweepParams) | Read the sweep parameters from the device. |
| [reset()](#reset) | Disable the signal modulation and turn off the output of the PSG. |
| [setLFO()](#setLFO) | Configure the PSG low frequency output (LFO). |
| [setModulation()](#setModulation) | Enable or disable the signal modulation. |
| [setSourcePower()](#setSourcePower) | Configure the PSG output power. |
| [startSweep()](#startSweep) | Prepare the PSG for triggering a sweep. |
| [stopSweep()](#stopSweep) | Turn the PSG output off. |
| [trigger()](#trigger) | Trigger the sweep(s). |

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


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


Initialize a PSG8257D 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.102::5025::SOCKET

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


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


### configureAmpMod()


Configure the PSG amplitude modulation (AmpMod).


Usage

``` python
configureAmpMod(
    AmpMod=True,
    amMode="DEEP",
    ampSource="INT",
    intFreq=1000.0,
    intShape="SINE",
    ampDepth=100,
)
```


#### Parameters


`AmpMod: bool = ``True`  
If True, enable amplitude modulation. If False, disable amplitude modulation. Default is True.

`amMode: str = ``"DEEP"`  
Amplitude modulation mode, either "DEEP" or "NORM". Default is "DEEP".

`ampSource: str = ``"INT"`  
The source of the amplitude modulation signal, which can take the values: internal:'INT', internal 2:'INT2', external:'EXT', external 2:'EXT2'. Default is "INT".

`intFreq: float = ``1000.0`  
Frequency of the internal oscillator in Hertz, which can take values from 0.5 Hz to 1 MHz. Default is 1e3.

`intShape: str = ``"SINE"`  
Shape of the internal oscillations, which can take the values: sine:'SINE', triangle:'TRI', square:'SQU', ramp:'RAMP', noise:'NOIS', dual-sine:'DUAL', swept-sine:'SWEP'. Default is "SINE".

`ampDepth: int = ``100`  
Amplitude modulation in percent, which can take values from 0 to 100%. Default is 100.


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


### configureCW()


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


Usage

``` python
configureCW(freq)
```


#### Parameters


`freq: int, float, or str`  
The frequency in Hz. Can be a number or 'MIN'/'MAX'.


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


### configurePulseMod()


Configure the pulse modulation of the output signal.


Usage

``` python
configurePulseMod(
    PulseMod=True,
    pulseSource="INT",
    pulseInput="SQU",
    frequency=1000.0,
)
```


#### Parameters


`PulseMod: bool = ``True`  
If True, enable pulse modulation. If False, disable pulse modulation. Default is True.

`pulseSource: str = ``"INT"`  
Source of the pulse modulation signal, which can take the values: internal:'INT', external:'EXT', scalar:'SCAL'. Default is "INT".

`pulseInput: str = ``"SQU"`  
Internally generated modulation input for the pulse modulation, which can take the values: square:'SQU', free-run:'FRUN', triggered:'TRIG', doublet:'DOUB', gated:'GATE'. Default is "SQU".

`frequency: float = ``1000.0`  
Pulse rate frequency in Hertz, which can take values from 0.1 Hz to 10 MHz. Default is 1e3.


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


### configureSweep()


Change the sweep settings in the given channel.


Usage

``` python
configureSweep(
    fStart,
    fStop,
    fPoints,
    stepDwell,
)
```


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


#### Parameters


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

`fStop: int or float`  
The frequency at which the sweep ends.

`fPoints: int or str`  
The number of points per sweep. Can be an integer or 'MIN'/'MAX'.

`stepDwell: int or float`  
The dwell time for a step sweep.


#### Notes

Configures the device for step sweeping with automatic sweep timing.

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


### getSourcePower()


Get the PSG output power.


Usage

``` python
getSourcePower()
```


#### Returns


`str`  
Power in dBm.


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


### output()


Set the output state of the PSG.


Usage

``` python
output(state)
```


#### Parameters


`state: bool`  
If True, enable the output. If False, disable the output.


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


### readFreq()


Read the frequency parameter from the PSG.


Usage

``` python
readFreq()
```


#### Returns


`float`  
The output frequency in Hz.


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


### readSweepParams()


Read the sweep parameters from the device.


Usage

``` python
readSweepParams()
```


Frequencies are returned in Hz.


#### Returns


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

- fStart (float): The frequency at which the sweep starts.
- fStop (float): The frequency at which the sweep stops.


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


### reset()


Disable the signal modulation and turn off the output of the PSG.


Usage

``` python
reset()
```


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


### setLFO()


Configure the PSG low frequency output (LFO).


Usage

``` python
setLFO(
    LFO=True,
    source="INT",
    amplitude=3,
)
```


#### Parameters


`LFO: bool = ``True`  
If True, enable LFO. If False, disable LFO. Default is True.

`source: str = ``"INT"`  
The source of the low frequency output, which can take the values: internal:'INT', internal2:'INT2', function:'FUNC', function2:'FUNC2' internal & internal2: for the internal source function & function2: for an internal function generator which can be configured. Default is "INT".

`amplitude: float = ``3`  
Peak voltage (amplitude) of the low frequency output in volts, which can take values from 0-3.5V. Default is 3.


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


### setModulation()


Enable or disable the signal modulation.


Usage

``` python
setModulation(mod=False)
```


#### Parameters


`mod: bool = ``False`  
If True, enable modulation. If False, disable modulation. Default is False.


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


### setSourcePower()


Configure the PSG output power.


Usage

``` python
setSourcePower(power)
```


#### Parameters


`power: float`  
Power in dBm (setpoint between +25 and -20 dBm).


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


### startSweep()


Prepare the PSG for triggering a sweep.


Usage

``` python
startSweep()
```


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


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


### stopSweep()


Turn the PSG output off.


Usage

``` python
stopSweep()
```


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


### trigger()


Trigger the sweep(s).


Usage

``` python
trigger()
```


#### Notes

The function will wait for the sweep to complete before returning.
