qcodes_contrib_drivers.drivers.Spectrum package

Subpackages

Submodules

qcodes_contrib_drivers.drivers.Spectrum.M4i module

class qcodes_contrib_drivers.drivers.Spectrum.M4i.M4i(*args: Any, **kwargs: Any)[source]

Bases: Instrument

__init__(name, cardid='spcm0', **kwargs)[source]

Driver for the Spectrum M4i.44xx-x8 cards.

For more information see: http://spectrum-instrumentation.com/en/m4i-platform-overview

Example

Example usage for acquisition with channel 2 using an external trigger that triggers multiple times with trigger mode HIGH:

m4 = M4i(name='M4i', server_name=None)
m4.enable_channels(pyspcm.CHANNEL2)
m4.set_channel_settings(2,mV_range, input_path, termination, coupling, compensation)
m4.set_ext0_OR_trigger_settings(pyspcm.SPC_TM_HIGH,termination,coupling,level0)
calc = m4.multiple_trigger_acquisition(mV_range,memsize,seg_size,posttrigger_size)

Note

Error generated by the card can be retrieved with the method get_error_info32bit(). The card can be reset with reset(). Sometimes when an error occurs (including validation errors) the python console needs to be restarted

active_channels()[source]

Return a list with the indices of the active channels

blockavg_hardware_trigger_acquisition(mV_range, nr_averages=10, verbose=0, post_trigger=None)[source]

Acquire data using block averaging and hardware triggering

To read out multiple channels, use initialize_channels. This methods updates the external_trigger_mode and trigger_or_mask parameters.

Parameters:
  • mV_range (float)

  • nr_averages (int) – number of averages to take

  • verbose (int) – output level

  • post_trigger (None or int) – optional size of post_trigger buffer

Returns:

An array of voltages. If multiple channels are read, then the data is interleaved

close()[source]

Close handle to the card.

convert_to_voltage(data, input_range)[source]

convert an array of numbers to an array of voltages.

gated_trigger_acquisition(mV_range, memsize, pretrigger_size, posttrigger_size)[source]

doesn’t work completely as expected, it triggers even when the trigger level is set outside of the signal range it also seems to additionally acquire some wrong parts of the wave, but this also exists in SBench6, so it is not a problem caused by this code.

get_card_memory(verbose=0)[source]
get_card_type(verbose=0)[source]

Read card type.

get_data()[source]

Reads measurement data from the digitizer.

The data acquisition must have been started by start_acquisition() or start_triggered().

Returns:

2D array with voltages per channel in V.

get_error_info32bit(verbose=False)[source]

Read an error from the error register.

Parameters:

verbose (bool) – If True then print the error message to stdout

Returns:

errorreg (int) errorvalue (int)

get_firmware_version()[source]
get_hardware_version()[source]
get_idn()[source]

Parse a standard VISA *IDN? response into an ID dict.

Even though this is the VISA standard, it applies to various other types as well, such as IPInstruments, so it is included here in the Instrument base class.

Override this if your instrument does not support *IDN? or returns a nonstandard IDN string. This string is supposed to be a comma-separated list of vendor, model, serial, and firmware, but semicolon and colon are also common separators so we accept them here as well.

Returns:

A dict containing vendor, model, serial, and firmware.

get_max_sample_rate(verbose=0)[source]

Return max sample rate.

initialize_channels(channels=None, mV_range=1000, input_path=0, termination=0, coupling=0, compensation=None, memsize=4096, pretrigger_memsize=16, lp_filter=None)[source]

Setup channels of the digitizer for simple readout using Parameters

The channels can be read out using the Parameters channel_0, channel_1, …

Parameters:
  • channels (list) – list of channels to setup. mV_range, input_path, termination, coupling, compensation. Passed to the set_channel_settings function

  • memsize (int) – memory size to use for simple channel readout

  • pretrigger_memsize (int) – Pretrigger memory size to use. The default value used is 16, which is the smallest value possible.

multiple_trigger_acquisition(mV_range, memsize, seg_size, posttrigger_size)[source]

Acquire traces with the SPC_REC_STD_MULTI mode

This method does not update the triggering properties.

Parameters:
  • mV_range (float) – Input range used for coversion to voltage

  • memsize (int) – Size of total buffer to acquire

  • seg_size (int) – Size of segments to record

  • posttrigger_size (int) – Size of the if post trigger buffer

Returns:

Array with measured voltages

reset()[source]

Reset the card

The pyspcm.M2CMD_CARD_RESET command is executed.

retrieve_data(trace)[source]

Retrieve data from the digitizer

The data acquisition must have been started by start_acquisition.

Parameters:

trace (dict) – dictionary with acquisition settings.

Returns:

voltages (array)

set_channel_OR_trigger_settings(i, trig_mode, bitlevel0, bitlevel1=None)[source]

When a channel is used for triggering it must be enabled during the acquisition.

set_channel_settings(channel_index, mV_range, input_path, termination, coupling, compensation=None, lp_filter=None)[source]

Update settings of the specified channel

Parameters:
  • channel_index (int) – channel to update

  • mV_range (float) – measurement range for the channel (buffered path: 200, 500, 1000, 2000, 5000, or 10000) (HF path: 500, 1000, 2500, or 5000)

  • input_path (int) – input path (0: default/buffered; 1: HF/50 Ohm)

  • termination (None or int) – If None, then do not update the termination (0: 1 MOhm; 1: 50 Ohm)

  • coupling (None or int) – Set the ACDC_coupling.If None, then do not update the coupling (0: DC; 1 AC)

  • compensation (None or int) – If None, then do not update the compensation (0: off, 1: off)

  • lp_filter (Optional[int]) – enable (1) or disable (0) the 20 MHz low pass filter

set_ext0_OR_trigger_settings(trig_mode, termination, coupling, level0, level1=None)[source]

Configures ext0 trigger

Parameters:
  • trig_mode – 0: None, 1: Positive edge, 2: Negative edge, 4: Both, 8: High, 16: Low, 32: Enter window, 64: Leave window, 128: Inside window, 256: Outside window, 0x01000001: Positive + re-arm, 0x01000002: Negative + re-arm

  • termination – input termination 0: 1 MOhm, 1: 50 Ohm

  • coupling – DC/AC input coupling (0: DC, 1: AC)

  • level0 – trigger level [mV]

  • level1 – 2nd level for re-arm and windowed modes. [mV]

setup_multi_recording(posttrigger_size, n_triggers=1, pretrigger_size=None, boxcar_average=False)[source]

Setup multi recording.

Triggering must have been configured separately. Data acquisition must started with start_triggered(). The collected data can be acquired with the function get_data().

Parameters:
  • posttrigger_size (int) – size of data trace after triggering

  • n_triggers (int) – total number of triggers

  • pretrigger_size (int) – size of data trace before triggering

  • boxcar_average (bool) – use mode ‘boxcar average’

Example

digitizer.setup_multi_recording(size, n_triggers) digitizer.start_triggered() data = digitizer.get_data() # do another measurement with same settings digitizer.start_triggered() data = digitizer.get_data()

single_software_trigger_acquisition(mV_range, memsize, posttrigger_size)[source]

Acquire a single data trace

Parameters:
  • mV_range (float) – range in mV

  • memsize (int) – size of data trace

  • posttrigger_size (int) – size of data trace after triggering

Returns:

voltages (array)

single_software_trigger_acquisition_boxcar(mV_range, memsize, posttrigger_size)[source]

Acquire a single data trace with boxcar averaging

Parameters:
  • mV_range (float) – range in mV

  • memsize (int) – size of data trace

  • posttrigger_size (int) – size of data trace after triggering

Returns:

voltages (array)

single_trigger_acquisition(mV_range, memsize, posttrigger_size)[source]

Acquire traces with the SPC_REC_STD_SINGLE mode

This method does not update the triggering properties.

Parameters:
  • mV_range (float) – Input range used for coversion to voltage

  • memsize (int) – Size of total buffer to acquire

  • posttrigger_size (int) – Size of the if post trigger buffer

Returns:

Array with measured voltages

start_acquisition(mV_range, memsize, posttrigger_size=None, verbose=0)[source]

Start data acquisition of a single data trace

The resulting data can be acquired with the function retrieve_data.

Parameters:
  • mV_range (float) – range in mV

  • memsize (int) – size of data trace

  • posttrigger_size (int or None) – size of data trace after triggering

Returns:

trace as a dict. Data concerning the trace

start_triggered()[source]

Starts triggered acquisition

wait_ready() int[source]

Wait for the M4i card to be ready using M2CMD_CARD_WAITREADY :returns: Return code of the M4i general command used to wait for the card to be ready

qcodes_contrib_drivers.drivers.Spectrum.M4i.szTypeToName(lCardType)[source]

Convert card type to string

This function is taken from an example provided by Spectrum GmbH

Module contents