Tektronix Function Generators

Driver module for Tektronix function generators. Currently supports:

  • AFG 3000 series
class instrumental.drivers.funcgenerators.tektronix.AFG_3000(visa_inst)
AM_enabled(channel=1)

Returns whether amplitude modulation is enabled.

Returns:Whether AM is enabled.
Return type:bool
FM_enabled(channel=1)

Returns whether frequency modulation is enabled.

Returns:Whether FM is enabled.
Return type:bool
FSK_enabled(channel=1)

Returns whether frequency-shift keying modulation is enabled.

Returns:Whether FSK is enabled.
Return type:bool
PM_enabled(channel=1)

Returns whether phase modulation is enabled.

Returns:Whether PM is enabled.
Return type:bool
PWM_enabled(channel=1)

Returns whether pulse width modulation is enabled.

Returns:Whether PWM is enabled.
Return type:bool
__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:Whether burst mode is enabled.
Return type:bool
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 – The current waveform’s dBm amplitude
Return type:float
get_ememory()

Get array of data from edit memory.

Returns:Data retrieved from the AFG’s edit memory.
Return type:numpy.array
get_frequency(channel=1)

Get the frequency to be used in fixed frequency mode.

get_frequency_mode(channel=1)

Get the frequency mode.

Returns:The frequency mode
Return type:‘fixed’ or ‘sweep’
get_vpp(channel=1)

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

Returns:vpp – The current waveform’s peak-to-peak voltage
Return type:pint.Quantity
get_vrms(channel=1)

Get the RMS voltage of the current waveform.

Returns:vrms – The current waveform’s RMS voltage
Return type:pint.Quantity
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',) –
  • 'USER2', 'USER3', 'USER4', 'EMEMory'}, optional ('USER1',) – 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.
  • vrms, dbm (vpp,) – 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:Whether the frequency mode is sweep
Return type:bool