qcodes_contrib_drivers.drivers.Keysight.SD_common package

Submodules

qcodes_contrib_drivers.drivers.Keysight.SD_common.SD_AWG module

class qcodes_contrib_drivers.drivers.Keysight.SD_common.SD_AWG.SD_AWG(*args: Any, **kwargs: Any)[source]

Bases: SD_Module

This is the general SD_AWG driver class that implements shared parameters and functionality among all PXIe-based AWG cards by Keysight. (series M32xxA and M33xxA)

This driver was written to be inherited from by a specific AWG card driver (e.g. M3201A).

This driver was written with the M3201A card in mind.

This driver makes use of the Python library provided by Keysight as part of the SD1 Software package (v.2.01.00).

Parameters:
  • name – an identifier for this instrument, particularly for attaching it to a Station.

  • chassis – identification of the chassis.

  • slot – slot of the module in the chassis.

  • channels – number of channels of the module.

  • triggers – number of triggers of the module.

  • legacy_channel_numbering – indicates whether legacy channel number should be used. (Legacy numbering starts with channel 0)

awg_config_external_trigger(awg_number: int, external_source: int, trigger_behaviour: int) None[source]

Configures the external triggers for the selected awg. The external trigger is used in case the waveform is queued with th external trigger mode option.

Parameters:
  • awg_number – awg number

  • external_source – value indicating external trigger source External I/O Trigger : 0 PXI Trigger [0..n] : 4000+n

  • trigger_behaviour – value indicating the trigger behaviour Active High : 1 Active Low : 2 Rising Edge : 3 Falling Edge : 4

awg_flush(awg_number: int) None[source]

Empties the queue of the selected AWG. Waveforms are not removed from the onboard RAM.

awg_from_array(awg_number: int, trigger_mode: int, start_delay: int, cycles: int, prescaler: int, waveform_type: int, waveform_data_a: List[int | float], waveform_data_b: List[int | float] | None = None, padding_mode: int = 0, verbose: bool = False) int[source]

Provides a one-step method to load, queue and start a single waveform in one of the module AWGs.

Loads a waveform from array.

Parameters:
  • awg_number – awg number where the waveform is queued

  • trigger_mode – trigger method to launch the waveform Auto : 0 Software/HVI : 1 Software/HVI (per cycle) : 5 External trigger : 2 External trigger (per cycle): 6

  • start_delay – defines the delay between trigger and wf launch given in multiples of 10ns.

  • cycles – number of times the waveform is repeated once launched zero = infinite repeats

  • prescaler – waveform prescaler value, to reduce eff. sampling rate

  • waveform_type – waveform type

  • waveform_data_a – array with waveform points

  • waveform_data_b – array with waveform points, only for the waveforms which have a second component

Returns:

available onboard RAM in waveform points, or negative numbers for

errors

awg_from_file(awg_number: int, waveform_file: str, trigger_mode: int, start_delay: int, cycles: int, prescaler: int, padding_mode: int = 0, verbose: bool = False) int[source]

Provides a one-step method to load, queue and start a single waveform in one of the module AWGs.

Loads a waveform from file.

Parameters:
  • awg_number – awg number where the waveform is queued

  • waveform_file – file containing the waveform points

  • trigger_mode – trigger method to launch the waveform Auto : 0 Software/HVI : 1 Software/HVI (per cycle) : 5 External trigger : 2 External trigger (per cycle): 6

  • start_delay – defines the delay between trigger and wf launch given in multiples of 10ns.

  • cycles – number of times the waveform is repeated once launched zero = infinite repeats

  • prescaler – waveform prescaler value, to reduce eff. sampling rate

Returns:

available onboard RAM in waveform points, or negative numbers for

errors

awg_is_running(channel: int) bool[source]

Returns True if awg on channel is running.

awg_jump_next_waveform(awg_number: int) None[source]

Forces a jump to the next waveform in the awg queue. The jump is executed once the current waveform has finished a complete cycle.

awg_pause(awg_number: int) None[source]

Pauses the selected AWG, leaving the last waveform point at the output, and ignoring all incoming triggers. The waveform generation can be resumed calling awg_resume

awg_pause_multiple(awg_mask: int) None[source]

Pauses the selected AWGs, leaving the last waveform point at the output, and ignoring all incoming triggers. The waveform generation can be resumed calling awg_resume_multiple

Parameters:

awg_mask – Mask to select the awgs to pause (LSB is awg 0, bit 1 is awg 1 etc.)

awg_queue_config(awg_number: int, mode: int) None[source]

Configures the cyclic mode of the queue. All waveforms must be already queued in one of the AWGs

Parameters:
  • awg_number – awg number where the waveform is queued

  • mode – operation mode of the queue: One Shot (0), Cyclic (1)

awg_queue_waveform(awg_number: int, waveform_number: int, trigger_mode: int, start_delay: int, cycles: int, prescaler: int) None[source]

Queues the specified waveform in one of the AWGs of the module. The waveform must be already loaded in the module onboard RAM.

awg_resume(awg_number: int) None[source]

Resumes the selected AWG, from the current position of the queue.

awg_resume_multiple(awg_mask: int) None[source]

Resumes the selected AWGs, from the current positions of their respective queue.

Parameters:

awg_mask – Mask to select the awgs to resume (LSB is awg 0, bit 1 is awg 1 etc.)

awg_start(awg_number: int) None[source]

Starts the selected AWG from the beginning of its queue. The generation will start immediately or when a trigger is received, depending on the trigger selection of the first waveform in the queue and provided that at least one waveform is queued in the AWG.

awg_start_multiple(awg_mask: int) None[source]

Starts the selected AWGs from the beginning of their queues. The generation will start immediately or when a trigger is received, depending on the trigger selection of the first waveform in their queues and provided that at least one waveform is queued in these AWGs.

Parameters:

awg_mask – Mask to select the awgs to start (LSB is awg 0, bit 1 is awg 1 etc.)

awg_stop(awg_number: int) None[source]

Stops the selected AWG, setting the output to zero and resetting the AWG queue to its initial position. All following incoming triggers are ignored.

awg_stop_multiple(awg_mask: int) None[source]

Stops the selected AWGs, setting their output to zero and resetting their AWG queues to the initial positions. All following incoming triggers are ignored.

Parameters:

awg_mask – Mask to select the awgs to stop (LSB is awg 0, bit 1 is awg 1 etc.)

awg_trigger(awg_number: int) None[source]

Triggers the selected AWG. The waveform waiting in the current position of the queue is launched, provided it is configured with VI/HVI Trigger.

awg_trigger_multiple(awg_mask: int) None[source]

Triggers the selected AWGs. The waveform waiting in the current position of the queue is launched, provided it is configured with VI/HVI Trigger.

Parameters:

awg_mask – Mask to select the awgs to be triggered (LSB is awg 0, bit 1 is awg 1 etc.)

config_amplitude_modulation(channel_number: int, modulation_type: int, deviation_gain: int, verbose: bool = False) None[source]

Configures the modulation in amplitude/offset for the selected channel

Parameters:
  • channel_number – the number of the channel to configure

  • modulation_type – the modulation type the AWG is used for No Modulation : 0 Amplitude Modulation : 1 Offset Modulation : 2

  • deviation_gain – gain for the modulating signal

  • verbose – boolean indicating verbose mode

config_angle_modulation(channel_number: int, modulation_type: int, deviation_gain: int, verbose: bool = False) None[source]

Configures the modulation in frequency/phase for the selected channel

Parameters:
  • channel_number – the number of the channel to configure

  • modulation_type – the modulation type the AWG is used for No Modulation : 0 Frequency Modulation : 1 Phase Modulation : 2

  • deviation_gain – gain for the modulating signal

  • verbose – boolean indicating verbose mode

config_clock_io(clock_config: int, verbose: bool = False) None[source]

Configures the operation of the clock output connector (CLK)

Parameters:
  • clock_config – clock connector function Disable : 0 (The CLK connector is disabled) CLKref Output : 1 (A copy of the reference clock is available at the CLK connector)

  • verbose – boolean indicating verbose mode

config_fpga_trigger(trigger: keysightSD1.SD_TriggerExternalSources, direction: keysightSD1.SD_FpgaTriggerDirection, polarity: keysightSD1.SD_TriggerPolarity = keysightSD1.SD_TriggerPolarity.ACTIVE_HIGH, sync_mode: keysightSD1.SD_SyncModes = keysightSD1.SD_SyncModes.SYNC_NONE, delay: int = 0) None[source]

Configures external trigger for use in FPGA.

Parameters:
  • trigger – external trigger

  • direction – IN = (0), INOUT (1)

  • polarity – ACTIVE_LOW (0), ACTIVE_HIGH (1)

  • sync_mode – SYNC_NONE (0), SYNC_CLK10 (1)

  • delay – delay in steps of 5 ns.

config_trigger_io(direction: int, sync_mode: int, verbose: bool = False) None[source]

Configures the trigger connector/line direction and synchronization/sampling method

Parameters:
  • direction – input (1) or output (0)

  • sync_mode – sampling/synchronization mode Non-synchronized mode : 0 (trigger is sampled with internal 100 Mhz clock) Synchronized mode : 1 (trigger is sampled using CLK10)

  • verbose – boolean indicating verbose mode

convert_prescaler_to_sample_rate(prescaler: int) float[source]
Parameters:

prescaler – prescaler set to the awg.

Returns:

effective sample rate the AWG will be running

Return type:

sample_rate

convert_sample_rate_to_prescaler(sample_rate: float) int[source]
Returns:

prescaler set to the awg.

Return type:

prescaler

flush_waveform(verbose: bool = False) None[source]

Deletes all waveforms from the module onboard RAM and flushes all the AWG queues.

get_clock_frequency(verbose: bool = False) int[source]

Returns the real hardware clock frequency (CLKsys)

Returns:

real hardware clock frequency in Hz, or negative numbers for errors

get_clock_sync_frequency(verbose: bool = False) int[source]

Returns the frequency of the internal CLKsync

Returns:

frequency of the internal CLKsync in Hz, or negative numbers for errors

get_trigger_io(verbose: bool = False) int[source]

Reads and returns the trigger input

Returns:

Trigger input value, 0 (OFF) or 1 (ON), or negative numbers for errors

static get_waveform_status(waveform: keysightSD1.SD_Wave, verbose: bool = False) int[source]
static get_waveform_type(waveform: keysightSD1.SD_Wave, verbose: bool = False) int[source]
load_fpga_image(filename: str) None[source]

Loads specified image file in FPGA.

Parameters:

filename – name of image file to load

load_waveform(waveform_object: keysightSD1.SD_Wave, waveform_number: int, verbose: bool = False) int[source]

Loads the specified waveform into the module onboard RAM. Waveforms must be created first as an instance of the SD_Wave class.

Parameters:
  • waveform_object – pointer to the waveform object

  • waveform_number – waveform number to identify the waveform in subsequent related function calls.

  • verbose – boolean indicating verbose mode

Returns:

available onboard RAM in waveform points, or negative numbers for

errors

load_waveform_int16(waveform_type: int, data_raw: List[int], waveform_number: int, verbose: bool = False) int[source]

Loads the specified waveform into the module onboard RAM. Waveforms must be created first as an instance of the SD_Wave class.

Parameters:
  • waveform_type – waveform type

  • data_raw – array with waveform points

  • waveform_number – waveform number to identify the waveform in subsequent related function calls.

  • verbose – boolean indicating verbose mode

Returns:

available onboard RAM in waveform points, or negative numbers for

errors

static new_waveform_from_double(waveform_type: int, waveform_data_a: List[float], waveform_data_b: List[float] | None = None) keysightSD1.SD_Wave[source]

Creates a SD_Wave object from data points contained in an array. This waveform object is stored in the PC RAM, not in the onboard RAM.

Parameters:
  • waveform_type – waveform type

  • waveform_data_a – array of (float) with waveform points

  • waveform_data_b – array of (float) with waveform points, only for the waveforms which have a second component

Returns:

pointer to the waveform object, or negative numbers for errors

static new_waveform_from_file(waveform_file: str) keysightSD1.SD_Wave[source]

Creates a SD_Wave object from data points contained in a file. This waveform object is stored in the PC RAM, not in the onboard RAM.

Parameters:

waveform_file – file containing the waveform points

Returns:

pointer to the waveform object, or negative numbers for errors

static new_waveform_from_int(waveform_type: int, waveform_data_a: List[int], waveform_data_b: List[int] | None = None) keysightSD1.SD_Wave[source]

Creates a SD_Wave object from data points contained in an array. This waveform object is stored in the PC RAM, not in the onboard RAM.

Parameters:
  • waveform_type – waveform type

  • waveform_data_a – array of (int) with waveform points

  • waveform_data_b – array of (int) with waveform points, only for the waveforms which have a second component

Returns:

pointer to the waveform object, or negative numbers for errors

off() None[source]

Stops the AWGs and sets the waveform of all channels to ‘No Signal’

read_fpga(reg_name: str) int[source]

Reads a single 32-bit value from the specified FPGA register.

Parameters:

reg_name – name of register

Returns:

32-bit register value

read_fpga_array(reg_name: str, offset: int, data_size: int, fixed_address: bool = False) List[int][source]

Reads a list of 32-bit values from the specified FPGA memory.

Parameters:
  • reg_name – name of memory

  • offset – offset in memory block

  • fixed_address – if True all data will be read sequentially from address specified by offset, else data will be read from consecutive addresses starting at offset

Returns:

list of 32-bit values

reload_waveform(waveform_object: keysightSD1.SD_Wave, waveform_number: int, padding_mode: int = 0, verbose: bool = False) int[source]

Replaces a waveform located in the module onboard RAM. The size of the new waveform must be smaller than or equal to the existing waveform.

Parameters:
  • waveform_object – pointer to the waveform object

  • waveform_number – waveform number to identify the waveform in subsequent related function calls.

  • padding_mode

    0: the waveform is loaded as it is, zeros are added at the

    end if the number of points is not a multiple of the number required by the AWG.

    1: the waveform is loaded n times (using DMA) until the total

    number of points is multiple of the number required by the AWG. (only works for waveforms with even number of points)

  • verbose – boolean indicating verbose mode

Returns:

available onboard RAM in waveform points, or negative numbers for

errors

reload_waveform_int16(waveform_type: int, data_raw: List[int], waveform_number: int, padding_mode: int = 0, verbose: bool = False) int[source]

Replaces a waveform located in the module onboard RAM. The size of the new waveform must be smaller than or equal to the existing waveform.

Parameters:
  • waveform_type – waveform type

  • data_raw – array with waveform points

  • waveform_number – waveform number to identify the waveform in subsequent related function calls.

  • padding_mode

    0: the waveform is loaded as it is, zeros are added at the

    end if the number of points is not a multiple of the number required by the AWG.

    1: the waveform is loaded n times (using DMA) until the total

    number of points is multiple of the number required by the AWG. (only works for waveforms with even number of points)

  • verbose – boolean indicating verbose mode

Returns:

available onboard RAM in waveform points, or negative numbers for

errors

reset_channel_phase(channel_number: int, verbose: bool = False) None[source]

Resets the accumulated phase of the selected channel. This accumulated phase is the result of the phase continuous operation of the product.

Parameters:
  • channel_number – the number of the channel to reset

  • verbose – boolean indicating verbose mode

reset_clock_phase(trigger_behaviour: int, trigger_source: int, skew: float = 0.0, verbose: bool = False) None[source]

Sets the module in a sync state, waiting for the first trigger to reset the phase of the internal clocks CLKsync and CLKsys

Parameters:
  • trigger_behaviour – value indicating the trigger behaviour Active High : 1 Active Low : 2 Rising Edge : 3 Falling Edge : 4

  • trigger_source – value indicating external trigger source External I/O Trigger : 0 PXI Trigger [0..n] : 4000+n

  • skew – the skew between PXI_CLK10 and CLKsync in multiples of 10ns

  • verbose – boolean indicating verbose mode

reset_multiple_channel_phase(channel_mask: int, verbose: bool = False) None[source]

Resets the accumulated phase of the selected channels simultaneously.

Parameters:
  • channel_mask – Mask to select the channel to reset (LSB is channel 0, bit 1 is channel 1 etc.)

  • verbose – boolean indicating verbose mode

Example

reset_multiple_channel_phase(5) would reset the phase of channel 0 and 2

set_channel_amplitude(amplitude: float, channel_number: int, verbose: bool = False) None[source]

Sets the amplitude for the specified channel.

Parameters:
  • channel_number – output channel number

  • amplitude – amplitude in Volts

  • verbose – boolean indicating verbose mode

set_channel_frequency(frequency: int, channel_number: int, verbose: bool = False) None[source]

Sets the frequency for the specified channel. The frequency is used for the periodic signals generated by the Function Generators.

Parameters:
  • channel_number – output channel number

  • frequency – frequency in Hz

  • verbose – boolean indicating verbose mode

set_channel_offset(offset: float, channel_number: int, verbose: bool = False) None[source]

Sets the DC offset for the specified channel.

Parameters:
  • channel_number – output channel number

  • offset – DC offset in Volts

  • verbose – boolean indicating verbose mode

set_channel_phase(phase: int, channel_number: int, verbose: bool = False) None[source]

Sets the phase for the specified channel.

Parameters:
  • channel_number – output channel number

  • phase – phase in degrees

  • verbose – boolean indicating verbose mode

set_channel_wave_shape(wave_shape: int, channel_number: int, verbose: bool = False) None[source]
Sets output waveform type for the specified channel.

HiZ : -1 (only available for M3202A) No Signal : 0 Sinusoidal : 1 Triangular : 2 Square : 4 DC Voltage : 5 Arbitrary wf: 6 Partner Ch. : 8

Parameters:
  • channel_number – output channel number

  • wave_shape – wave shape type

  • verbose – boolean indicating verbose mode

set_clock_frequency(frequency: float, verbose: bool = False) float[source]

Sets the module clock frequency

Parameters:
  • frequency – the frequency in Hz

  • verbose – boolean indicating verbose mode

Returns:

the real frequency applied to the hardware in Hw, or negative numbers for errors

set_digital_filter_mode(filter_mode: keysightSD1.SD_DigitalFilterModes) None[source]

Sets digital filter mode.

Parameters:

filter_mode – AOU_FILTER_OFF (0), AOU_FILTER_FLATNESS (1), AOU_FILTER_FIFTEEN_TAP (3)

Note: AOU_FILTER_FIFTEEN_TAP is anti-ringing filter

set_iq_modulation(channel_number: int, enable: int, verbose: bool = False) None[source]

Sets the IQ modulation for the selected channel

Parameters:
  • channel_number – the number of the channel to configure

  • enable – Enable (1) or Disable (0) the IQ modulation

  • verbose – boolean indicating verbose mode

set_marker_config(channel_number: int, markerMode: int, trgPXImask: int, trgIOmask: int, markerValue: int, syncMode: int, length: int, delay: int) Any[source]

Configures the marker output from the trigger port

Parameters:
  • channel_number – trigger channel number

  • markerMode – 0 disabled, 1 on start event, 2 On first sample of waveform (after starting delay), 3 on every cycle

  • trgPXImask – Mask to select PXI triggers to use

  • trgIOmask – Mask to select front panel triggers to use

  • markerValue – 0 = marker signal is default low, pulses high. 1 = marker signal is default high, pulses low

  • syncMode – 0 = syncronized to CLKsys. 1 = syncronized to 10MHz clock

  • length – Marker pulse length (length * clock period * 5)

  • delay – Delay to add before pulse (delay * clock period * 5)

set_trigger_io(value: int, verbose: bool = False) None[source]

Sets the trigger output. The trigger must be configured as output using config_trigger_io

Parameters:
  • value – Tigger output value: 0 (OFF), 1 (ON)

  • verbose – boolean indicating verbose mode

write_fpga(reg_name: str, value: int) None[source]

Writes a single 32-bit value to the specified FPGA register.

Parameters:
  • reg_name – name of register

  • value – 32-bit value

write_fpga_array(reg_name: str, offset: int, data: List[int], fixed_address: bool = False) None[source]

Writes a list of 32-bit values to the specified FPGA memory.

Parameters:
  • reg_name – name of memory

  • offset – offset in memory block

  • data – list of 32-bit values

  • fixed_address – if True all data will be written sequentially to address specified by offset, else data will be written to consecutive addresses starting at offset

qcodes_contrib_drivers.drivers.Keysight.SD_common.SD_AWG_Async module

class qcodes_contrib_drivers.drivers.Keysight.SD_common.SD_AWG_Async.SD_AWG_Async(*args: Any, **kwargs: Any)[source]

Bases: SD_AWG

Generic asynchronous driver with waveform memory management for Keysight SD AWG modules.

This driver is derived from SD_AWG and uses a thread to upload waveforms. This class creates reusable memory slots of different sizes in AWG. It assigns waveforms to the smallest available memory slot.

Only one instance of this class per AWG module is allowed. By default the maximum size of a waveform is limited to 1e6 samples. This limit can be increased up to 1e8 samples at the cost of a longer startup time of the threads.

The memory manager and asynchronous functionality can be disabled to restore the behavior of the parent class. The instrument can then be used with old synchronous code.

Example

awg1 = SW_AWG_Async(‘awg1’, 0, 1, channels=4, triggers=8) awg2 = SW_AWG_Async(‘awg2’, 0, 2, channels=4, triggers=8) awg3 = SW_AWG_Async(‘awg3’, 0, 3, channels=4, triggers=8)

# the upload to the 3 modules will run concurrently (in background) ref_1 = awg1.upload_waveform(wave1) ref_2 = awg2.upload_waveform(wave2) ref_3 = awg3.upload_waveform(wave3)

trigger_mode = keysightSD1.SD_TriggerModes.EXTTRIG # method awg_queue_waveform blocks until reference waveform has been uploaded. awg1.awg_queue_waveform(1, ref_1, trigger_mode, 0, 1, 0) awg2.awg_queue_waveform(1, ref_2, trigger_mode, 0, 1, 0) awg3.awg_queue_waveform(1, ref_3, trigger_mode, 0, 1, 0)

Parameters:
  • name (str) – an identifier for this instrument, particularly for attaching it to a Station.

  • chassis (int) – identification of the chassis.

  • slot (int) – slot of the module in the chassis.

  • channels (int) – number of channels of the module.

  • triggers (int) – number of triggers of the module.

  • legacy_channel_numbering (bool) – indicates whether legacy channel number should be used. (Legacy numbering starts with channel 0)

  • waveform_size_limit (int) – maximum size of waveform that can be uploaded

  • asynchronous (bool) – if False the memory manager and asynchronous functionality are disabled.

asynchronous() bool[source]

Returns True if module is in asynchronous mode.

awg_flush(awg_number: int) None[source]

Empties the queue of the selected AWG. Waveforms are not removed from the onboard RAM.

awg_from_array(awg_number: int, trigger_mode: int, start_delay: int, cycles: int, prescaler: int, waveform_type: int, waveform_data_a: List[int | float], waveform_data_b: List[int | float] | None = None, padding_mode: int = 0, verbose: bool = False) int[source]

Provides a one-step method to load, queue and start a single waveform in one of the module AWGs.

Loads a waveform from array.

Parameters:
  • awg_number – awg number where the waveform is queued

  • trigger_mode – trigger method to launch the waveform Auto : 0 Software/HVI : 1 Software/HVI (per cycle) : 5 External trigger : 2 External trigger (per cycle): 6

  • start_delay – defines the delay between trigger and wf launch given in multiples of 10ns.

  • cycles – number of times the waveform is repeated once launched zero = infinite repeats

  • prescaler – waveform prescaler value, to reduce eff. sampling rate

  • waveform_type – waveform type

  • waveform_data_a – array with waveform points

  • waveform_data_b – array with waveform points, only for the waveforms which have a second component

Returns:

available onboard RAM in waveform points, or negative numbers for

errors

awg_from_file(awg_number: int, waveform_file: str, trigger_mode: int, start_delay: int, cycles: int, prescaler: int, padding_mode: int = 0, verbose: bool = False) int[source]

Provides a one-step method to load, queue and start a single waveform in one of the module AWGs.

Loads a waveform from file.

Parameters:
  • awg_number – awg number where the waveform is queued

  • waveform_file – file containing the waveform points

  • trigger_mode – trigger method to launch the waveform Auto : 0 Software/HVI : 1 Software/HVI (per cycle) : 5 External trigger : 2 External trigger (per cycle): 6

  • start_delay – defines the delay between trigger and wf launch given in multiples of 10ns.

  • cycles – number of times the waveform is repeated once launched zero = infinite repeats

  • prescaler – waveform prescaler value, to reduce eff. sampling rate

Returns:

available onboard RAM in waveform points, or negative numbers for

errors

awg_queue_waveform(awg_number: int, waveform_ref: int | _WaveformReferenceInternal, trigger_mode: int, start_delay: int, cycles: int, prescaler: int) None[source]

Enqueus the waveform.

Parameters:
  • awg_number – awg number (channel) where the waveform is queued

  • waveform_ref – reference to a waveform

  • trigger_mode – trigger method to launch the waveform Auto : 0 Software/HVI : 1 Software/HVI (per cycle) : 5 External trigger : 2 External trigger (per cycle): 6

  • start_delay – defines the delay between trigger and wf launch given in multiples of 10ns.

  • cycles (int) – number of times the waveform is repeated once launched zero = infinite repeats

  • prescaler – waveform prescaler value, to reduce eff. sampling rate

close() None[source]

Closes the module and stops background thread.

flush_waveform(verbose: bool = False) None[source]

Deletes all waveforms from the module onboard RAM and flushes all the AWG queues.

load_waveform(waveform_object: keysightSD1.SD_Wave, waveform_number: int, verbose: bool = False) int[source]

Loads the specified waveform into the module onboard RAM. Waveforms must be created first as an instance of the SD_Wave class.

Parameters:
  • waveform_object – pointer to the waveform object

  • waveform_number – waveform number to identify the waveform in subsequent related function calls.

  • verbose – boolean indicating verbose mode

Returns:

available onboard RAM in waveform points, or negative numbers for

errors

load_waveform_int16(waveform_type: int, data_raw: List[int], waveform_number: int, verbose: bool = False) int[source]

Loads the specified waveform into the module onboard RAM. Waveforms must be created first as an instance of the SD_Wave class.

Parameters:
  • waveform_type – waveform type

  • data_raw – array with waveform points

  • waveform_number – waveform number to identify the waveform in subsequent related function calls.

  • verbose – boolean indicating verbose mode

Returns:

available onboard RAM in waveform points, or negative numbers for

errors

reload_waveform(waveform_object: keysightSD1.SD_Wave, waveform_number: int, padding_mode: int = 0, verbose: bool = False) int[source]

Replaces a waveform located in the module onboard RAM. The size of the new waveform must be smaller than or equal to the existing waveform.

Parameters:
  • waveform_object – pointer to the waveform object

  • waveform_number – waveform number to identify the waveform in subsequent related function calls.

  • padding_mode

    0: the waveform is loaded as it is, zeros are added at the

    end if the number of points is not a multiple of the number required by the AWG.

    1: the waveform is loaded n times (using DMA) until the total

    number of points is multiple of the number required by the AWG. (only works for waveforms with even number of points)

  • verbose – boolean indicating verbose mode

Returns:

available onboard RAM in waveform points, or negative numbers for

errors

reload_waveform_int16(waveform_type: int, data_raw: List[int], waveform_number: int, padding_mode: int = 0, verbose: bool = False) int[source]

Replaces a waveform located in the module onboard RAM. The size of the new waveform must be smaller than or equal to the existing waveform.

Parameters:
  • waveform_type – waveform type

  • data_raw – array with waveform points

  • waveform_number – waveform number to identify the waveform in subsequent related function calls.

  • padding_mode

    0: the waveform is loaded as it is, zeros are added at the

    end if the number of points is not a multiple of the number required by the AWG.

    1: the waveform is loaded n times (using DMA) until the total

    number of points is multiple of the number required by the AWG. (only works for waveforms with even number of points)

  • verbose – boolean indicating verbose mode

Returns:

available onboard RAM in waveform points, or negative numbers for

errors

set_asynchronous(asynchronous: bool) None[source]

Enables asynchronous loading and memory manager if asynchronous is True. Otherwise disables both.

Parameters:

asynchronous – new asynchronous state.

set_waveform_limit(requested_waveform_size_limit: int) None[source]

Increases the maximum size of waveforms that can be uploaded.

Additional memory will be reserved in the AWG. Limit can not be reduced, because reservation cannot be undone.

Parameters:

requested_waveform_size_limit – maximum size of waveform that can be uploaded

upload_waveform(wave: List[float] | List[int] | ndarray) _WaveformReferenceInternal[source]

Upload the wave using the uploader thread for this AWG. :param wave: wave data to upload.

Returns:

reference to the wave

uploader_ready() bool[source]

Waits until uploader thread is ready with tasks queued before this call.

class qcodes_contrib_drivers.drivers.Keysight.SD_common.SD_AWG_Async.Task(f: F, instance: Any, *args, **kwargs)[source]

Bases: object

Task to be executed asynchronously.

Parameters:
  • f – function to execute

  • instance – object function f belongs to

  • args – argument list to pass to function

  • kwargs – keyword arguments to pass to function

run() None[source]

Executes the function. The function result can be retrieved with property result.

property result: Any

Returns the result of the executed function. Waits till function has been executed.

verbose = False

Enables verbose logging

class qcodes_contrib_drivers.drivers.Keysight.SD_common.SD_AWG_Async.WaveformReference(wave_number: int, awg_name: str)[source]

Bases: object

This is a reference to a waveform (being) uploaded to the AWG.

Parameters:
  • wave_number – number refering to the wave in AWG memory

  • awg_name – name of the awg the waveform is uploaded to

is_uploaded() bool[source]

Returns True if waveform has been loaded.

release() None[source]

Releases the AWG memory for reuse.

wait_uploaded() None[source]

Waits till waveform has been loaded. Returns immediately if waveform is already uploaded.

property awg_name: str

Name of the AWG the waveform is uploaded to

property wave_number: int

Number of the wave in AWG memory.

qcodes_contrib_drivers.drivers.Keysight.SD_common.SD_AWG_Async.switchable(switch: Callable[[Any], bool], enabled: bool) Callable[[F], F][source]

This decorator enables or disables a method depending on the value of an object’s method. It throws an exception when the invoked method is disabled. The wrapped method is enabled when switch(self) == enabled.

Parameters:
  • switch – method indicating switch status.

  • enabled – value the switch status must have to enable the wrapped method.

qcodes_contrib_drivers.drivers.Keysight.SD_common.SD_AWG_Async.threaded(wait: bool = False) Callable[[F], F][source]

Decoractor to execute the wrapped method in the background thread.

Parameters:

wait – if True waits till the function has been executed.

qcodes_contrib_drivers.drivers.Keysight.SD_common.SD_DIG module

class qcodes_contrib_drivers.drivers.Keysight.SD_common.SD_DIG.SD_DIG(*args: Any, **kwargs: Any)[source]

Bases: SD_Module

This is the qcodes driver for a generic Signadyne Digitizer of the M32/33XX series.

Status: beta

This driver is written with the M3300A in mind.

This driver makes use of the Python library provided by Keysight as part of the SD1 Software package (v.2.01.00).

__init__(name, chassis, slot, channels, triggers, **kwargs)[source]

Initialises a generic Signadyne digitizer and its parameters

Parameters:
  • name (str) – the name of the digitizer card

  • channels (int) – the number of input channels the specified card has

  • triggers (int) – the number of trigger inputs the specified card has

daq_flush(daq, verbose=False)[source]

Flush the specified DAQ

Parameters:

daq (int) – the DAQ you are flushing

daq_flush_multiple(daq_mask, verbose=False)[source]

Flush the specified DAQs

Parameters:

daq_mask (int) – the DAQs you are flushing, composed as a bitmask where the LSB is for DAQ_0, bit 1 is for DAQ_1 etc.

daq_read(daq, verbose=False)[source]

Read from the specified DAQ

Parameters:
  • daq (int) – the input DAQ you are reading from

  • n_points

  • timeout

daq_start(daq, verbose=False)[source]

Start acquiring data or waiting for a trigger on the specified DAQ

Parameters:

daq (int) – the input DAQ you are enabling

daq_start_multiple(daq_mask, verbose=False)[source]

Start acquiring data or waiting for a trigger on the specified DAQs

Parameters:

daq_mask (int) – the input DAQs you are enabling, composed as a bitmask where the LSB is for DAQ_0, bit 1 is for DAQ_1 etc.

daq_stop(daq, verbose=False)[source]

Stop acquiring data on the specified DAQ

Parameters:

daq (int) – the DAQ you are disabling

daq_stop_multiple(daq_mask, verbose=False)[source]

Stop acquiring data on the specified DAQs

Parameters:

daq_mask (int) – the DAQs you are triggering, composed as a bitmask where the LSB is for DAQ_0, bit 1 is for DAQ_1 etc.

daq_trigger(daq, verbose=False)[source]

Manually trigger the specified DAQ

Parameters:

daq (int) – the DAQ you are triggering

daq_trigger_multiple(daq_mask, verbose=False)[source]

Manually trigger the specified DAQs

Parameters:

daq_mask (int) – the DAQs you are triggering, composed as a bitmask where the LSB is for DAQ_0, bit 1 is for DAQ_1 etc.

get_coupling(channel, verbose=False)[source]

Gets the channel coupling

Parameters:

channel (int) – the input channel you are observing

get_full_scale(channel, verbose=False)[source]

Gets the channel full scale input voltage

Parameters:

channel (int) – the input channel you are observing

get_impedance(channel, verbose=False)[source]

Gets the channel input impedance

Parameters:

channel (int) – the input channel you are observing

get_prescaler(channel, verbose=False)[source]

Gets the channel prescaler value

Parameters:

channel (int) – the input channel you are observing

get_trigger_io(verbose=False)[source]

Write a value to the IO trigger port

get_trigger_mode(channel)[source]

Returns the current trigger mode

Parameters:

channel (int) – the input channel you are observing

get_trigger_threshold(channel)[source]

Returns the current trigger threshold

Parameters:

channel (int) – the input channel you are observing

reset_clock_phase(trigger_behaviour, trigger_source, skew=0.0, verbose=False)[source]

Reset the clock phase between CLKsync and CLKsys

Parameters:
  • trigger_behaviour (int)

  • trigger_source (int) – the PXI trigger number

  • skew (float) – the skew between PXI_CLK10 and CLKsync in multiples of 10ns

set_analog_trigger_mask(mask, channel, verbose=False)[source]
Parameters:
  • channel (int) – the input channel you are configuring

  • mask (int) – the trigger mask you are using

static set_clksys_frequency(frequency, verbose=False)[source]

Sets the CLKsys frequency

Args:

frequency (int) : frequency of CLKsys in Hz

set_coupling(coupling, channel, verbose=False)[source]

Sets the channel coupling

Parameters:
  • channel (int) – the input channel you are configuring

  • coupling (int) – the channel coupling (0 = DC, 1 = AC)

set_daq_trigger_delay(delay, channel, verbose=False)[source]

Sets the trigger delay for the specified trigger source

Parameters:
  • channel (int) – the input channel you are configuring

  • delay (int) – the delay in unknown units

set_daq_trigger_mode(mode, channel, verbose=False)[source]

Sets the trigger mode when using an external trigger

Parameters:
  • channel (int) – the input channel you are configuring

  • mode (int) – the trigger mode you are using

set_digital_trigger_mode(mode, channel, verbose=False)[source]
Parameters:
  • channel (int) – the input channel you are configuring

  • mode (int) – the trigger mode you are using

set_digital_trigger_source(source, channel, verbose=False)[source]
Parameters:
  • channel (int) – the input channel you are configuring

  • source (int) – the trigger source you are using

set_ext_trigger_behaviour(behaviour, channel, verbose=False)[source]

Sets the trigger source

Parameters:
  • channel (int) – the input channel you are configuring

  • behaviour (int) – the trigger behaviour you are using

set_ext_trigger_source(source, channel, verbose=False)[source]

Sets the trigger source

Parameters:
  • channel (int) – the input channel you are configuring

  • source (int) – the trigger source you are using

set_full_scale(full_scale, channel, verbose=False)[source]

Sets the channel full scale input voltage

Parameters:
  • channel (int) – the input channel you are configuring

  • full_scale (float) – the input full scale range in volts

set_impedance(impedance, channel, verbose=False)[source]

Sets the channel input impedance

Parameters:
  • channel (int) – the input channel you are configuring

  • impedance (int) – the input impedance (0 = Hi-Z, 1 = 50 Ohm)

set_n_cycles(n_cycles, channel, verbose=False)[source]

Sets the number of trigger cycles to collect data for

Parameters:
  • channel (int) – the input channel you are configuring

  • n_cycles (int) – the number of triggers to collect data from

set_n_points(n_points, channel)[source]

Sets the trigger source

Parameters:
  • channel (int) – the input channel you are configuring

  • n_points (int) – the number of points to be read from specified DAQ

set_points_per_cycle(n_points, channel, verbose=False)[source]

Sets the number of points to be collected per trigger

Parameters:
  • n_points (int) – the number of points to collect per cycle

  • channel (int) – the input channel you are configuring

set_prescaler(prescaler, channel, verbose=False)[source]

Sets the channel sampling frequency via the prescaler

Parameters:
  • channel (int) – the input channel you are configuring

  • prescaler (int) – the prescaler value [0..4095]

set_timeout(timeout, channel)[source]

Sets the trigger source

Parameters:
  • channel (int) – the input channel you are configuring

  • timeout (int) – the read timeout in ms for the specified DAQ

set_trigger_io(val, verbose=False)[source]

Write a value to the IO trigger port

Parameters:

value (int) – the binary value to write to the IO port

set_trigger_mode(mode, channel, verbose=False)[source]

Sets the current trigger mode from those defined in SD_AIN_TriggerMode

Parameters:
  • channel (int) – the input channel you are configuring

  • mode (int) – the trigger mode drawn from the class SD_AIN_TriggerMode

set_trigger_threshold(threshold, channel, verbose=False)[source]

Sets the current trigger threshold, in the range of -3V and 3V

Parameters:
  • channel (int) – the input channel you are configuring

  • threshold (float) – the value in volts for the trigger threshold

qcodes_contrib_drivers.drivers.Keysight.SD_common.SD_Module module

class qcodes_contrib_drivers.drivers.Keysight.SD_common.SD_Module.SD_Module(*args: Any, **kwargs: Any)[source]

Bases: Instrument

This is the general SD_Module driver class that implements shared parameters and functionality among all PXIe-based digitizer/awg/combo cards by Keysight.

This driver was written to be inherited from by either the SD_AWG, SD_DIG or SD_Combo class, depending on the functionality of the card.

Specifically, this driver was written with the M3201A and M3300A cards in mind.

This driver makes use of the Python library provided by Keysight as part of the SD1 Software package (v.2.01.00).

Parameters:
  • name – an identifier for this instrument, particularly for attaching it to a Station.

  • chassis – identification of the chassis.

  • slot – slot of the module in the chassis.

close() None[source]

Closes the hardware device and frees resources.

If you want to open the instrument again, you have to initialize a new instrument object

close_soft() None[source]
get_chassis(verbose: bool = False) int[source]

Returns the chassis number where the device is located

get_firmware_version(verbose: bool = False) str[source]

Returns the firmware version of the device

get_fpga_pc_port(port: int, data_size: int, address: int, address_mode: int, access_mode: int, verbose: bool = False) Any[source]

Reads data at the PCport FPGA Block

Parameters:
  • port – PCport number

  • data_size – number of 32-bit words to read (maximum is 128 words)

  • address – address that wil appear at the PCport interface

  • address_mode – auto-increment (0), or fixed (1)

  • access_mode – non-dma (0), or dma (1)

  • verbose – boolean indicating verbose mode

Returns:

register data.

get_hardware_version(verbose: bool = False) str[source]

Returns the hardware version of the device

get_hvi_register(register: int | str, verbose: bool = False) int[source]

Returns value of specified HVI register.

Parameters:
  • register – register to read.

  • verbose – boolean indicating verbose mode

Returns:

register value.

get_module_count(verbose: bool = False) int[source]

Returns the number of SD modules installed in the system

get_open(verbose: bool = False) bool[source]

Returns whether the device is open (True) or not (False)

get_product_name(verbose: bool = False) str[source]

Returns the product name of the device

get_product_name_by_index(index: Any, verbose: bool = False) str[source]
get_product_name_by_slot(chassis: int, slot: int, verbose: bool = False) str[source]
get_pxi_trigger(pxi_trigger: int, verbose: bool = False) int[source]

Returns the digital value of the specified PXI trigger

Parameters:
  • pxi_trigger – PXI trigger number (4000 + Trigger No.)

  • verbose – boolean indicating verbose mode

Returns:

Digital value with negated logic, 0 (ON) or 1 (OFF), or negative

numbers for errors

get_serial_number(verbose: bool = False) str[source]

Returns the serial number of the device

get_serial_number_by_index(index: Any, verbose: bool = False) str[source]
get_serial_number_by_slot(chassis: int, slot: int, verbose: bool = False) str[source]
get_slot(verbose: bool = False) int[source]

Returns the slot number where the device is located

get_status(verbose: bool = False) int[source]

Returns the status of the device

get_type(verbose: bool = False) int[source]

Returns the type of the device

get_type_by_index(index: Any, verbose: bool = False) int[source]
get_type_by_slot(chassis: int, slot: int, verbose: bool = False) int[source]
load_fpga_image(filename: str) None[source]

Loads FPGA binary image in module.

Parameters:

filename – name of the FPGA image.

open_with_serial_number(name: str, serial_number: int) Any[source]
open_with_slot(name: str, chassis: int, slot: int) Any[source]
run_self_test() int[source]
set_fpga_pc_port(port: int, data: List[int], address: int, address_mode: int, access_mode: int, verbose: bool = False) None[source]

Writes data at the PCport FPGA Block

Parameters:
  • port – PCport number

  • data – array of integers containing the data

  • address – address that will appear at the PCport interface

  • address_mode – auto-increment (0), or fixed (1)

  • access_mode – non-dma (0), or dma (1)

  • verbose – boolean indicating verbose mode

set_hvi_register(register: int | str, value: int, verbose: bool = False) None[source]

Sets value of specified HVI register.

Parameters:
  • register – register to set.

  • value – new value.

  • verbose – boolean indicating verbose mode

set_pxi_trigger(value: int, pxi_trigger: int, verbose: bool = False) None[source]

Sets the digital value of the specified PXI trigger

Parameters:
  • pxi_trigger – PXI trigger number (4000 + Trigger No.)

  • value – Digital value with negated logic, 0 (ON) or 1 (OFF)

  • verbose – boolean indicating verbose mode

qcodes_contrib_drivers.drivers.Keysight.SD_common.SD_Module.result_parser(value: Any, name: str = 'result', verbose: bool = False) Any[source]

This method is used for parsing the result in the get-methods. For values that are non-negative, the value is simply returned. Negative values indicate an error, so an error is raised with a reference to the error code.

The parser also can print to the result to the shell if verbose is 1.

Parameters:
  • value – the value to be parsed

  • name – name of the value to be parsed

  • verbose – boolean indicating verbose mode

Returns:

parsed value, which is the same as value if non-negative or not a number

qcodes_contrib_drivers.drivers.Keysight.SD_common.memory_manager module

class qcodes_contrib_drivers.drivers.Keysight.SD_common.memory_manager.MemoryManager(log, waveform_size_limit: int = 1000000)[source]

Bases: object

Memory manager for AWG memory.

AWG memory is reserved in slots of sizes from 1e4 till 1e8 samples. Allocation of memory takes time. So, only request a high maximum waveform size when it is needed.

Memory slots (number: size):

400: 1e4 samples 100: 1e5 samples 20: 1e6 samples 8: 1e7 samples 4: 1e8 samples

Parameters:

waveform_size_limit – maximum waveform size to support.

class AllocatedSlot(number: int, allocation_ref: int, memory_manager: 'MemoryManager')[source]

Bases: object

release() None[source]
allocation_ref: int
memory_manager: MemoryManager
number: int
allocate(wave_size: int) AllocatedSlot[source]

Allocates a memory slot with at least the specified wave size.

Parameters:

wave_size – number of samples of the waveform

Returns:

allocated slot

allocation_state()[source]

Example

pprint(awg._memory_manager.allocation_state())

get_uninitialized_slots() List[_MemorySlot][source]

Returns list of slots that must be initialized (reserved in AWG)

mem_usage()[source]

Example

pprint(awg._memory_manager.mem_usage(), sort_dicts=False)

release(allocated_slot: AllocatedSlot) None[source]

Releases the allocated_slot.

set_waveform_limit(waveform_size_limit: int) None[source]

Increases the maximum size of waveforms that can be uploaded.

Additional memory will be reserved in the AWG. Limit can not be reduced, because reservation cannot be undone.

Parameters:

waveform_size_limit – maximum size of waveform that can be uploaded

memory_sizes = [(10000, 400), (100000, 100), (1000000, 20), (10000000, 8), (100000000, 4)]
verbose = False

Module contents