# ``fn_gen`.`dg2052`.`DG2052``

class documentation

`class DG2052(pyvisa.resources.MessageBasedResource):`

Constructor: `DG2052(port)`

View In Hierarchy

This is an object representing the Rigol DG2052 function generator. This object uses the SCPI protocol for communicating with the Rigol DG2052 function generator.

Method | `__init__` | Initializes the DG2052 object
Method | `get_output_impedance` | Returns the output impedance.
Method | `get_output_load` | Returns the output load.
Method | `get_output_signal` | Returns the signal type and parameters.
Method | `get_output_state` | Returns the output state of the signal
Method | `get_output_volt_limits` | Gets the output volt limits of the specified channel
Method | `is_output_on` | Returns a boolean representing the state of the output
Method | `set_dc` | Sets the output channel to DC voltage mode
Method | `set_frequency` | Sets the frequency of the set signal
Method | `set_output` | Sets the output channel ON or OFF
Method | `set_ramp` | Sets the output channel to A Ramp (Triangular) Wave
Method | `set_sine_wave` | Sets the output channel to A Sine Wave
Method | `set_square_wave` | Sets the output channel to A Square Wave
Method | `set_sweep` | Sets the parameters of a signal sweep
Method | `toggle_output` | Toggles the corresponding output channel
Method | `trigger_sweep` | Triggers a sweep manually (Only works if the sweep was setup with `trigger_source` as `SweepTriggerSource.MANUAL`)
Method | `whoami` | Shows the identification of the connected instrument
Instance Variable | `__comm` | Undocumented
Instance Variable | `__port` | Undocumented
Instance Variable | `__rm` | Undocumented

def __init__(self, port: `str`):

Initializes the DG2052 object

Parameters

port:`str`

The SCPI port describing the device, consists of a communication method and device port followed by the "::INSTR" keyword. communication method: can be either `USB` or `TCPIP` (other communication methods are not supported for this device) device port: either `COMM4` or `/dev/USB0` for USB in windows and posix systems respectively or the IP Address for TCPIP

format: "`communication method`::`device port`::INSTR"

example: "`TCPI`::`192.168.1.11`::INSTR" or "`USB`::`COMM4`::INSTR"

def get_output_impedance(self, channel: `Literal[1, 2]`) -> `float`:

Returns the output impedance.

Parameters
channel:`Literal[`1, 2] | The output channel to get the impedance of
Returns
`float` | impedance - The impedance of the specified output channel

def get_output_load(self, channel: `Literal[1, 2]`) -> `float`:

Returns the output load.

Parameters
channel:`Literal[`1, 2] | The output channel to get the load of
Returns
`float` | load - The load of the specified output channel

def get_output_signal(self, channel: `Literal[1, 2]`) -> `str`:

Returns the signal type and parameters.

Parameters
channel:`Literal[`1, 2] | The output channel
Returns
`str` | signal - The indentifier string of the signal.

def get_output_state(self, channel: `Literal[1, 2]`) -> `str`:

Returns the output state of the signal

Parameters
channel:`Literal[`1, 2] | The output channel
Returns
`str` | state - The state of the output (is either `"ON"` or `"OFF"`)

def get_output_volt_limits(self, channel: `Literal[1, 2]`) -> `tuple[float, float]`:

Gets the output volt limits of the specified channel

Parameters
channel:`Literal[`1, 2] | The output channel of the device (either 1 or 2)
Returns
`tuple[float`, `float]` | The low voltage limit and the hight voltage limit

def is_output_on(self, channel: `Literal[1, 2]`) -> `bool`:

Returns a boolean representing the state of the output

Parameters
channel:`Literal[`1, 2] | The output channel
Returns
`bool` | state - The state of the output (is either `True` or `False`)

def set_dc(self, channel: `Literal[1, 2]`, offset: `float`):

Sets the output channel to DC voltage mode

Parameters
channel:`Literal[`1, 2] | The output channel
offset:`float` | The offset voltage

def set_frequency(self, channel: `Literal[1, 2]`, freq):

Sets the frequency of the set signal

Parameters
channel:`Literal[`1, 2] | The output channel
freq:`float` | The frequency

def set_output(self, channel: `Literal[1, 2]`, state: `bool`):

Sets the output channel ON or OFF

Parameters
channel:`Literal[`1, 2] | The output channel of the device (either 1 or 2)
state:`bool` | The state of the output channel

def set_ramp(self, channel: `Literal[1, 2]`, freq: `float` = 1000.0, amp: `float` = 5, offset: `float` = 0, phase: `int` = 0):

Sets the output channel to A Ramp (Triangular) Wave

Parameters
channel:`Literal[`1, 2] | The output channel
freq:`float`, default 1e3 | The frequency
amp:`float`, default 5.0 | The Vpp amplitude
offset:`float`, default 0.0 | The V offset
phase:`int`, default 0 | The phase shift

def set_sine_wave(self, channel: `Literal[1, 2]`, freq: `float` = 1000.0, amp: `float` = 5.0, offset: `float` = 0.0, phase: `int` = 0):

Sets the output channel to A Sine Wave

Parameters
channel:`Literal[`1, 2] | The output channel
freq:`float`, default 1e3 | The frequency
amp:`float`, default 5.0 | The Vpp amplitude
offset:`float`, default 0.0 | The V offset
phase:`int`, default 0 | The phase shift

def set_square_wave(self, channel: `Literal[1, 2]`, freq: `float` = 1000.0, amp: `float` = 5.0, offset: `float` = 0.0, phase: `int` = 0):

Sets the output channel to A Square Wave

Parameters
channel:`Literal[`1, 2] | The output channel
freq:`float`, default 1e3 | The frequency
amp:`float`, default 5.0 | The Vpp amplitude
offset:`float`, default 0.0 | The V offset
phase:`int`, default 0 | The phase shift

def set_sweep(self, channel: `Literal[1, 2]`, amp: `float` = 5, offset: `float` = 0, phase: `int` = 0, signal_type: `SweepSignalType` = SweepSignalType.SINE, htime_start: `float` = 0, htime_stop: `float` = 0, freq_start: `float` = 100, freq_stop: `float` = 1000.0, marker: `bool` = False, freq_marker: `float` = 550, rtime: `float` = 0, time: `float` = 1, spacing: `SweepSpacing` = SweepSpacing.LIN, step: `int` = 2, trigger_slope: `SweepTriggerSlope` = SweepTriggerSlope.POSITIVE, trigger_source: `SweepTriggerSource` = SweepTriggerSource.INTERNAL):

Sets the parameters of a signal sweep

Parameters
channel:`Literal[`1, 2] | Sets the output channel of the sweep function
amp:`float`, default 5 | Sets the amplitude of the sweeped signal
offset:`float`, default 0 | Sets the offset voltage of the sweeped signal
phase:`int`, default 0 | Sets the phase shift of the sweeped signal
signal_type:`SweepSignalType`, default `SweepSignalType.SINE` | Sets the type of signal being sweeped
htime_start:`float`, default 0 | Sets the start hold time of the sweep function
htime_stop:`float`, default 0 | Sets the stop hold time of the sweep function
freq_start:`float`, default 100 | Sets the sweep starting frequency
freq_stop:`float`, default 1e3 | Sets the sweep stopping frequency
marker:`bool`, default `False` | Enables/Disables setting the marker frequency manually
freq_marker:`float`, default 550 | Sets the marker frequency at whic the Sync signal changes from high to low
rtime:`float`, default 0 | Sets the return time of the sweep function
time:`float`, default 1 | Sets the sweep time
spacing:`SweepSpacing`, default `SweepSpacing.LIN` | Sets the sweep type
step:`int`, default 2 | Sets the number of steps of the sweep function
trigger_slope:`SweepTriggerSlope`, default `SweepTriggerSlope.POSITIVE` | Sets the edge type of the trigger input signal (for external trigger only)
trigger_source:`SweepTriggerSource`, default `SweepTriggerSource.INTERNAL` | Sets the sweep trigger source

def toggle_output(self, channel: `Literal[1, 2]`):

Toggles the corresponding output channel

Parameters
channel:`Literal[`1, 2] | The output channel of the device (either 1 or 2)

def trigger_sweep(self, channel: `Literal[1, 2]`):

Triggers a sweep manually (Only works if the sweep was setup with `trigger_source` as `SweepTriggerSource.MANUAL`)

Parameters
channel:`Literal[`1, 2] | Sets the output channel of the sweep function

def whoami(self) -> `str`:

Shows the identification of the connected instrument

Returns
`str` | The identification of the connected instrument

__comm: `CommMethod` =

Undocumented

__port: `str` =

Undocumented

__rm: `ResourceManager` =

Undocumented