Features

This section describes all features that are shipped with this package.

Scenario Features

class balderhub.waveformgenerator.lib.scenario_features.WaveformGeneratorFeature(**kwargs)

Bases: Feature

Waveform Generator Feature that is independent of the device type. It does not even need to be a Programmable Signal Generator, because you could use any device that can be controlled and provide the functionality.

disable_signal() None

Disables the waveform generator output

enable_signal() None

Enables the waveform generator output

get_current_amplitude_vpp() Decimal
Returns:

returns the current applied amplitude in volts (peak-peak)

get_current_frequency_hz() Decimal
Returns:

returns the current applied frequency in Hz

get_current_offset_vdc() Decimal
Returns:

returns the current applied offset in volts

get_current_phase() Decimal
Returns:

returns the current applied phase [0;2*pi]

invert_signal(state: bool) None

Changes the invert state of the waveform generator :param state: True if the signal should be inverted, False otherwise

is_enabled() bool
Returns:

returns True if the generator output is enabled, False otherwise.

is_inverted() bool
Returns:

returns True if the generator generates the inverted waveform, False otherwise.

set_waveform(waveform: BasePeriodicWaveform) None

This method sets the waveform that should be generated. :param waveform: the waveform to be generated

update_waveform_parameters(frequency_hz: Decimal | None = None, amplitude_vpp: Decimal | None = None, offset_vdc: Decimal | None = None, phase: Decimal | None = None) None

This method updates the waveform parameters like frequency, amplitude, etc.

Parameters:
  • frequency_hz – frequency

  • amplitude_vpp – amplitude in volts (peak-peak)

  • offset_vdc – the offset that should be applied to the waveform

  • phase – the phase that should be applied to the waveform

Instruments

class balderhub.waveformgenerator.lib.scenario_features.WaveformGeneratorInstrument(**kwargs)

Bases: Feature

raw implementation of a programmable signal generator instrument

class Channel(value)

Bases: Enum

enum holding all available channels of this instrument

disable_signal(at_channel: Channel) None

Disables the waveform generator output at the given channel

Parameters:

at_channel – the channel to disable the signal at

enable_signal(at_channel: Channel) None

Enables the waveform generator output at the given channel

Parameters:

at_channel – the channel to enable the signal at

get_current_amplitude_vpp(of_channel: Channel) Decimal
Parameters:

of_channel – the channel to check

Returns:

returns the current applied amplitude in volts (peak-peak) at the requested channel

get_current_frequency_hz(of_channel: Channel) Decimal
Parameters:

of_channel – the channel to check

Returns:

returns the current applied frequency in Hz at the requested channel

get_current_offset_vdc(of_channel: Channel) Decimal
Parameters:

of_channel – the channel to check

Returns:

returns the current applied offset in volts at the requested channel

get_current_phase(of_channel: Channel) Decimal
Parameters:

of_channel – the channel to check

Returns:

returns the current applied phase [0;2*pi] at the requested channel

get_stored_waveform_identifiers() list[str]
Returns:

returns a list of all stored waveform identifiers (instrument specific)

invert_signal(at_channel: Channel, state: bool)

Changes the invert state of the waveform generator at the given channel

Parameters:
  • at_channel – the channel to apply the inverted signal state to

  • state – True if the signal should be inverted, False otherwise

is_enabled(channel: Channel) bool
Parameters:

channel – the channel to check

Returns:

returns True if the generator output at the given channel is enabled, False otherwise.

is_inverted(channel: Channel) bool
Parameters:

channel – the channel that should be checked

Returns:

returns True if the generator generates the inverted waveform at the given channel, False otherwise.

is_waveform_on_instrument(waveform: BasePeriodicWaveform) bool

This method returns True if the given waveform is already saved at the instrument, False otherwise. :param waveform: the waveform to check :return: True if the waveform is already saved at the instrument, False otherwise

property prefer_stored_waveforms: bool
Returns:

returns True if the feature should try to use stored waveforms (defined in WaveformGeneratorInstrument.prefer_stored_waveforms()) instead of uploading custom ones

save_waveform(waveform: BasePeriodicWaveform) None

This method transfers the provided waveform to the instrument. In other words, this method does everything necessary to set up the configured waveform.

Parameters:

waveform – the waveform that should be saved

select_waveform(at_channel: Channel, waveform: BasePeriodicWaveform) None

This method selects a waveform and applies it to the given channel. Please make sure, that the waveform was transferred to device first (see WaveformGeneratorInstrument.save_waveform())

Parameters:
  • at_channel – the channel, the waveform should be applied to

  • waveform – the waveform to apply

property stored_waveform_mapping: dict[type[balderhub.waveform.lib.utils.waveforms.base_periodic_waveform.BasePeriodicWaveform], str]

Allows to map waveforms to stored waveforms on the device. If WaveformGeneratorInstrument.prefer_stored_waveforms() is True, the feature prefers to use these stored waveforms instead of uploading custom ones. :return: a dictionary with the waveform type as key and the waveform identifier (instrument specific) as value

update_amplitude(of_channel: Channel, amplitude_vpp: Decimal) None

Updates the amplitude in volts (peak-peak) at the given channel

Parameters:
  • of_channel – the channel to apply the new amplitude in volts (peak-peak) to

  • amplitude_vpp – the new amplitude in volts (peak-peak) that should be applied

update_frequency(of_channel: Channel, frequency_hz: Decimal) None

Updates the frequency at the given channel

Parameters:
  • of_channel – the channel to apply the new frequency to

  • frequency_hz – the new frequency that should be applied

update_offset(of_channel: Channel, offset_vdc: Decimal) None

Updates the offset at the given channel

Parameters:
  • of_channel – the channel to apply the new offset to

  • offset_vdc – the new offset that should be applied

update_phase(of_channel: Channel, phase: Decimal) None

Updates the phase at the given channel

Parameters:
  • of_channel – the channel to apply the new phase to

  • phase – the new phase that should be applied

update_waveform_parameters(of_channel: Channel, frequency_hz: Decimal | None = None, amplitude_vpp: Decimal | None = None, offset_vdc: Decimal | None = None, phase: Decimal | None = None) None

This method updates the waveform parameters like frequency, amplitude, etc. for the given channel.

Parameters:
  • of_channel – The channel to apply the waveform to.

  • frequency_hz – frequency

  • amplitude_vpp – amplitude in volts (peak-peak)

  • offset_vdc – the offset that should be applied to the waveform

  • phase – the phase that should be applied to the waveform

class balderhub.waveformgenerator.lib.scenario_features.WaveformGeneratorInstrumentChannel(**kwargs)

Bases: WaveformGeneratorFeature

Implementation of balderhub.waveformgenerator.lib.scenario_features.WaveformGeneratorFeature and uses a channel of a balderhub.powersupply.lib.scenario_features.WaveformGeneratorInstrument.

class Instrument

Bases: VDevice

vdevice representing the signal generator instrument

property channel: Channel
Returns:

returns the channel identifier this feature uses

disable_signal() None

Disables the waveform generator output

enable_signal() None

Enables the waveform generator output

get_current_amplitude_vpp() Decimal
Returns:

returns the current applied amplitude in volts (peak-peak)

get_current_frequency_hz() Decimal
Returns:

returns the current applied frequency in Hz

get_current_offset_vdc() Decimal
Returns:

returns the current applied offset in volts

get_current_phase() Decimal
Returns:

returns the current applied phase [0;2*pi]

invert_signal(state: bool)

Changes the invert state of the waveform generator :param state: True if the signal should be inverted, False otherwise

is_enabled() bool
Returns:

returns True if the generator output is enabled, False otherwise.

is_inverted() bool
Returns:

returns True if the generator generates the inverted waveform, False otherwise.

set_waveform(waveform: BasePeriodicWaveform) None

This method sets the waveform that should be generated. :param waveform: the waveform to be generated

update_waveform_parameters(frequency_hz: Decimal | None = None, amplitude_vpp: Decimal | None = None, offset_vdc: Decimal | None = None, phase: Decimal | None = None) None

This method updates the waveform parameters like frequency, amplitude, etc.

Parameters:
  • frequency_hz – frequency

  • amplitude_vpp – amplitude in volts (peak-peak)

  • offset_vdc – the offset that should be applied to the waveform

  • phase – the phase that should be applied to the waveform

Setup Features

Siglent-Devices

class balderhub.waveformgenerator.lib.setup_features.siglent.BaseSiglentSDGSeriesAWGInstrument(**kwargs)

Bases: WaveformGeneratorInstrument

Feature implementation for the Siglent SDG Series Arbitrary waveform generators

class Channel(value)

Bases: Enum

available channel for this instrument

disable_signal(at_channel: Channel) None

Disables the waveform generator output at the given channel

Parameters:

at_channel – the channel to disable the signal at

enable_signal(at_channel: Channel) None

Enables the waveform generator output at the given channel

Parameters:

at_channel – the channel to enable the signal at

get_current_amplitude_vpp(of_channel: Channel) Decimal
Parameters:

of_channel – the channel to check

Returns:

returns the current applied amplitude in volts (peak-peak) at the requested channel

get_current_frequency_hz(of_channel: Channel) Decimal
Parameters:

of_channel – the channel to check

Returns:

returns the current applied frequency in Hz at the requested channel

get_current_offset_vdc(of_channel: Channel) Decimal
Parameters:

of_channel – the channel to check

Returns:

returns the current applied offset in volts at the requested channel

get_current_phase(of_channel: Channel) Decimal
Parameters:

of_channel – the channel to check

Returns:

returns the current applied phase [0;2*pi] at the requested channel

get_stored_waveform_identifiers() list[str]
Returns:

returns a list of all stored waveform identifiers (instrument specific)

get_waveform_parameters(of_channel: Channel) tuple[decimal.Decimal, decimal.Decimal, decimal.Decimal, decimal.Decimal]

Method to request all important waveform parameters (frequency, amplitude, offset, phase) from the instrument :param of_channel: the channel the parameters should be requested for :return: a tuple with frequency, amplitude, offset, phase

invert_signal(at_channel: Channel, state: bool)

Changes the invert state of the waveform generator at the given channel

Parameters:
  • at_channel – the channel to apply the inverted signal state to

  • state – True if the signal should be inverted, False otherwise

is_enabled(channel: Channel) bool
Parameters:

channel – the channel to check

Returns:

returns True if the generator output at the given channel is enabled, False otherwise.

is_inverted(channel: Channel) bool
Parameters:

channel – the channel that should be checked

Returns:

returns True if the generator generates the inverted waveform at the given channel, False otherwise.

property resolution_bits
Returns:

returns the vertical resolution of the device in bits

save_waveform(waveform: BasePeriodicWaveform) None

This method transfers the provided waveform to the instrument. In other words, this method does everything necessary to set up the configured waveform.

Parameters:

waveform – the waveform that should be saved

select_waveform(at_channel: Channel, waveform: BasePeriodicWaveform) None

This method selects a waveform and applies it to the given channel. Please make sure, that the waveform was transferred to device first (see WaveformGeneratorInstrument.save_waveform())

Parameters:
  • at_channel – the channel, the waveform should be applied to

  • waveform – the waveform to apply

update_waveform_parameters(of_channel: Channel, frequency_hz: Decimal | None = None, amplitude_vpp: Decimal | None = None, offset_vdc: Decimal | None = None, phase: Decimal | None = None) None

This method updates the waveform parameters like frequency, amplitude, etc. for the given channel.

Parameters:
  • of_channel – The channel to apply the waveform to.

  • frequency_hz – frequency

  • amplitude_vpp – amplitude in volts (peak-peak)

  • offset_vdc – the offset that should be applied to the waveform

  • phase – the phase that should be applied to the waveform

class balderhub.waveformgenerator.lib.setup_features.siglent.SiglentSDG800AWGInstrument(**kwargs)

Bases: BaseSiglentSDGSeriesAWGInstrument

NOTE: This feature is experimental and subject to change. It was not fully validated yet.

If you are a owner of this device and if you are interested in contribution, please open a issue with the validation results of the BalderHub package test results.

class balderhub.waveformgenerator.lib.setup_features.siglent.SiglentSDG1000AWGInstrument(**kwargs)

Bases: BaseSiglentSDGSeriesAWGInstrument

NOTE: This feature is experimental and subject to change. It was not fully validated yet.

If you are a owner of this device and if you are interested in contribution, please open a issue with the validation results of the BalderHub package test results.

class balderhub.waveformgenerator.lib.setup_features.siglent.SiglentSDG1000XAWGInstrument(**kwargs)

Bases: BaseSiglentSDGSeriesAWGInstrument

NOTE: This feature is experimental and subject to change. It was not fully validated yet.

If you are a owner of this device and if you are interested in contribution, please open a issue with the validation results of the BalderHub package test results.

class balderhub.waveformgenerator.lib.setup_features.siglent.SiglentSDG2000XAWGInstrument(**kwargs)

Bases: BaseSiglentSDGSeriesAWGInstrument

NOTE: This feature is experimental and subject to change. It was not fully validated yet.

If you are a owner of this device and if you are interested in contribution, please open a issue with the validation results of the BalderHub package test results.

property stored_waveform_mapping

Allows to map waveforms to stored waveforms on the device. If WaveformGeneratorInstrument.prefer_stored_waveforms() is True, the feature prefers to use these stored waveforms instead of uploading custom ones. :return: a dictionary with the waveform type as key and the waveform identifier (instrument specific) as value

class balderhub.waveformgenerator.lib.setup_features.siglent.SiglentSDG5000AWGInstrument(**kwargs)

Bases: BaseSiglentSDGSeriesAWGInstrument

NOTE: This feature is experimental and subject to change. It was not fully validated yet.

If you are a owner of this device and if you are interested in contribution, please open a issue with the validation results of the BalderHub package test results.

class balderhub.waveformgenerator.lib.setup_features.siglent.SiglentSDG6000XOrXEAWGInstrument(**kwargs)

Bases: BaseSiglentSDGSeriesAWGInstrument

NOTE: This feature is experimental and subject to change. It was not fully validated yet.

If you are a owner of this device and if you are interested in contribution, please open a issue with the validation results of the BalderHub package test results.

Channel Selection Features

class balderhub.waveformgenerator.lib.setup_features.WaveformGeneratorInstrumentChannel2(**kwargs)

Bases: WaveformGeneratorInstrumentChannel

Universal waveform generator Setup Feature representing the Channel 2 of a signal generator instrument

property channel: Channel
Returns:

returns the channel identifier this feature uses

class balderhub.waveformgenerator.lib.setup_features.WaveformGeneratorInstrumentChannel1(**kwargs)

Bases: WaveformGeneratorInstrumentChannel

Universal waveform generator Setup Feature representing the Channel 1 of a signal generator instrument

property channel: Channel
Returns:

returns the channel identifier this feature uses

class balderhub.waveformgenerator.lib.setup_features.DirtyWaveformGeneratorChannel(**kwargs)

Bases: WaveformGeneratorFeature

Dirty helper feature that can be assigned directly to the device

property channel: Channel
Returns:

returns the channel that should be used for the feature (defaults to 1)

disable_signal() None

Disables the waveform generator output

enable_signal() None

Enables the waveform generator output

get_current_amplitude_vpp() Decimal
Returns:

returns the current applied amplitude in volts (peak-peak)

get_current_frequency_hz() Decimal
Returns:

returns the current applied frequency in Hz

get_current_offset_vdc() Decimal
Returns:

returns the current applied offset in volts

get_current_phase() Decimal
Returns:

returns the current applied phase [0;2*pi]

invert_signal(state: bool)

Changes the invert state of the waveform generator :param state: True if the signal should be inverted, False otherwise

is_enabled() bool
Returns:

returns True if the generator output is enabled, False otherwise.

is_inverted() bool
Returns:

returns True if the generator generates the inverted waveform, False otherwise.

set_waveform(waveform: BasePeriodicWaveform) None

This method sets the waveform that should be generated. :param waveform: the waveform to be generated

update_waveform_parameters(frequency_hz: Decimal | None = None, amplitude_vpp: Decimal | None = None, offset_vdc: Decimal | None = None, phase: Decimal | None = None) None

This method updates the waveform parameters like frequency, amplitude, etc.

Parameters:
  • frequency_hz – frequency

  • amplitude_vpp – amplitude in volts (peak-peak)

  • offset_vdc – the offset that should be applied to the waveform

  • phase – the phase that should be applied to the waveform