qmi.instruments.tt.tgf

Instrument driver for the AimTTi TGF3000 Series and TGF4000 Series Function Generator / Frequency Counter.

Classes

CounterInputChannel(value)

Counter input channels.

FrequencyMeasurement(timestamp, frequency)

Frequency measurement produced by the instrument.

TT_TGF3162(context, name, transport)

Instrument driver for the AimTTi TGF3162 signal generator / frequency counter.

TT_TGF_3000_4000_Series(context, name, transport)

Instrument driver for the TGF3000 and TGF4000 Series function generators.

WaveformType(value)

Waveform types.

class qmi.instruments.tt.tgf.FrequencyMeasurement(timestamp: float, frequency: float)

Frequency measurement produced by the instrument.

timestamp

Approximate POSIX timestamp of measurement.

Type:

float

frequency

Measured frequency in Hz.

Type:

float

timestamp: float

Alias for field number 0

frequency: float

Alias for field number 1

count(value, /)

Return number of occurrences of value.

index(value, start=0, stop=9223372036854775807, /)

Return first index of value.

Raises ValueError if the value is not present.

class qmi.instruments.tt.tgf.WaveformType(value)

Waveform types.

class qmi.instruments.tt.tgf.CounterInputChannel(value)

Counter input channels.

class qmi.instruments.tt.tgf.TT_TGF_3000_4000_Series(context: QMI_Context, name: str, transport: str)

Instrument driver for the TGF3000 and TGF4000 Series function generators.

This driver has been tested with TGF3162 and TGF4242. It probably works with all TGF3000 and TGF4000 Series instruments.

This driver supports only a subset of the functionality of the instrument.

open() None

Connect to the instrument hardware.

When this method returns, the instrument must be ready for interaction via calls to instrument-specific methods.

Subclasses can extend this method to implement instrument-specific initialization. If they do, they should call super().open() as a last statement.

close() None

Close the connection to the instrument hardware and release associated resources.

When this method returns, the instrument must not be used again unless it is first re-opened by calling the open() method.

Subclasses can extend this method if they have specific resources to close. If they do, they should call super().close() as a last statement.

get_idn() QMI_InstrumentIdentification

Read instrument type and version and return QMI_InstrumentIdentification instance.

reset() None

Reset the instrument, returning most settings to defaults.

set_output_enabled(channel: int, enable: bool) None

Enable or disable the specified output channel.

Parameters:
  • channel – Channel index (1 or 2).

  • enable – True to enable output, False to disable.

set_output_inverted(channel: int, invert: bool) None

Enable or disable inverted output.

Parameters:
  • channel – Channel index (1 or 2).

  • invert – True to enable inverted output; False to disable.

set_output_load_impedance(channel: int, impedance: float) None

Configure the assumed load impedance.

Note: The actual output impedance of the instrument is fixed at 50 Ohm. This command configures the assumed impedance of the load that is connected to the output. This affects the calculation of output voltage levels.

Parameters:
  • channel – Channel index (1 or 2).

  • impedance – Assumed load impedance in Ohm, range 1 to 10000, or math.inf to assume open circuit.

set_waveform(channel: int, waveform: WaveformType) None

Set waveform type.

This driver currently supports only a subset of the waveforms

This command may fail if the selected waveform does not support the current frequency. In that case, the frequency must first be adjusted by calling set_frequency().

Parameters:
  • channel – Channel index (1 or 2).

  • waveform – Waveform type (a WaveformType.XXX constant).

set_frequency(channel: int, frequency: float) None

Change the output frequency.

This function is only supported for waveform types SINE, SQUARE and RAMP.

Parameters:
  • channel – Channel index (1 or 2).

  • frequency – Frequency in Hz.

set_square_duty_cycle(channel: int, duty_cycle: float) None

Set the duty cycle of the square wave.

This function is only supported for waveform type SQUARE.

Parameters:
  • channel – Channel index (1 or 2).

  • duty_cycle – Duty cycle as a percentage between 0.0 and 100.0; actual range also depends on the frequency.

set_ramp_symmetry(channel: int, symmetry: float) None

Set the symmetry of the ramp waveform.

The symmetry represents the duration of the rising edge as a percentage of the waveform period.

Symmetry level 50% means a symmetric triangular wave where rising edge and falling edge have the same duration. Symmetry level 0% means instantaneous rise followed by slow falling edge. Symmetry level 100% means slow rising edge followed by instantaneous drop.

This function is only supported for waveform type RAMP.

Parameters:
  • channel – Channel index (1 or 2).

  • symmetry – Symmetry as a percentage in range 0.0 to 100.0.

set_amplitude(channel: int, amplitude: float, offset: float) None

Set output amplitude and offset.

Note that both amplitude and offset are configured with respect to an assumed output load impedance. If the configured impedance does not match the actual load impedance, the actual output voltage will not match the configured voltage.

Parameters:
  • channel – Channel index (1 or 2).

  • amplitude – Peak-to-peak signal amplitude in Vpp.

  • offset – Offset level in Volt.

set_phase(channel: int, phase: float) None

Set the phase offset of the waveform.

Parameters:
  • channel – Channel index (1 or 2).

  • phase – Phase offset in degrees (range 0.0 to 360.0).

get_external_reference_enabled() bool

Return True if the external reference clock input is selected.

set_external_reference_enabled(enable: bool) None

Enable or disable external 10 MHz reference clock input.

Parameters:

enable – True to enable the external reference clock input; False to select the internal reference clock.

set_counter_enabled(enable: bool) None

Enable or disable the frequency counter function.

Parameters:

enable – True to enable the frequency counter; False to disable.

set_counter_input(input: CounterInputChannel) None

Select the counter input channel.

Parameters:

inputCounterInputChannel.TRIG_IN or CounterInputChannel.REF_IN.

read_frequency() FrequencyMeasurement

Read the currently measured counter value.

This function only supports frequency measurement mode. The alternative measurement modes (period, width and duty-cycle) are not supported.

Returns:

Measured frequency as a FrequencyMeasurement tuple.

set_local() None

Switch the instrument to local mode.

Every remote command or query causes the instrument to enter remote mode. In remote mode, most front-panel keys are not functional.

This function returns the instrument to local mode. It is equivalent to pushing the “LOCAL” button on the front panel.

force_unlock() None

Forcefully unlock the remote object.

This unlocks the object, regardless of who owns the lock. This allows you to unlock an object if the locking proxy has been destroyed without unlocking.

Use this with care.

Do not override this stub method in subclasses. It has already been implemented in QMI_RpcProxy.

classmethod get_category() str | None

Return the optional name of the category this object belongs to.

A category name is a free-form string that has no special significance. Its purpose is to distinguish between groups of RPC objects that fulfill similar roles.

get_name() str

Return the name of this object.

Returns:

name attribute.

get_signals() list[SignalDescription]

Return a list of signals that can be published by this object.

Returns:

List consisting of qmi_signals attributes.

is_locked() bool

Query if the remote object is locked.

Do not override this stub method in subclasses. It has already been implemented in QMI_RpcProxy.

is_open() bool

Return True if the instrument is open (ready for interaction).

lock(timeout: float = 0.0, lock_token: str | None = None) bool

Lock the remote object. If timeout is given, try every 0.1s within the given timeout value. The remote object can be locked with an optional custom lock token by giving a string into lock_token keyword argument.

If successful, this proxy is the only proxy that can invoke RPC methods on the remote object; other proxies will receive an “object is locked” response. The return value indicates if the lock was granted; a denied lock means the object was already locked by another proxy.

Do not override this stub method in subclasses. It has already been implemented in QMI_RpcProxy.

release_rpc_object() None

Give a warning if the instrument is removed while still open.

unlock(lock_token: str | None = None) bool

Unlock the remote object.

Without optional parameters, this is only allowed by the proxy that initially locked the object. By giving the lock token as an input parameter, the specific object locked by this token can be unlocked. The return value indicates if the unlocking was successful.

Do not override this stub method in subclasses. It has already been implemented in QMI_RpcProxy.

class qmi.instruments.tt.tgf.TT_TGF3162(context: QMI_Context, name: str, transport: str)

Instrument driver for the AimTTi TGF3162 signal generator / frequency counter.

close() None

Close the connection to the instrument hardware and release associated resources.

When this method returns, the instrument must not be used again unless it is first re-opened by calling the open() method.

Subclasses can extend this method if they have specific resources to close. If they do, they should call super().close() as a last statement.

force_unlock() None

Forcefully unlock the remote object.

This unlocks the object, regardless of who owns the lock. This allows you to unlock an object if the locking proxy has been destroyed without unlocking.

Use this with care.

Do not override this stub method in subclasses. It has already been implemented in QMI_RpcProxy.

classmethod get_category() str | None

Return the optional name of the category this object belongs to.

A category name is a free-form string that has no special significance. Its purpose is to distinguish between groups of RPC objects that fulfill similar roles.

get_external_reference_enabled() bool

Return True if the external reference clock input is selected.

get_idn() QMI_InstrumentIdentification

Read instrument type and version and return QMI_InstrumentIdentification instance.

get_name() str

Return the name of this object.

Returns:

name attribute.

get_signals() list[SignalDescription]

Return a list of signals that can be published by this object.

Returns:

List consisting of qmi_signals attributes.

is_locked() bool

Query if the remote object is locked.

Do not override this stub method in subclasses. It has already been implemented in QMI_RpcProxy.

is_open() bool

Return True if the instrument is open (ready for interaction).

lock(timeout: float = 0.0, lock_token: str | None = None) bool

Lock the remote object. If timeout is given, try every 0.1s within the given timeout value. The remote object can be locked with an optional custom lock token by giving a string into lock_token keyword argument.

If successful, this proxy is the only proxy that can invoke RPC methods on the remote object; other proxies will receive an “object is locked” response. The return value indicates if the lock was granted; a denied lock means the object was already locked by another proxy.

Do not override this stub method in subclasses. It has already been implemented in QMI_RpcProxy.

open() None

Connect to the instrument hardware.

When this method returns, the instrument must be ready for interaction via calls to instrument-specific methods.

Subclasses can extend this method to implement instrument-specific initialization. If they do, they should call super().open() as a last statement.

read_frequency() FrequencyMeasurement

Read the currently measured counter value.

This function only supports frequency measurement mode. The alternative measurement modes (period, width and duty-cycle) are not supported.

Returns:

Measured frequency as a FrequencyMeasurement tuple.

release_rpc_object() None

Give a warning if the instrument is removed while still open.

reset() None

Reset the instrument, returning most settings to defaults.

set_amplitude(channel: int, amplitude: float, offset: float) None

Set output amplitude and offset.

Note that both amplitude and offset are configured with respect to an assumed output load impedance. If the configured impedance does not match the actual load impedance, the actual output voltage will not match the configured voltage.

Parameters:
  • channel – Channel index (1 or 2).

  • amplitude – Peak-to-peak signal amplitude in Vpp.

  • offset – Offset level in Volt.

set_counter_enabled(enable: bool) None

Enable or disable the frequency counter function.

Parameters:

enable – True to enable the frequency counter; False to disable.

set_counter_input(input: CounterInputChannel) None

Select the counter input channel.

Parameters:

inputCounterInputChannel.TRIG_IN or CounterInputChannel.REF_IN.

set_external_reference_enabled(enable: bool) None

Enable or disable external 10 MHz reference clock input.

Parameters:

enable – True to enable the external reference clock input; False to select the internal reference clock.

set_frequency(channel: int, frequency: float) None

Change the output frequency.

This function is only supported for waveform types SINE, SQUARE and RAMP.

Parameters:
  • channel – Channel index (1 or 2).

  • frequency – Frequency in Hz.

set_local() None

Switch the instrument to local mode.

Every remote command or query causes the instrument to enter remote mode. In remote mode, most front-panel keys are not functional.

This function returns the instrument to local mode. It is equivalent to pushing the “LOCAL” button on the front panel.

set_output_enabled(channel: int, enable: bool) None

Enable or disable the specified output channel.

Parameters:
  • channel – Channel index (1 or 2).

  • enable – True to enable output, False to disable.

set_output_inverted(channel: int, invert: bool) None

Enable or disable inverted output.

Parameters:
  • channel – Channel index (1 or 2).

  • invert – True to enable inverted output; False to disable.

set_output_load_impedance(channel: int, impedance: float) None

Configure the assumed load impedance.

Note: The actual output impedance of the instrument is fixed at 50 Ohm. This command configures the assumed impedance of the load that is connected to the output. This affects the calculation of output voltage levels.

Parameters:
  • channel – Channel index (1 or 2).

  • impedance – Assumed load impedance in Ohm, range 1 to 10000, or math.inf to assume open circuit.

set_phase(channel: int, phase: float) None

Set the phase offset of the waveform.

Parameters:
  • channel – Channel index (1 or 2).

  • phase – Phase offset in degrees (range 0.0 to 360.0).

set_ramp_symmetry(channel: int, symmetry: float) None

Set the symmetry of the ramp waveform.

The symmetry represents the duration of the rising edge as a percentage of the waveform period.

Symmetry level 50% means a symmetric triangular wave where rising edge and falling edge have the same duration. Symmetry level 0% means instantaneous rise followed by slow falling edge. Symmetry level 100% means slow rising edge followed by instantaneous drop.

This function is only supported for waveform type RAMP.

Parameters:
  • channel – Channel index (1 or 2).

  • symmetry – Symmetry as a percentage in range 0.0 to 100.0.

set_square_duty_cycle(channel: int, duty_cycle: float) None

Set the duty cycle of the square wave.

This function is only supported for waveform type SQUARE.

Parameters:
  • channel – Channel index (1 or 2).

  • duty_cycle – Duty cycle as a percentage between 0.0 and 100.0; actual range also depends on the frequency.

set_waveform(channel: int, waveform: WaveformType) None

Set waveform type.

This driver currently supports only a subset of the waveforms

This command may fail if the selected waveform does not support the current frequency. In that case, the frequency must first be adjusted by calling set_frequency().

Parameters:
  • channel – Channel index (1 or 2).

  • waveform – Waveform type (a WaveformType.XXX constant).

unlock(lock_token: str | None = None) bool

Unlock the remote object.

Without optional parameters, this is only allowed by the proxy that initially locked the object. By giving the lock token as an input parameter, the specific object locked by this token can be unlocked. The return value indicates if the unlocking was successful.

Do not override this stub method in subclasses. It has already been implemented in QMI_RpcProxy.