qmi.instruments.rohde_schwarz.rs_base_signal_gen

Base class for the instrument drivers for the Rohde&Schwarz Signal Generators

Classes

RohdeSchwarz_Base(context, name, transport)

Base class for the instrument driver for the Rohde&Schwarz Signal Generators.

class qmi.instruments.rohde_schwarz.rs_base_signal_gen.RohdeSchwarz_Base(context: QMI_Context, name: str, transport: str, max_continuous_power: float | None = None)

Base class for the instrument driver for the Rohde&Schwarz Signal Generators.

open() None

Open connection to the instrument.

close() None

Close connection to the instrument.

get_idn() QMI_InstrumentIdentification

Read instrument type and version and return QMI_InstrumentIdentification instance.

Raises:

QMI_InstrumentException – on unexpected response to query.

Returns:

Instance of the instrument.

Return type:

QMI_InstrumentIdentification

start_calibration() None

Start internal adjustments. Needs to be implemented further in the deriving classes.

This function returns immediately after starting the calibration.

Calibration can take up to 10 minutes. Call poll_calibration() to see whether calibration is complete. No other commands can be processed while the instrument is calibrating.

The instrument must be at stable temperature (30 minutes to warm up) before starting internal adjustments.

self._calibrating

Set to True if starting the calibration succeeded.

Raises:

QMI_InstrumentException – If the result of previous calibration is still pending

poll_calibration() None | int

Check whether an ongoing calibration is finished. If calibration is finished, this function returns a status code.

Raises:

QMI_InstrumentException – On calibration error or no calibration active.

Returns:

0 - If calibration was successful.

1 - If calibration failed.

None: If calibration is not yet finished.

Return type:

status_code

reset() None

Reset the instrument, returning (most) settings to their defaults.

Note that RST does not cancel an ongoing calibration.

get_phase() float

Return the current phase delta in degrees.

set_phase(phase: float) None

Set the current phase delta.

Parameters:

phase – target phase delta in degrees.

get_reference_source() str

Return the current reference source.

Possible values:

“INT” if the internal 10 MHz reference source is used; “EXT” if an external reference source is used.

set_reference_source(source: str) None

Set the reference source.

Parameters:

source – Desired reference source (accepted values: “INT”, “EXT”); see also get_reference_source().

get_frequency() float

Return the current RF frequency in Hz.

set_frequency(frequency: float) None

Set the RF frequency.

Parameters:

frequency – Target frequency in Hertz.

get_pulsemod_ext_source() bool

Check pulse modulation source.

Returns:

True if pulse modulation uses an external source, else False.

Return type:

boolean

Raises:

QMI_InstrumentException – On unexpected response.

set_pulsemod_ext_source(ext: bool) None

Enable or disable the external pulse modulation source.

When set to True, pulse modulation is controlled by an external pulse generator connected to the TRIG port of the instrument. When set to False, pulse modulation is controlled by an internal pulse generator.

The nominal threshold of the TRIG input signal is +1 Volt. The signal on the TRIG input must not exceed 5 Volt.

Parameters:

ext – Boolean flag indicating if external modulation must be enabled.

Raises:

QMI_InstrumentException – If using internal source and power above max power limit.

get_power_on_output_policy() str

Return instrument power-on policy for setting the RF output state.

Possible values:

“OFF” if the instrument starts with RF output disabled; “UNCH” if the instrument starts with RF output state the same as before power down.

set_power_on_output_policy(policy: str) None

Set the instrument power-on policy for setting the RF output state.

Parameters:

policy – desired policy (accepted values: “OFF”, “UNCH”); see also get_power_on_output_policy().

get_pulsemod_polarity() bool

Get pulse modulation polarity.

Raises:

QMI_InstrumentException – On unexpected response.

Returns:

True if the external pulse modulation polarity is inverted; False if it is normal.

set_pulsemod_polarity(inverted: bool) None

Enable or disable inverted polarity for external modulation.

Parameters:

inverted – Boolean flag indicating if external modulation should be inverted. For normal polarity (False), the RF signal is suppressed when the TRIG pulse is low. For inverted polarity (True), the RF signal is suppressed when the TRIG pulse is high.

Raises:

QMI_InstrumentException – On using power beyond the max power limit.

get_power() float

Return the current RF output power in dBm.

set_power(power: float) None

Set the RF output power in dBm.

Parameters:

power – Target output power in dBm.

Raises:

QMI_InstrumentException – On power exceeding the power limit.

get_output_state() bool

Return True if RF output is enabled, False if RF output is disabled.

set_output_state(enable: bool) None

Enable or disable RF output.

Parameters:

enable – Target output state. True for enabled, False for disabled.

Raises:

QMI_InstrumentException – On power exceeding the power limit due to disable pulse modulation, using internal pulse modulation source or inverted external pulse source polarity.

get_pulsemod_enabled() bool

Return True if pulse modulation is enabled, False if disabled.

set_pulsemod_enabled(enable: bool) None

Enable or disable pulse modulation.

Parameters:

enable – Target pulse modulation state. True for enabled, False for disabled.

Raises:

QMI_InstrumentException – On power exceeding the power limit.

get_iq_enabled() bool

Return True if IQ modulation is enabled, False if disabled.

set_iq_enabled(enable: bool) None

Enable or disable IQ modulation.

Parameters:

enable – Target IQ modulation state. True for enabled, False for disabled.

get_iq_wideband() bool

Return True if wideband IQ modulation is enabled, False if disabled.

set_iq_wideband(enable: bool) None

Enable or disable wideband IQ modulation.

Parameters:

enable – Target wideband IQ modulation state. True for enabled, False for disabled.

get_iq_quadrature_offset() float

Return the current IQ quadrature offset.

set_iq_quadrature_offset(phase: float) None

Set the IQ quadrature offset between -8 and 8 degrees in increments of 0.01.

Parameters:

phase – Desired phase offset in degrees.

Raises:

ValueError – If phase offset not within -8 - 8 degrees.

get_iq_leakage_i() float

Return the current I leakage amplitude (percent).

set_iq_leakage_i(leakage: float) None

Set the I leakage amplitude between -5 and 5 (percent), in increments of 0.01.

Parameters:

leakage – leakage amplitude in percent.

Raises:

ValueError – If leakage amplitude not within -5 - 5 percent.

get_iq_leakage_q() float

Return the current Q leakage amplitude (percent).

set_iq_leakage_q(leakage: float) None

Set the Q leakage amplitude between -5 and 5 (percent), in increments of 0.01.

Parameters:

leakage – Leakage amplitude in percent.

Raises:

ValueError – If leakage amplitude not within -5 - 5 percent.

get_iq_gain_imbalance() float

Return the current IQ gain imbalance (dB).

set_iq_gain_imbalance(gain: float) None

Set the IQ gain imbalance in dB in range -1 to 1, increments of 0.001.

Parameters:

gain – Desired gain in dB.

Raises:

ValueError – If gain imbalance not within -1 - 1 dB.

get_iq_crest_factor() float

Return the current IQ crest factor compensation in dB.

set_iq_crest_factor(factor: float) None

Set the IQ crest factor compensation in dB.

Parameters:

factor – Crest factor in dB.

get_errors() None

Queries the error/event queue for all unread items and removes them from the queue.

get_error_queue_length() int

Queries the number of entries in the error queue.

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.