Tektronix Function Generators

Driver module for Tektronix function generators. Currently supports:

  • AFG 3000 series
class instrumental.drivers.funcgenerators.tektronix.AFG_3000(visa_inst)

Methods

AM_enabled([channel]) Returns whether amplitude modulation is enabled.
FM_enabled([channel]) Returns whether frequency modulation is enabled.
FSK_enabled([channel]) Returns whether frequency-shift keying modulation is enabled.
PM_enabled([channel]) Returns whether phase modulation is enabled.
PWM_enabled([channel]) Returns whether pulse width modulation is enabled.
burst_enabled([channel]) Returns whether burst mode is enabled.
disable_AM([channel]) Disable amplitude modulation mode.
disable_FM([channel]) Disable frequency modulation mode.
disable_FSK([channel]) Disable frequency-shift keying mode.
disable_PM([channel]) Disable phase modulation mode.
disable_PWM([channel]) Disable pulse width modulation mode.
disable_burst([channel]) Disable burst mode.
enable_AM([enable, channel]) Enable amplitude modulation mode.
enable_FM([enable, channel]) Enable frequency modulation mode.
enable_FSK([enable, channel]) Enable frequency-shift keying mode.
enable_PM([enable, channel]) Enable phase modulation mode.
enable_PWM([enable, channel]) Enable pulse width modulation mode.
enable_burst([enable, channel]) Enable burst mode.
get_dbm([channel]) Get the amplitude of the current waveform in dBm.
get_ememory() Get array of data from edit memory.
get_frequency([channel]) Get the frequency to be used in fixed frequency mode.
get_frequency_mode([channel]) Get the frequency mode.
get_vpp([channel]) Get the peak-to-peak voltage of the current waveform.
get_vrms([channel]) Get the RMS voltage of the current waveform.
set_am_depth(depth[, channel]) Set depth of amplitude modulation.
set_arb_func(data[, interp, num_pts]) Write arbitrary waveform data to EditMemory.
set_dbm(dbm[, channel]) Set the amplitude of the current waveform in dBm.
set_frequency(freq[, change_mode, channel]) Set the frequency to be used in fixed frequency mode.
set_frequency_mode(mode[, channel]) Set the frequency mode.
set_function(**kwargs) Set selected function parameters.
set_function_shape(shape[, channel]) Set shape of output function.
set_high(high[, channel]) Set the high voltage level of the current waveform.
set_low(low[, channel]) Set the low voltage level of the current waveform.
set_offset(offset[, channel]) Set the voltage offset of the current waveform.
set_phase(phase[, channel]) Set the phase offset of the current waveform.
set_sweep([channel]) Set selected sweep parameters.
set_sweep_center(center[, channel]) Set the sweep frequency center.
set_sweep_hold_time(time[, channel]) Set the hold time of the sweep.
set_sweep_return_time(time[, channel]) Set the return time of the sweep.
set_sweep_spacing(spacing[, channel]) Set whether a sweep is linear or logarithmic.
set_sweep_span(span[, channel]) Set the sweep frequency span.
set_sweep_start(start[, channel]) Set the sweep start frequency.
set_sweep_stop(stop[, channel]) Set the sweep stop frequency.
set_sweep_time(time[, channel]) Set the sweep time.
set_vpp(vpp[, channel]) Set the peak-to-peak voltage of the current waveform.
set_vrms(vrms[, channel]) Set the amplitude of the current waveform in dBm.
sweep_enabled([channel]) Whether the frequency mode is sweep.
AM_enabled(channel=1)

Returns whether amplitude modulation is enabled.

Returns:

bool

Whether AM is enabled.

FM_enabled(channel=1)

Returns whether frequency modulation is enabled.

Returns:

bool

Whether FM is enabled.

FSK_enabled(channel=1)

Returns whether frequency-shift keying modulation is enabled.

Returns:

bool

Whether FSK is enabled.

PM_enabled(channel=1)

Returns whether phase modulation is enabled.

Returns:

bool

Whether PM is enabled.

PWM_enabled(channel=1)

Returns whether pulse width modulation is enabled.

Returns:

bool

Whether PWM is enabled.

__init__(visa_inst)

Constructor for an AFG 3000 Function Generator object. End users should not use this directly, and should instead use instrument()

burst_enabled(channel=1)

Returns whether burst mode is enabled.

Returns:

bool

Whether burst mode is enabled.

disable_AM(channel=1)

Disable amplitude modulation mode.

disable_FM(channel=1)

Disable frequency modulation mode.

disable_FSK(channel=1)

Disable frequency-shift keying mode.

disable_PM(channel=1)

Disable phase modulation mode.

disable_PWM(channel=1)

Disable pulse width modulation mode.

disable_burst(channel=1)

Disable burst mode.

enable_AM(enable=True, channel=1)

Enable amplitude modulation mode.

Parameters:

enable : bool, optional

Whether to enable or disable AM

enable_FM(enable=True, channel=1)

Enable frequency modulation mode.

Parameters:

enable : bool, optional

Whether to enable or disable FM

enable_FSK(enable=True, channel=1)

Enable frequency-shift keying mode.

Parameters:

enable : bool, optional

Whether to enable or disable FSK

enable_PM(enable=True, channel=1)

Enable phase modulation mode.

Parameters:

enable : bool, optional

Whether to enable or disable PM

enable_PWM(enable=True, channel=1)

Enable pulse width modulation mode.

Parameters:

enable : bool, optional

Whether to enable or disable PWM

enable_burst(enable=True, channel=1)

Enable burst mode.

Parameters:

enable : bool, optional

Whether to enable or disable burst mode.

get_dbm(channel=1)

Get the amplitude of the current waveform in dBm.

Note that this returns a float, not a pint.Quantity

Returns:

dbm : float

The current waveform’s dBm amplitude

get_ememory()

Get array of data from edit memory.

Returns:

numpy.array

Data retrieved from the AFG’s edit memory.

get_frequency(channel=1)

Get the frequency to be used in fixed frequency mode.

get_frequency_mode(channel=1)

Get the frequency mode.

Returns:

‘fixed’ or ‘sweep’

The frequency mode

get_vpp(channel=1)

Get the peak-to-peak voltage of the current waveform.

Returns:

vpp : pint.Quantity

The current waveform’s peak-to-peak voltage

get_vrms(channel=1)

Get the RMS voltage of the current waveform.

Returns:

vrms : pint.Quantity

The current waveform’s RMS voltage

set_am_depth(depth, channel=1)

Set depth of amplitude modulation.

Parameters:

depth : number

Depth of modulation in percent. Must be between 0.0% and 120.0%. Has resolution of 0.1%.

set_arb_func(data, interp=None, num_pts=10000)

Write arbitrary waveform data to EditMemory.

Parameters:

data : array_like

A 1D array of real values to be used as evenly-spaced points. The values will be normalized to extend from 0 t0 16382. It must have a length in the range [2, 131072]

interp : str or int, optional

Interpolation to use for smoothing out data. None indicates no interpolation. Values include (‘linear’, ‘nearest’, ‘zero’, ‘slinear’, ‘quadratic’, ‘cubic’), or an int to specify the order of spline interpolation. See scipy.interpolate.interp1d for details.

num_pts : int

Number of points to use in interpolation. Default is 10000. Must be greater than or equal to the number of points in data, and at most 131072.

set_dbm(dbm, channel=1)

Set the amplitude of the current waveform in dBm.

Note that this returns a float, not a pint.Quantity

Parameters:

dbm : float

The current waveform’s dBm amplitude

set_frequency(freq, change_mode=True, channel=1)

Set the frequency to be used in fixed frequency mode.

Parameters:

freq : pint.Quantity

The frequency to be used in fixed frequency mode.

change_mode : bool, optional

If True, will set the frequency mode to fixed.

set_frequency_mode(mode, channel=1)

Set the frequency mode.

In fixed mode, the waveform’s frequency is kept constant. In sweep mode, it is swept according to the sweep settings.

Parameters:

mode : {‘fixed’, ‘sweep’}

Mode to switch to.

set_function(**kwargs)

Set selected function parameters. Useful for setting multiple parameters at once. See individual setters for more details.

When setting the waveform amplitude, you may use up to two of high, low, offset, and vpp/vrms/dbm.

Parameters:

shape : {‘SINusoid’, ‘SQUare’, ‘PULSe’, ‘RAMP’, ‘PRNoise’, ‘DC’, ‘SINC’, ‘GAUSsian’, ‘LORentz’, ‘ERISe’, ‘EDECay’, ‘HAVersine’,

‘USER1’, ‘USER2’, ‘USER3’, ‘USER4’, ‘EMEMory’}, optional

Shape of the waveform. Case-insenitive, abbreviation or full string.

phase : pint.Quantity or string or number, optional

Phase of the waveform in radian-compatible units.

vpp, vrms, dbm : pint.Quantity or string, optional

Amplitude of the waveform in volt-compatible units.

offset : pint.Quantity or string, optional

Offset of the waveform in volt-compatible units.

high : pint.Quantity or string, optional

High level of the waveform in volt-compatible units.

low : pint.Quantity or string, optional

Low level of the waveform in volt-compatible units.

channel : {1, 2}, optional

Output channel to modify. Some models may have only one channel.

set_function_shape(shape, channel=1)

Set shape of output function.

Parameters:

shape : {‘SINusoid’, ‘SQUare’, ‘PULSe’, ‘RAMP’, ‘PRNoise’, ‘DC’, ‘SINC’, ‘GAUSsian’, ‘LORentz’, ‘ERISe’, ‘EDECay’, ‘HAVersine’, ‘USER1’, ‘USER2’, ‘USER3’, ‘USER4’, ‘EMEMory’}, optional

Shape of the waveform. Case-insenitive string that contains a valid shape or its abbreviation. The abbreviations are indicated above by capitalization. For example, sin, SINUSOID, and SiN are all valid inputs, while sinus is not.

channel : {1, 2}, optional

Output channel to modify. Some models may have only one channel.

set_high(high, channel=1)

Set the high voltage level of the current waveform.

This changes the high level while keeping the low level fixed.

Parameters:

high : pint.Quantity

The new high level in volt-compatible units

set_low(low, channel=1)

Set the low voltage level of the current waveform.

This changes the low level while keeping the high level fixed.

Parameters:

low : pint.Quantity

The new low level in volt-compatible units

set_offset(offset, channel=1)

Set the voltage offset of the current waveform.

This changes the offset while keeping the amplitude fixed.

Parameters:

offset : pint.Quantity

The new voltage offset in volt-compatible units

set_phase(phase, channel=1)

Set the phase offset of the current waveform.

Parameters:

phase : pint.Quantity or number

The new low level in radian-compatible units. Unitless numbers are treated as radians.

set_sweep(channel=1, **kwargs)

Set selected sweep parameters.

Automatically enables sweep mode.

Parameters:

start : pint.Quantity

The start frequency of the sweep in Hz-compatible units

stop : pint.Quantity

The stop frequency of the sweep in Hz-compatible units

span : pint.Quantity

The frequency span of the sweep in Hz-compatible units

center : pint.Quantity

The center frequency of the sweep in Hz-compatible units

sweep_time : pint.Quantity

The sweep time in second-compatible units. Must be between 1 ms and 300 s

hold_time : pint.Quantity

The hold time in second-compatible units

return_time : pint.Quantity

The return time in second-compatible units

spacing : {‘linear’, ‘lin’, ‘logarithmic’, ‘log’}

The spacing in time of the sweep frequencies

set_sweep_center(center, channel=1)

Set the sweep frequency center.

This sets the sweep center frequency while keeping the sweep frequency span fixed. The start and stop frequencies will be changed.

Parameters:

center : pint.Quantity

The center frequency of the sweep in Hz-compatible units

set_sweep_hold_time(time, channel=1)

Set the hold time of the sweep.

The hold time is the amount of time that the frequency is held constant after reaching the stop frequency.

Parameters:

time : pint.Quantity

The hold time in second-compatible units

set_sweep_return_time(time, channel=1)

Set the return time of the sweep.

The return time is the amount of time that the frequency spends sweeping from the stop frequency back to the start frequency. This does not include hold time.

Parameters:

time : pint.Quantity

The return time in second-compatible units

set_sweep_spacing(spacing, channel=1)

Set whether a sweep is linear or logarithmic.

Parameters:

spacing : {‘linear’, ‘lin’, ‘logarithmic’, ‘log’}

The spacing in time of the sweep frequencies

set_sweep_span(span, channel=1)

Set the sweep frequency span.

This sets the sweep frequency span while keeping the center frequency fixed. The start and stop frequencies will be changed.

Parameters:

span : pint.Quantity

The frequency span of the sweep in Hz-compatible units

set_sweep_start(start, channel=1)

Set the sweep start frequency.

This sets the start frequency while keeping the stop frequency fixed. The span and center frequencies will be changed.

Parameters:

start : pint.Quantity

The start frequency of the sweep in Hz-compatible units

set_sweep_stop(stop, channel=1)

Set the sweep stop frequency.

This sets the stop frequency while keeping the start frequency fixed. The span and center frequencies will be changed.

Parameters:

stop : pint.Quantity

The stop frequency of the sweep in Hz-compatible units

set_sweep_time(time, channel=1)

Set the sweep time.

The sweep time does not include hold time or return time. Sweep time must be between 1 ms and 300 s.

Parameters:

time : pint.Quantity

The sweep time in second-compatible units. Must be between 1 ms and 200 s

set_vpp(vpp, channel=1)

Set the peak-to-peak voltage of the current waveform.

Parameters:

vpp : pint.Quantity

The new peak-to-peak voltage

set_vrms(vrms, channel=1)

Set the amplitude of the current waveform in dBm.

Parameters:

vrms : pint.Quantity

The new RMS voltage

sweep_enabled(channel=1)

Whether the frequency mode is sweep.

Just a convenience method to avoid writing get_frequency_mode() == 'sweep'.

Returns:

bool

Whether the frequency mode is sweep