MG3694C module

Created on Wed Dec 1 07:00:19 2021

@author: Martin.Mihylov

Currently the Anritsu MG3694C Signal Generator is in dynamic DHCP mode!!!
  1. Make sure Instrument and PC are connected vie ethernet cable.

  2. In the Windows terminal run: arp -a

  3. Find the IP-Adress corresponding to the MAC:Adress printed on the device

  4. If it does not show up try opening NI-MAX and run auto-discover.

  5. Try “arp -a” again.

Legacy instructions (not applicable as of 13.01.2026):
  1. Go to Network Adapter Settings -> ‘Internetprotocoll, Version 4(TCP/IPv4)’

  2. Change the IP-Address from ‘automatic’ to ‘static’ and give the IP:192.168.0.1

  3. DNS will be filled automatically! Press ‘OK’ and leave.

  4. The standard IP of the instrument is: 192.168.0.254

  5. After your measurement dont forget to change the IP back to ‘automatic’!

class Instruments_Libraries.MG3694C.MG3694C(resource_str='169.254.20.95', visa_library='@ivi', **kwargs)[source]

Bases: BaseInstrument

This class uses pyvisa to connect to an Anritsu MG3694C Signal Generator.

Parameters:
  • resource_str (str)

  • visa_library (str)

abort()[source]

Forces the trigger system to the idle state. Any sweep in progress is aborted as soon as possible.

Parameters: None

connect()[source]
get_am_internal_freq()[source]

Requests the currently programmed modulating waveform frequency value for the internal AM function.

Return type:

float

get_am_internal_wave()[source]

Requests the currently selected modulating waveform for the internal AM function.

Return type:

str

get_am_logdepth()[source]

Requests the currently programmed modulation depth value for the internal AM Log mode.

Return type:

float

get_am_logsens()[source]

Requests the currently programmed AM sensitivity value for the external AM Log mode.

Return type:

float

get_am_state()[source]

Requests currently programmed amplitude modulation state (on/off)

Return type:

str

get_am_type()[source]

Requests the currently programmed AM operating mode.

Return type:

str

get_data()[source]

Return a dictionary with the measured Power and CW Frequency.

Return type:

dict[str, float]

get_fm_bwidth()[source]

Requests the currently programmed Unlocked FM synthesis mode of operation (narrow or wide).

Return type:

str

get_fm_internal_freq()[source]

Requests the currently programmed modulating waveform frequency value for the internal FM function.

Return type:

float

get_fm_internal_wave()[source]

Requests the currently selected modulating waveform for the internal FM function.

Return type:

str

get_fm_mode()[source]

Requests the currently programmed synthesis mode used to generate the FM signal.

Return type:

str

get_fm_state()[source]

Requests the currently programmed frequency modulation state (on/off).

Return type:

str

get_freq_center_freq()[source]

Requests the current value of the RF output center frequency.

Return type:

float

get_freq_cw()[source]

Requests the current value of the frequency parameter.

Return type:

float

get_freq_mode()[source]

Requests the currently selected programming mode for frequency control.

Return type:

str

get_freq_span()[source]

Requests the current value for SWEep[1] sweep span.

Return type:

float

get_freq_start()[source]

Requests the current value for SWEep[1] start frequency.

Return type:

float

get_freq_step()[source]

Requests the current step increment value of the frequency parameter.

Return type:

float

get_freq_stop()[source]

Requests the current value for SWEep[1] stop frequency.

Return type:

float

get_freq_unit()[source]

Requests the currently selected frequency unit.

Return type:

str

get_maximal_power_level()[source]

Requests the maximum RF output power level value that can be programmed for the particular MG369xC model.

Return type:

float

get_output_impedance()[source]

Queries the MG369xC RF output impedance. The impedance is nominally 50 ohms and is not settable.

Return type:

float

get_output_power_level()[source]

Requests the value currently programmed for the RF output power level.

Return type:

float

get_output_protection()[source]

Requests the currently programmed state of the MG369xC RF output during frequency changes in CW or step sweep mode.

Return type:

str

get_output_retrace()[source]

Requests the currently programmed state of the MG369xC RF output during sweep retrace.

Return type:

str

get_pm_bwidth()[source]

Requests the currently programmed phase modulation operating mode.

Return type:

str

get_pm_internal_freq()[source]

Requests the currently programmed modulating waveform frequency value for the internal phase modulation function.

Return type:

float

get_pm_internal_wave()[source]

Requests the currently selected modulating waveform for the internal phase modulation function.

Return type:

str

get_pm_state()[source]

Requests the currently programmed phase modulation state (on/off).

Return type:

str

query(command)[source]

Send a query and return the response string. The instrument’s response is stripped of whitespace.

Parameters:

command (str) – SCPI query string.

Return type:

str

read()[source]

Read raw response string from the instrument.

Return type:

str

reconnect()[source]
set_am_internal_freq(value, unit)[source]

Sets the frequency of the modulating waveform for the internal AM function (see :AM:INTernal:WAVE).

Parameters:
  • value (int | float) – Frequency Range: 0.1 Hz to 1 MHz for sine wave. 0.1 Hz to 100 kHz for square, triangle, and ramp waveforms. Default: 1 kHz

  • unit (str) – Unit of the frequency (Hz, kHz, MHz)

Return type:

None

set_am_internal_wave(state)[source]

Selects the modulating waveform (from the internal AM generator) for the internal AM function.

Parameters:

state (str) –

  • 'SINE' - Sine wave

  • 'GAUSsian' - Gaussian noise

  • 'RDOWn' - Negative ramp

  • 'RUP' - Positive ramp

  • 'SQUare' - Square wave

  • 'TRIangle' - Triangle wave

  • 'UNIForm' - Uniform noise

Return type:

None

set_am_logdepth(value)[source]

Sets the modulation depth of the AM signal in the internal AM Log mode.

Parameters:

value (int | float) – Modulation depth (in dB). Valid range is 0 to 25 dB. Default is 3 dB.

Return type:

None

set_am_logsens(value)[source]

Sets the AM sensitivity for the external AM Log mode.

Parameters:

value (int | float) – Sensitivity (in dB/V) Range: 0 to 25 dB/V Default: 3 dB/V

Return type:

None

set_am_state(state)[source]

Enable/disable amplitude modulation of MG369xC RF output signal.

Parameters:

state (str | int) – Default: OFF * ON | OFF | 1 | 0

Return type:

None

set_am_type(state)[source]

Selects the AM operating mode.

Parameters:

state (str) – Default: LINear * LINear | LOGarithmic

Return type:

None

set_correction_commands(state)[source]

Turns the selected user level flatness correction power-offset table on/off.

Parameters:

state (str | int) – Default: OFF * ON | OFF | 1 | 0

Return type:

None

set_fm_bwidth(state)[source]

Sets the Unlocked FM synthesis mode to wide or narrow mode of operation. The Unlocked Wide FM synthesis mode allows maximum deviations of ±100 MHz for DC to 100 Hz rates. The Unlocked Narrow FM synthesis mode allows maximum deviations of ±10 MHz for DC to 8 MHz rates.

Parameters:

state (str) –

  • MIN = narrow mode

  • MAX = wide mode

Default: MIN

Return type:

None

set_fm_internal_freq(value, unit)[source]

Sets the frequency of the modulating waveform for the internal FM function (see :FM:INTernal:WAVE).

Parameters:
  • value (int | float) – Frequency Range: 0.1 Hz to 1 MHz for sine wave. 0.1 Hz to 100 kHz for square, triangle, and ramp waveforms. Default: 1 kHz

  • unit (str) – Unit of the frequency (Hz, kHz, MHz)

Return type:

None

set_fm_internal_wave(state)[source]

Selects the modulating waveform (from the internal FM generator) for the internal FM function.

Parameters:

state (str) –

Default: SINE

  • SINE = Sine wave

  • GAUSsian = Gaussian noise

  • RDOWn = Negative ramp

  • RUP =Positive ramp

  • SQUare = Square wave

  • TRIangle = Triangle wave

  • UNIForm = Uniform noise

Return type:

None

set_fm_mode(state)[source]

Selects the synthesis mode employed in generating the FM signal. If LOCKed[1] or LOCKed2 is set, the YIG phase-locked loop is used in synthesizing the FM signal. If UNLocked is set, the YIG phase-lock loop is disabled and the FM signal is obtained by applying the modulating signal to the tuning coils of the YIG-tuned oscillator.

Parameters:

state (str) –

Default: UNLocked

  • LOCKed[1] = Locked Narrow FM

  • LOCKed2 = Locked Narrow Low-Noise FM

  • UNLocked = Unlocked FM

Return type:

None

set_fm_state(state)[source]

Enable/disable frequency modulation of MG369xC RF output signal.

Parameters:

state (str | int) – Default: OFF * ON | OFF | 1 | 0

Return type:

None

set_freq_cent(value, unit)[source]

Sets the MG369xC RF output center frequency to the value entered. :CENTER and :SPAN frequencies are coupled values. Entering the value for one will cause the other to be recalculated. (See notes under :FREQuency:SPAN)

Parameters:
  • value (int | float) – Center frequency

  • unit (str) – Frequency Unit: ‘Hz’ or ‘kHz’ or ‘MHz’ or ‘GHz’

Return type:

None

set_freq_cw(value, unit=None)[source]
Parameters:
  • value (int | float) – Continuous Wave Frequency. Range: 10 MHz to 40 GHz

  • unit (str (optional)) – Frequency Unit: ‘GHz’ or ‘MHz’ or ‘Hz’

Return type:

None

set_freq_span(value, unit)[source]

Sets sweep span for SWEep[1] to value entered. :SPAN and :CENTer are coupled values.

Parameters:
  • value (int | float) – Range: 1 kHz to (MAX MIN) Default: MAX MIN

  • unit (str) – Frequency Unit: ‘Hz’ or ‘kHz’ or ‘MHz’ or ‘GHz’

Return type:

None

set_freq_start(value, unit)[source]

Sets start frequency for SWEep[1] to the value entered.

Parameters:
  • value (int | float) – Range: MIN to MAX Default: MIN

  • unit (str) – Frequency Unit: ‘Hz’ or ‘kHz’ or ‘MHz’ or ‘GHz’

Return type:

None

set_freq_step(value, unit)[source]

Sets the step increment size used with the :FREQuency:CW command.

Parameters:
  • value (int | float) – Step increment size Range: 0.01 Hz to (MAX MIN) Default: 0.1 GHz

  • unit (str) – Frequency Unit: ‘Hz’ or ‘kHz’ or ‘MHz’ or ‘GHz’

Return type:

None

set_freq_stop(value, unit)[source]

Sets stop frequency for SWEep[1] to the value entered.

Parameters:
  • value (int | float) – Range: MIN to MAX Default: MAX

  • unit (str) – Frequency Unit: ‘Hz’ or ‘kHz’ or ‘MHz’ or ‘GHz’

Return type:

None

set_frequency_mode(mode)[source]

Specifies which command subsystem controls the MG369xC frequency.

Parameters:

mode (str) – Default: CW * CW | FIXed = [:SOURce]:FREQuency:CW|FIXed * SWEep[1] = [:SOURce]:SWEep[1] :SWEep and :SWEep1 may be used interchangeably * SWCW = (see notes) * ALSW = (see notes) * LIST<n> = [:SOURce]:LIST<n> (n=1-4)

set_output(state)[source]

Activates the Signal Genrator RF Output.

Parameters:

state (str | int) – ON | OFF | 1 | 0

Raises:

ValueError – Valid values are: ON, OFF, 1, 0

Return type:

None

set_output_power_level(value)[source]

Sets the Signal Generator Output Power in dBm. Alias for set_rf_power().

Parameters:

value (int | float) – Output Power in dBm

Return type:

None

set_output_protection(state)[source]

ON causes the MG369xC RF output to be turned off (blanked) during frequency changes in CW or step sweep mode. OFF leaves RF output turned on (un blanked).

Parameters:

state (str | int) – Default: ON * ON | OFF | 1 | 0

Return type:

None

set_output_retrace(state)[source]

ON causes the MG369xC RF output to be turned off during sweep retrace. OFF leaves RF output turned on.

Parameters:

state (str | int) – Default: OFF * ON | OFF | 1 | 0

Return type:

None

set_pm_bwidth(state)[source]

Selects the phase modulation (ΦM) operating mode. The Narrow ΦM mode allows maximum deviations of ±3 radians for DC to 8 MHz rates. The Wide ΦM mode allows maximum deviations of ±400 radians for DC to 1 MHz rates.

Parameters:

state (str) – Default: MIN * MIN = narrow mode * MAX = wide mode

Return type:

None

set_pm_internal_freq(value, unit)[source]

Sets the frequency of the modulating waveform for the internal phase modulation (see :PM:INTernal:WAVE)

Parameters:
  • value (int | float) – Frequency Range: 0.1 Hz to 1 MHz for sine wave; 0.1 Hz to 100 kHz for square, triangle, and ramp waveforms. Default: 1 kHz

  • unit (str) – Unit of the frequency (Hz, kHz, MHz)

Return type:

None

set_pm_internal_wave(state)[source]

Selects the modulating waveform (from the internal ΦM generator) for the internal phase modulation function.

Parameters:

state (str) – Default: SINE * SINE = Sine wave * GAUSsian = Gaussian noise * RDOWn = Negative ramp * RUP = Positive ramp * SQUare = Square wave * TRIangle = Triangle wave * UNIForm = Uniform noise

Return type:

None

set_pm_state(state)[source]

Enable/disable phase modulation of the MG369xC RF output signal.

Parameters:

state (str | int) – Default: OFF * ON | OFF | 1 | 0

Return type:

None

set_rf_output(state)[source]

Activates the Signal Genrator RF Output.

Parameters:

state (str | int) – ON | OFF | 1 | 0

Raises:

ValueError – Valid values are: ON, OFF, 1, 0

Return type:

None

set_rf_power(value)[source]

Sets the Signal Generator Output Power in dBm.

Parameters:

value (int | float) – Output Power in dBm

write(command)[source]

Send a command to the instrument.

Parameters:

command (str) – SCPI command string.

Return type:

None

Instruments_Libraries.MG3694C.auto_reconnect(func)[source]

Decorator that catches VISA errors, reconnects, and retries the command.

Parameters:

func (Callable)

Return type:

Callable