qcodes_contrib_drivers.drivers.QDevil package

Submodules

qcodes_contrib_drivers.drivers.QDevil.QDAC1 module

class qcodes_contrib_drivers.drivers.QDevil.QDAC1.Generator(generator_number: int)[source]

Bases: object

class qcodes_contrib_drivers.drivers.QDevil.QDAC1.Mode(value)[source]

Bases: Enum

Enum type use as the mode parameter for channels defining the combined voltage and current range.

get_label() returns a text representation of the mode.

get_label() str[source]
vhigh_ihigh = (0, 1)
vhigh_ilow = (0, 0)
vlow_ilow = (1, 0)
class qcodes_contrib_drivers.drivers.QDevil.QDAC1.QDac(*args: Any, **kwargs: Any)[source]

Bases: VisaInstrument

Channelised driver for the QDevil QDAC voltage source.

Exposes channels, temperature sensors and calibration output, and ‘ramp_voltages’ + ‘ramp_voltages_2d’ for multi channel ramping.

In addition a ‘mode_force’ flag (default False) is exposed. ‘mode_force’ (=True) is used to enable voltage range switching, via the channel ‘mode’ parameter, even at non-zero output voltages.

Tested with Firmware Version: 1.07

The driver assumes that the instrument is ALWAYS in verbose mode OFF and sets this as part of the initialization, so please do not change this.

__init__(name: str, address: str, update_currents: bool = False, **kwargs: Any)[source]

Instantiates the instrument.

Parameters:
  • name – The instrument name used by qcodes

  • address – The VISA name of the resource

  • update_currents – Whether to query all channels for their current sensor value on startup, which takes about 0.5 sec per channel. Default: False.

Returns:

QDac object

clear_read_queue() Sequence[str][source]

Flush the VISA message queue of the instrument

Waits 1 ms between each read.

Returns:

Messages lingering in queue

Return type:

Sequence[str]

connect_message(idn_param: str = 'IDN', begin_time: float | None = None) None[source]

Override of the standard Instrument class connect_message. Usually, the response to *IDN? is printed. Here, the software version is printed.

print_overview(update_currents: bool = False) None[source]

Pretty-prints the status of the QDac

print_slopes() None[source]

Print the finite slopes assigned to channels, sorted by channel number

print_syncs() None[source]

Print assigned SYNC ports, sorted by channel number

ramp_voltages(channellist: Sequence[int], v_startlist: Sequence[float], v_endlist: Sequence[float], ramptime: float) float[source]

Function for smoothly ramping one channel or more channels simultaneously (max. 8). This is a shallow interface to ramp_voltages_2d. Function generators and triggers are are assigned automatically.

Parameters:
  • channellist – List (int) of channels to be ramped (1 indexed)

  • v_startlist – List (int) of voltages to ramp from. MAY BE EMPTY. But if provided, time is saved by NOT reading the present values from the instrument.

  • v_endlist – List (int) of voltages to ramp to.

  • ramptime – Total ramp time in seconds (min. 0.002). Has to be an integer number of 0.001 secs).

Returns:

Estimated time of the excecution of the 2D scan.

NOTE: This function returns as the ramps are started. So you need to wait for ‘ramptime’ until measuring….

ramp_voltages_2d(slow_chans: Sequence[int], slow_vstart: Sequence[float], slow_vend: Sequence[float], fast_chans: Sequence[int], fast_vstart: Sequence[float], fast_vend: Sequence[float], step_length: float, slow_steps: int, fast_steps: int) float[source]

Function for smoothly ramping two channel groups simultaneously with one slow (x) and one fast (y) group. used by ‘ramp_voltages’ where x is empty. Function generators and triggers are assigned automatically.

Parameters:
  • slow_chans – List of channels to be ramped (1 indexed) in the slow-group

  • slow_vstart – List of voltages to ramp from in the slow-group. MAY BE EMPTY. But if provided, time is saved by NOT reading the present values from the instrument.

  • slow_vend – list of voltages to ramp to in the slow-group.

  • fast_chans – List of channels to be ramped (1 indexed) in the fast-group.

  • fast_vstart – List of voltages to ramp from in the fast-group. MAY BE EMPTY. But if provided, time is saved by NOT reading the present values from the instrument.

  • fast_vend – list of voltages to ramp to in the fast-group.

  • step_length – Time spent at each step in seconds (min. 0.001) multiple of 1 ms.

  • slow_steps – number of steps in the slow direction.

  • fast_steps – number of steps in the fast direction.

Returns:

Estimated time of the excecution of the 2D scan.

NOTE: This function returns as the ramps are started.

read() str[source]
reset(update_currents: bool = False) None[source]

Resets the instrument setting all channels to zero output voltage and all parameters to their default values, including removing any assigned sync putputs, function generators, triggers etc.

snapshot_base(update: bool | None = False, params_to_skip_update: Sequence[str] | None = None) Dict[Any, Any][source]

State of the instrument as a JSON-compatible dict (everything that the custom JSON encoder class NumpyJSONEncoder supports).

Parameters:
  • update – If True, update the state by querying the instrument. If None only update if the state is known to be invalid. If False, just use the latest values in memory and never update.

  • params_to_skip_update – List of parameter names that will be skipped in update even if update is True. This is useful if you have parameters that are slow to update but can be updated in a different way (as in the qdac). If you want to skip the update of certain parameters in all snapshots, use the snapshot_get attribute of those parameters instead.

Returns:

base snapshot

Return type:

dict

write(cmd: str) None[source]

QDac always returns something even from set commands, even when verbose mode is off, so we’ll override write to take this out if you want to use this response, we put it in self._write_response (but only for the very last write call)

In this method we expect to read one termination char per command. As commands are concatenated by ; we count the number of concatenated commands as count(‘;’) + 1 e.g. ‘wav 1 1 1 0;fun 2 1 100 1 1’ is two commands. Note that only the response of the last command will be available in _write_response

max_status_age = 1
class qcodes_contrib_drivers.drivers.QDevil.QDAC1.QDacChannel(parent: QDac, name: str, channum: int)[source]

Bases: InstrumentChannel

A single output channel of the QDac.

Exposes chan.v, chan.i, chan.mode, chan.slope, chan.sync, chan.sync_delay, chan.sync_duration.

NB: Set v to zero before changing mode if the mode_force lfag is False (default).

__init__(parent: QDac, name: str, channum: int)[source]
Parameters:
  • parent – The instrument to which the channel belongs.

  • name – The name of the channel

  • channum – The number of the channel (1-24 or 1-48)

snapshot_base(update: bool | None = False, params_to_skip_update: Sequence[str] | None = None) Dict[Any, Any][source]

State of the instrument as a JSON-compatible dict (everything that the custom JSON encoder class NumpyJSONEncoder supports).

Parameters:
  • update – If True, update the state by querying the instrument. If None update the state if known to be invalid. If False, just use the latest values in memory and never update state.

  • params_to_skip_update – List of parameter names that will be skipped in update even if update is True. This is useful if you have parameters that are slow to update but can be updated in a different way (as in the qdac). If you want to skip the update of certain parameters in all snapshots, use the snapshot_get attribute of those parameters instead.

Returns:

base snapshot

Return type:

dict

class qcodes_contrib_drivers.drivers.QDevil.QDAC1.QDacMultiChannelParameter(channels: Sequence[InstrumentChannel], param_name: str, *args: Any, **kwargs: Any)[source]

Bases: MultiChannelInstrumentParameter

The class to be returned by __getattr__ of the ChannelList. Here customised for fast multi-readout of voltages.

get_raw() Tuple[Any, ...][source]

Return a tuple containing the data from each of the channels in the list.

class qcodes_contrib_drivers.drivers.QDevil.QDAC1.Waveform[source]

Bases: object

all_waveforms = [1, 2, 3, 4]
sine = 1
square = 2
staircase = 4
triangle = 3

qcodes_contrib_drivers.drivers.QDevil.QDAC2 module

class qcodes_contrib_drivers.drivers.QDevil.QDAC2.Arrangement_Context(qdac: QDac2, contacts: Dict[str, int], output_triggers: Dict[str, int] | None, internal_triggers: Sequence[str] | None, outer_trigger_channel: int | None)[source]

Bases: object

actual_voltages() Sequence[float][source]
Returns:

Corrected voltages for all contacts

Return type:

Sequence[float]

add_correction(contact: str, factors: Sequence[float]) None[source]

Update how much a particular contact influences the other contacts

This is mostly useful in arrangements where each contact has significant effect only on nearby contacts, and thus can be added incrementally.

The factors are extended by the identity matrix and multiplied to the correction matrix.

Parameters:
  • contact (str) – Name of contact

  • factors (Sequence[float]) – factors usually between -1.0 and 1.0

channel(name: str) QDac2Channel[source]
close() None[source]
currents_A(nplc: int = 1, current_range: str = 'low') Sequence[float][source]

Measure currents on all contacts

Parameters:
  • nplc (int, optional) – Number of powerline cycles to average over

  • current_range (str, optional) – Current range (default low)

get_trigger_by_name(name: str) QDac2Trigger_Context[source]
Parameters:

name (str) – Name of trigger

Returns:

Trigger context manager

Return type:

QDac2Trigger_Context

initiate_correction(contact: str, factors: Sequence[float]) None[source]

Override how much a particular contact influences the other contacts

Parameters:
  • contact (str) – Name of contact

  • factors (Sequence[float]) – factors between -1.0 and 1.0

leakage(modulation_V: float, nplc: int = 2) ndarray[source]

Run a simple leakage test between the contacts

Each contact is changed in turn and the resulting change in current from steady-state is recorded. The resulting resistance matrix is calculated as modulation_voltage divided by current_change.

Parameters:
  • modulation_V (float) – Virtual voltage added to each contact

  • nplc (int, Optional) – Powerline cycles to wait for each measurement

Returns:

contact-to-contact resistance in Ohms

Return type:

ndarray

set_virtual_voltage(contact: str, voltage: float) None[source]

Set virtual voltage on specific contact

The actual voltage that the contact will receive depends on the correction matrix.

Parameters:
  • contact (str) – Name of contact

  • voltage (float) – Voltage corresponding to no correction

set_virtual_voltages(contacts_to_voltages: Dict[str, float]) None[source]

Set virtual voltages on specific contacts in one go

The actual voltage that each contact will receive depends on the correction matrix.

Parameters:

contact_to_voltages (Dict[str,float]) – contact to voltage map

virtual_detune(contacts: Sequence[str], start_V: Sequence[float], end_V: Sequence[float], steps: int, start_trigger: str | None = None, step_time_s: float = 1e-05, step_trigger: str | None = None, repetitions: int = 1) Virtual_Sweep_Context[source]

Sweep any number of contacts linearly from one set of values to another set of values

Parameters:
  • contacts (Sequence[str]) – contacts involved in sweep

  • start_V (Sequence[float]) – First-extreme values

  • end_V (Sequence[float]) – Second-extreme values

  • steps (int) – Number of steps between extremes

  • start_trigger (None, optional) – Trigger that starts sweep

  • step_time_s (float, Optional) – Seconds between each step

  • step_trigger (None, optional) – Trigger that marks each step

  • repetitions (int, Optional) – Number of back-and-forth sweeps, or -1 for infinite

virtual_sweep(contact: str, voltages: Sequence[float], start_sweep_trigger: str | None = None, step_time_s: float = 1e-05, step_trigger: str | None = None, repetitions: int = 1) Virtual_Sweep_Context[source]

Sweep a contact to create a 1D sweep

Parameters:
  • contact (str) – Name of sweeping contact

  • voltages (Sequence[float]) – Virtual sweep voltages

  • outer_contact (str) – Name of slow-changing (outer) contact

  • start_sweep_trigger (None, optional) – Trigger that starts sweep

  • step_time_s (float, optional) – Delay between voltage changes

  • step_trigger (None, optional) – Trigger that marks each step

  • repetitions (int, Optional) – Number of back-and-forth sweeps, or -1 for infinite

Returns:

context manager

Return type:

Virtual_Sweep_Context

virtual_sweep2d(inner_contact: str, inner_voltages: Sequence[float], outer_contact: str, outer_voltages: Sequence[float], start_sweep_trigger: str | None = None, inner_step_time_s: float = 1e-05, inner_step_trigger: str | None = None, outer_step_trigger: str | None = None, repetitions: int = 1) Virtual_Sweep_Context[source]

Sweep two contacts to create a 2D sweep

Parameters:
  • inner_contact (str) – Name of fast-changing (inner) contact

  • inner_voltages (Sequence[float]) – Inner contact virtual voltages

  • outer_contact (str) – Name of slow-changing (outer) contact

  • outer_voltages (Sequence[float]) – Outer contact virtual voltages

  • start_sweep_trigger (None, optional) – Trigger that starts sweep

  • inner_step_time_s (float, optional) – Delay between voltage changes

  • inner_step_trigger (None, optional) – Trigger that marks each step

  • outer_step_trigger (None, optional) – Name of trigger that marks outer step

  • repetitions (int, Optional) – Number of back-and-forth sweeps, or -1 for infinite

Returns:

context manager

Return type:

Virtual_Sweep_Context

virtual_voltage(contact: str) float[source]
Parameters:

contact (str) – Name of contact

Returns:

Voltage before correction

Return type:

float

property channel_numbers: Sequence[int]

Returns: Sequence[int]: Channels numbers in the same order as contact_names

property contact_names: Sequence[str]

Returns: Sequence[str]: Contact names in the same order as channel_numbers

property correction_matrix: ndarray

Correction matrix

property shape: int

Number of contacts in the arrangement

class qcodes_contrib_drivers.drivers.QDevil.QDAC2.Awg_Context(channel: QDac2Channel, trace_name: str, repetitions: int, scale: float, offset_V: float, slew_V_s: float | None)[source]

Bases: _Waveform_Context

abort() None[source]

Abort any running AWG

close() None[source]
cycles_remaining() int[source]
Returns:

Number of cycles remaining in the AWG

Return type:

int

end_marker() QDac2Trigger_Context[source]

Internal trigger that will mark the end of the AWG

A new internal trigger is allocated if necessary.

Returns:

trigger that will mark the end

Return type:

QDac2Trigger_Context

period_end_marker() QDac2Trigger_Context[source]

Internal trigger that will mark the end of each period

A new internal trigger is allocated if necessary.

Returns:

trigger that will mark the end of each period

Return type:

QDac2Trigger_Context

period_start_marker() QDac2Trigger_Context[source]

Internal trigger that will mark the beginning of each period

A new internal trigger is allocated if necessary.

Returns:

trigger that will mark the beginning of each period

Return type:

QDac2Trigger_Context

start() None[source]

Start the AWG

start_marker() QDac2Trigger_Context[source]

Internal trigger that will mark the beginning of the AWG

A new internal trigger is allocated if necessary.

Returns:

trigger that will mark the beginning

Return type:

QDac2Trigger_Context

start_on(trigger: QDac2Trigger_Context) None[source]

Attach internal trigger to start the AWG

Parameters:

trigger (QDac2Trigger_Context) – trigger that will start AWG

start_on_external(trigger: ExternalInput) None[source]

Attach external trigger to start the AWG

Parameters:

trigger (ExternalInput) – external trigger that will start AWG

start_once_on(trigger: QDac2Trigger_Context) None[source]

Attach internal one-shot trigger to start the AWG

Parameters:

trigger (QDac2Trigger_Context) – trigger that will start AWG

start_once_on_external(trigger: ExternalInput) None[source]

Attach external one-shot trigger to start the AWG

Parameters:

trigger (ExternalInput) – external trigger that will start AWG

class qcodes_contrib_drivers.drivers.QDevil.QDAC2.List_Context(channel: QDac2Channel, voltages: Sequence[float], repetitions: int, dwell_s: float, delay_s: float, backwards: bool, stepped: bool)[source]

Bases: _Dc_Context

append(voltages: Sequence[float]) None[source]

Append voltages to the existing list

Parameters:

voltages (Sequence[float]) – Sequence of voltages

cycles_remaining() int[source]
Returns:

Number of cycles remaining in the DC list

Return type:

int

points() int[source]
Returns:

Number of steps in the DC list

Return type:

int

start() None[source]

Start the DC list generator

values_V() Sequence[float][source]
Returns:

List of voltages

Return type:

Sequence[float]

class qcodes_contrib_drivers.drivers.QDevil.QDAC2.Measurement_Context(channel: QDac2Channel, delay_s: float, repetitions: int, current_range: str, aperture_s: float | None, nplc: int | None)[source]

Bases: _Channel_Context

abort() None[source]

Abort current measurement

available_A() Sequence[float][source]

Retrieve current measurements

The available measurements will be removed from measurement queue.

Returns:

list of available current measurements

Return type:

Sequence[float]

close() None[source]
n_available() int[source]
Returns:

Number of measurements available

Return type:

int

n_cycles_remaining() int[source]
Returns:

Number of measurements remaining

Return type:

int

peek_A() float[source]

Peek at the first available current measurement

Returns:

current in Amperes

Return type:

float

start() None[source]

Start a current measurement

start_on(trigger: QDac2Trigger_Context) None[source]

Attach internal trigger to start the current measurement

Parameters:

trigger (QDac2Trigger_Context) – trigger that will start measurement

start_on_external(trigger: ExternalInput) None[source]

Attach external trigger to start the current measurement

Parameters:

trigger (ExternalInput) – trigger that will start measurement

start_once_on(trigger: QDac2Trigger_Context) None[source]

Attach internal once-shot trigger to start the current measurement

Parameters:

trigger (QDac2Trigger_Context) – trigger that will start measurement

start_once_on_external(trigger: ExternalInput) None[source]

Attach external one-shot trigger to start the current measurement

Parameters:

trigger (ExternalInput) – trigger that will start measurement

class qcodes_contrib_drivers.drivers.QDevil.QDAC2.QDac2(*args: Any, **kwargs: Any)[source]

Bases: VisaInstrument

__init__(name: str, address: str, **kwargs) None[source]

Connect to a QDAC-II

Parameters:
  • name (str) – Name for instrument

  • address (str) – Visa identification string

  • **kwargs – additional argument to the Visa driver

allocate_trace(name: str, size: int) Trace_Context[source]

Reserve memory for a new trace

Parameters:
  • name (str) – Name of new trace

  • size (int) – Number of voltage values in the trace

Returns:

context manager

Return type:

Trace_Context

allocate_trigger() QDac2Trigger_Context[source]

Allocate an internal trigger

Does not have any effect on the instrument, only the driver.

Returns:

Context manager

Return type:

QDac2Trigger_Context

Raises:

ValueError – no free triggers

arrange(contacts: Dict[str, int], output_triggers: Dict[str, int] | None = None, internal_triggers: Sequence[str] | None = None, outer_trigger_channel: int | None = None) Arrangement_Context[source]

An arrangement of contacts and triggers for virtual gates

Each contact corresponds to a particular output channel. Each output_trigger corresponds to a particular external output trigger. Each internal_trigger will be allocated from the pool of internal triggers, and can later be used for synchronisation. After initialisation of the arrangement, contacts and triggers can only be referred to by name.

The voltages that will appear on each contact depends not only on the specified virtual voltage, but also on a correction matrix. Initially, the contacts are assumed to not influence each other, which means that the correction matrix is the identity matrix, ie. the row for each contact has a value of [0, …, 0, 1, 0, …, 0].

Parameters:
  • contacts (Dict[str, int]) – Name/channel pairs

  • output_triggers (Sequence[Tuple[str,int]], optional) – Name/number pairs of output triggers

  • internal_triggers (Sequence[str], optional) – List of names of internal triggers to allocate

  • outer_trigger_channel (int, optional) – Additional channel if outer trigger is needed

Returns:

context manager

Return type:

Arrangement_Context

ask(cmd: str) str[source]

Send SCPI query to instrument

Parameters:

cmd (str) – SCPI query

Returns:

SCPI answer

Return type:

str

channel(ch: int) QDac2Channel[source]
Parameters:

ch (int) – Channel number

Returns:

Visa representation of the channel

Return type:

QDac2Channel

clear() None[source]

Reset the VISA message queue of the instrument

clear_read_queue() Sequence[str][source]

Flush the VISA message queue of the instrument

Takes at least _message_flush_timeout_ms to carry out.

Returns:

Messages lingering in queue

Return type:

Sequence[str]

connect_external_trigger(port: int, trigger: QDac2Trigger_Context, width_s: float = 1e-06) None[source]

Route internal trigger to external trigger

Parameters:
  • port (int) – External output trigger number

  • trigger (QDac2Trigger_Context) – Internal trigger

  • width_s (float, optional) – Output trigger width in seconds (default 1ms)

error() str[source]

Retrieve next error

Returns:

The next error or ‘0, “No error”’

Return type:

str

errors() str[source]

Retrieve and clear all previous errors

Returns:

Comma separated list of errors or ‘0, “No error”’

Return type:

str

free_all_triggers() None[source]

Free all an internal triggers

Does not have any effect on the instrument, only the driver.

free_trigger(trigger: QDac2Trigger_Context) None[source]

Free an internal trigger

Does not have any effect on the instrument, only the driver.

Parameters:

trigger (QDac2Trigger_Context) – trigger to free

get_recorded_scpi_commands() List[str][source]
Returns:

SCPI commands sent to the instrument

Return type:

Sequence[str]

mac() str[source]
Returns:

Media Access Control (MAC) address of the instrument

Return type:

str

n_channels() int[source]
Returns:

Number of channels

Return type:

int

n_errors() int[source]

Peek at number of previous errors

Returns:

Number of errors

Return type:

int

static n_external_inputs() int[source]
Returns:

Number of external input triggers

Return type:

int

n_external_outputs() int[source]
Returns:

Number of external output triggers

Return type:

int

static n_triggers() int[source]
Returns:

Number of internal triggers

Return type:

int

remove_traces() None[source]

Delete all trace definitions from the instrument

This means that all AWGs loose their data.

reset() None[source]
start_all() None[source]

Trigger the global SCPI bus (*TRG)

All generators, that have not been explicitly set to trigger on an internal or external trigger, will be started.

start_recording_scpi() None[source]

Record all SCPI commands sent to the instrument

Any previous recordings are removed. To inspect the SCPI commands sent to the instrument, call get_recorded_scpi_commands().

traces() Sequence[str][source]

List all defined traces

Returns:

trace names

Return type:

Sequence[str]

write(cmd: str) None[source]

Send SCPI command to instrument

Parameters:

cmd (str) – SCPI command

write_floats(cmd: str, values: Sequence[float]) None[source]

Append a list of values to a SCPI command

By default, the values are IEEE binary encoded.

Remember to include separating space in command if needed.

class qcodes_contrib_drivers.drivers.QDevil.QDAC2.QDac2Channel(parent: QDac2, name: str, channum: int)[source]

Bases: InstrumentChannel

arbitrary_wave(trace_name: str, repetitions: int = 1, scale: float = 1.0, offset_V: float = 0.0, slew_V_s: float | None = None) Awg_Context[source]

Set up an arbitrary-wave generator

Parameters:
  • trace_name (str) – Use data from this named trace

  • repetitions (int, optional) – Number of repetition (default 1)

  • scale (float, optional) – Scaling factor of voltages (default 1)

  • offset_V (float, optional) – Offset (default 0V)

  • slew_V_s (None, optional) – Max slew rate in V/s (default None)

Returns:

context manager

Return type:

Awg_Context

ask_channel(cmd: str) str[source]

Inject channel number into SCPI query

Parameters:

cmd (str) – Must contain a ‘{0}’ placeholder for the channel number

Returns:

SCPI answer

Return type:

str

clear_measurements() Sequence[float][source]

Retrieve current measurements

The available measurements will be removed from measurement queue.

Returns:

list of available current measurements

Return type:

Sequence[float]

dc_list(voltages: Sequence[float], repetitions: int = 1, dwell_s: float = 0.001, delay_s: float = 0, backwards: bool = False, stepped: bool = False) List_Context[source]

Set up a DC-list generator

Parameters:
  • voltages (Sequence[float]) – Voltages in list

  • repetitions (int, optional) – Number of repetitions of the list (default 1)

  • dwell_s (float, optional) – Seconds between each voltage (default 1ms)

  • delay_s (float, optional) – Seconds of delay after receiving a trigger (default 0)

  • backwards (bool, optional) – Use list in reverse (default is forward)

  • stepped (bool, optional) – True means that each step needs to be triggered (default False)

Returns:

context manager

Return type:

List_Context

dc_sweep(start_V: float, stop_V: float, points: int, repetitions: int = 1, dwell_s: float = 0.001, delay_s: float = 0, backwards=False, stepped=True) Sweep_Context[source]

Set up a DC sweep

Parameters:
  • start_V (float) – Start voltage

  • stop_V (float) – Send voltage

  • points (int) – Number of steps

  • repetitions (int, optional) – Number of repetition (default 1)

  • dwell_s (float, optional) – Seconds between each voltage (default 1ms)

  • delay_s (float, optional) – Seconds of delay after receiving a trigger (default 0)

  • backwards (bool, optional) – Sweep in reverse (default is forward)

  • stepped (bool, optional) – True means discrete steps (default True)

Returns:

context manager

Return type:

Sweep_Context

measurement(delay_s: float = 0.0, repetitions: int = 1, current_range: str = 'high', aperture_s: float | None = None, nplc: int | None = None) Measurement_Context[source]

Set up a sequence of current measurements

Parameters:
  • delay_s (float, optional) – Seconds to delay the actual measurement after trigger (default 0)

  • repetitions (int, optional) – Number of consecutive measurements (default 1)

  • current_range (str, optional) – high (10mA, default) or low (200nA)

  • nplc (None, optional) – Integration time in power-line cycles (default 1)

  • aperture_s (None, optional) – Seconds of integration time instead of NPLC

Returns:

context manager

Return type:

Measurement_Context

Raises:

ValueError – configuration error

output_mode(range: str = 'high', filter: str = 'high') None[source]

Set the output voltage

Parameters:
  • range (str, optional) – Low or high (default) current range

  • filter (str, optional) – DC (10Hz), medium (10kHz) or high (300kHz, default) voltage filter

sine_wave(frequency_Hz: float | None = None, period_s: float | None = None, repetitions: int = -1, inverted: bool = False, span_V: float = 0.2, offset_V: float = 0.0, delay_s: float = 0, slew_V_s: float | None = None) Sine_Context[source]

Set up a sine-wave generator

Parameters:
  • frequency_Hz (float, optional) – Frequency

  • period_s (float, optional) – Period length (instead of frequency)

  • repetitions (int, optional) – Number of repetition (default infinite)

  • inverted (bool, optional) – True means flipped (default False)

  • span_V (float, optional) – Voltage span (default 200mV)

  • offset_V (float, optional) – Offset (default 0V)

  • delay_s (float, optional) – Seconds of delay after receiving a trigger (default 0)

  • slew_V_s (None, optional) – Max slew rate in V/s (default None)

Returns:

context manager

Return type:

Sine_Context

Raises:

ValueError – configuration error

square_wave(frequency_Hz: float | None = None, period_s: float | None = None, repetitions: int = -1, duty_cycle_percent: float = 50.0, kind: str = 'symmetric', inverted: bool = False, span_V: float = 0.2, offset_V: float = 0.0, delay_s: float = 0, slew_V_s: float | None = None) Square_Context[source]

Set up a square-wave generator

Parameters:
  • frequency_Hz (float, optional) – Frequency

  • period_s (float, optional) – Period length (instead of frequency)

  • repetitions (int, optional) – Number of repetition (default infinite)

  • duty_cycle_percent (float, optional) – Percentage on-time (default 50%)

  • kind (str, optional) – Positive, negative or symmetric (default) around the offset

  • inverted (bool, optional) – True means flipped (default False)

  • span_V (float, optional) – Voltage span (default 200mV)

  • offset_V (float, optional) – Offset (default 0V)

  • delay_s (float, optional) – Seconds of delay after receiving a trigger (default 0)

  • slew_V_s (float, optional) – Max slew rate in V/s (default None)

Returns:

context manager

Return type:

Square_Context

Raises:

ValueError – configuration error

triangle_wave(frequency_Hz: float | None = None, period_s: float | None = None, repetitions: int = -1, duty_cycle_percent: float = 50.0, inverted: bool = False, span_V: float = 0.2, offset_V: float = 0.0, delay_s: float = 0, slew_V_s: float | None = None) Triangle_Context[source]

Set up a triangle-wave generator

Parameters:
  • frequency_Hz (float, optional) – Frequency

  • period_s (float, optional) – Period length (instead of frequency)

  • repetitions (int, optional) – Number of repetition (default infinite)

  • duty_cycle_percent (float, optional) – Percentage on-time (default 50%)

  • inverted (bool, optional) – True means flipped (default False)

  • span_V (float, optional) – Voltage span (default 200mV)

  • offset_V (float, optional) – Offset (default 0V)

  • delay_s (float, optional) – Seconds of delay after receiving a trigger (default 0)

  • slew_V_s (float, optional) – Max slew rate in V/s (default None)

Returns:

context manager

Return type:

Triangle_Context

Raises:

ValueError – configuration error

write(cmd: str) None[source]

Send a SCPI command

Parameters:

cmd (str) – SCPI command

write_channel(cmd: str) None[source]

Inject channel number into SCPI command

Parameters:

cmd (str) – Must contain a ‘{0}’ placeholder for the channel number

write_channel_floats(cmd: str, values: Sequence[float]) None[source]

Inject channel number and a list of values into SCPI command

The values are appended to the end of the command.

Parameters:
  • cmd (str) – Must contain a ‘{0}’ placeholder for channel number

  • values (Sequence[float]) – Sequence of numbers

property number: int

Channel number

class qcodes_contrib_drivers.drivers.QDevil.QDAC2.QDac2ExternalTrigger(parent: QDac2, name: str, external: int)[source]

Bases: InstrumentChannel

External output trigger

There are three 5V isolated triggers on the front (1, 2, 3) and two non-isolated 3V3 on the back (4, 5).

class qcodes_contrib_drivers.drivers.QDevil.QDAC2.QDac2Trigger_Context(parent: QDac2, value: int)[source]

Bases: object

Internal Triggers with automatic deallocation

This context manager wraps an already-allocated internal trigger number so that the trigger can be automatically reclaimed when the context exits.

close() None[source]
property value: int

internal SCPI trigger number

class qcodes_contrib_drivers.drivers.QDevil.QDAC2.Sine_Context(channel: QDac2Channel, frequency_Hz: float | None, repetitions: int, period_s: float | None, inverted: bool, span_V: float, offset_V: float, delay_s: float, slew_V_s: float | None)[source]

Bases: _Waveform_Context

abort() None[source]

Abort any running sine wave generator

close() None[source]
cycles_remaining() int[source]
Returns:

Number of cycles remaining in the sine wave

Return type:

int

end_marker() QDac2Trigger_Context[source]

Internal trigger that will mark the end of the sine wave

A new internal trigger is allocated if necessary.

Returns:

trigger that will mark the end

Return type:

QDac2Trigger_Context

period_end_marker() QDac2Trigger_Context[source]

Internal trigger that will mark the end of each period

A new internal trigger is allocated if necessary.

Returns:

trigger that will mark the end of each period

Return type:

QDac2Trigger_Context

period_start_marker() QDac2Trigger_Context[source]

Internal trigger that will mark the beginning of each period

A new internal trigger is allocated if necessary.

Returns:

trigger that will mark the beginning of each period

Return type:

QDac2Trigger_Context

start() None[source]

Start the sine wave generator

start_marker() QDac2Trigger_Context[source]

Internal trigger that will mark the beginning of the sine wave

A new internal trigger is allocated if necessary.

Returns:

trigger that will mark the beginning

Return type:

QDac2Trigger_Context

start_on(trigger: QDac2Trigger_Context) None[source]

Attach internal trigger to start the sine wave generator

Parameters:

trigger (QDac2Trigger_Context) – trigger that will start sine wave

start_on_external(trigger: ExternalInput) None[source]

Attach external trigger to start the sine wave generator

Parameters:

trigger (ExternalInput) – external trigger that will start sine wave

start_once_on(trigger: QDac2Trigger_Context) None[source]

Attach internal one-shot trigger to start the sine wave generator

Parameters:

trigger (QDac2Trigger_Context) – trigger that will start sine wave

start_once_on_external(trigger: ExternalInput) None[source]

Attach external one-shot trigger to start the sine wave generator

Parameters:

trigger (ExternalInput) – external trigger that will start sine wave

class qcodes_contrib_drivers.drivers.QDevil.QDAC2.Square_Context(channel: QDac2Channel, frequency_Hz: float | None, repetitions: int, period_s: float | None, duty_cycle_percent: float, kind: str, inverted: bool, span_V: float, offset_V: float, delay_s: float, slew_V_s: float | None)[source]

Bases: _Waveform_Context

abort() None[source]

Abort any running square wave generator

close() None[source]
cycles_remaining() int[source]
Returns:

Number of cycles remaining in the square wave

Return type:

int

end_marker() QDac2Trigger_Context[source]

Internal trigger that will mark the end of the square wave

A new internal trigger is allocated if necessary.

Returns:

trigger that will mark the end

Return type:

QDac2Trigger_Context

period_end_marker() QDac2Trigger_Context[source]

Internal trigger that will mark the end of each period

A new internal trigger is allocated if necessary.

Returns:

trigger that will mark the end of each period

Return type:

QDac2Trigger_Context

period_start_marker() QDac2Trigger_Context[source]

Internal trigger that will mark the beginning of each period

A new internal trigger is allocated if necessary.

Returns:

trigger that will mark the beginning of each period

Return type:

QDac2Trigger_Context

start() None[source]

Start the square wave generator

start_marker() QDac2Trigger_Context[source]

Internal trigger that will mark the beginning of the square wave

A new internal trigger is allocated if necessary.

Returns:

trigger that will mark the beginning

Return type:

QDac2Trigger_Context

start_on(trigger: QDac2Trigger_Context) None[source]

Attach internal trigger to start the square wave generator

Parameters:

trigger (QDac2Trigger_Context) – trigger that will start square wave

start_on_external(trigger: ExternalInput) None[source]

Attach external trigger to start the square wave generator

Parameters:

trigger (ExternalInput) – external trigger that will start square wave

start_once_on(trigger: QDac2Trigger_Context) None[source]

Attach internal one-shot trigger to start the square wave generator

Parameters:

trigger (QDac2Trigger_Context) – trigger that will start square wave

start_once_on_external(trigger: ExternalInput) None[source]

Attach external one-shot trigger to start the square wave generator

Parameters:

trigger (ExternalInput) – external trigger that will start square wave

class qcodes_contrib_drivers.drivers.QDevil.QDAC2.Sweep_Context(channel: QDac2Channel, start_V: float, stop_V: float, points: int, repetitions: int, dwell_s: float, delay_s: float, backwards: bool, stepped: bool)[source]

Bases: _Dc_Context

cycles_remaining() int[source]
Returns:

Number of cycles remaining in the DC sweep

Return type:

int

points() int[source]
Returns:

Number of steps in the DC sweep

Return type:

int

start() None[source]

Start the DC sweep

start_V() float[source]
Returns:

Starting voltage

Return type:

float

stop_V() float[source]
Returns:

Ending voltage

Return type:

float

time_s() float[source]
Returns:

Seconds that it will take to do the sweep

Return type:

float

values_V() Sequence[float][source]
Returns:

List of voltages

Return type:

Sequence[float]

class qcodes_contrib_drivers.drivers.QDevil.QDAC2.Trace_Context(parent, name: str, size: int)[source]

Bases: object

waveform(values: Sequence[float]) None[source]

Fill values into trace

Parameters:

values (Sequence[float]) – Sequence of values

Raises:

ValueError – size mismatch

property name: str

Name of trace

property size: int

Number of values in trace

class qcodes_contrib_drivers.drivers.QDevil.QDAC2.Triangle_Context(channel: QDac2Channel, frequency_Hz: float | None, repetitions: int, period_s: float | None, duty_cycle_percent: float, inverted: bool, span_V: float, offset_V: float, delay_s: float, slew_V_s: float | None)[source]

Bases: _Waveform_Context

abort() None[source]

Abort any running triangle wave generator

close() None[source]
cycles_remaining() int[source]
Returns:

Number of cycles remaining in the triangle wave

Return type:

int

end_marker() QDac2Trigger_Context[source]

Internal trigger that will mark the end of the triangle wave

A new internal trigger is allocated if necessary.

Returns:

trigger that will mark the end

Return type:

QDac2Trigger_Context

period_end_marker() QDac2Trigger_Context[source]

Internal trigger that will mark the end of each period

A new internal trigger is allocated if necessary.

Returns:

trigger that will mark the end of each period

Return type:

QDac2Trigger_Context

period_start_marker() QDac2Trigger_Context[source]

Internal trigger that will mark the beginning of each period

A new internal trigger is allocated if necessary.

Returns:

trigger that will mark the beginning of each period

Return type:

QDac2Trigger_Context

start() None[source]

Start the triangle wave generator

start_marker() QDac2Trigger_Context[source]

Internal trigger that will mark the beginning of the triangle wave

A new internal trigger is allocated if necessary.

Returns:

trigger that will mark the beginning

Return type:

QDac2Trigger_Context

start_on(trigger: QDac2Trigger_Context) None[source]

Attach internal trigger to start the triangle wave generator

Parameters:

trigger (QDac2Trigger_Context) – trigger that will start triangle

start_on_external(trigger: ExternalInput) None[source]

Attach external trigger to start the triangle wave generator

Parameters:

trigger (ExternalInput) – external trigger that will start triangle

start_once_on(trigger: QDac2Trigger_Context) None[source]

Attach internal one-shot trigger to start the triangle wave generator

Parameters:

trigger (QDac2Trigger_Context) – trigger that will start triangle wave

start_once_on_external(trigger: ExternalInput) None[source]

Attach external one-shot trigger to start the triangle wave generator

Parameters:

trigger (ExternalInput) – external trigger that will start triangle wave

class qcodes_contrib_drivers.drivers.QDevil.QDAC2.Virtual_Sweep_Context(arrangement: Arrangement_Context, sweep: ndarray, start_trigger: str | None, step_time_s: float, step_trigger: str | None, repetitions: int | None)[source]

Bases: object

actual_values_V(contact: str) ndarray[source]

The corrected values that would actually be sent to the contact

Parameters:

contact (str) – Name of contact

Returns:

Corrected voltages

Return type:

np.ndarray

close() None[source]
start() None[source]

Start the 2D sweep

qcodes_contrib_drivers.drivers.QDevil.QDAC2.comma_sequence_to_list(sequence: str) Sequence[str][source]
qcodes_contrib_drivers.drivers.QDevil.QDAC2.comma_sequence_to_list_of_floats(sequence: str) Sequence[float][source]
qcodes_contrib_drivers.drivers.QDevil.QDAC2.diff_matrix(initial: Sequence[float], measurements: Sequence[Sequence[float]]) ndarray[source]

Subtract an array of measurements by an initial measurement

qcodes_contrib_drivers.drivers.QDevil.QDAC2.floats_to_comma_separated_list(array: Sequence[float]) str[source]
qcodes_contrib_drivers.drivers.QDevil.QDAC2.forward_and_back(start: float, end: float, steps: int)[source]
qcodes_contrib_drivers.drivers.QDevil.QDAC2.ints_to_comma_separated_list(array: Sequence[int]) str[source]
qcodes_contrib_drivers.drivers.QDevil.QDAC2.split_version_string_into_components(version: str) List[str][source]

qcodes_contrib_drivers.drivers.QDevil.QDAC2_Array module

class qcodes_contrib_drivers.drivers.QDevil.QDAC2_Array.Array_Arrangement_Context(qdacs: QDac2_Array, contacts: Dict[str, Dict[str, int]], output_triggers: Dict[str, Dict[str, int]] | None = None, internal_triggers: Sequence[str] | None = None)[source]

Bases: object

channel(contact: str) QDac2Channel[source]
Parameters:

contact (str) – Name

Returns:

Instrument channel

Return type:

QDac2Channel

currents_A(nplc: int = 1, current_range: str = 'low') Sequence[float][source]

Measure currents on all contacts

The order is that of contacts()

Parameters:
  • nplc (int, optional) – Number of powerline cycles to average over

  • current_range (str, optional) – Current range (default low)

leakage(modulation_V: float, nplc: int = 2) ndarray[source]

Run a simple leakage test between the contacts

Each contact is changed in turn and the resulting change in current from steady-state is recorded. The resulting resistance matrix is calculated as modulation_voltage divided by current_change.

Parameters:
  • modulation_V (float) – Virtual voltage added to each contact

  • nplc (int, Optional) – Powerline cycles to wait for each measurement

Returns:

contact-to-contact resistance in Ohms

Return type:

ndarray

qdac_names() Sequence[str][source]
set_virtual_voltages(contacts_to_voltages: Dict[str, float]) None[source]
virtual_voltage(contact: str) float[source]
Parameters:

contact (str) – Name of contact

Returns:

Voltage before correction

Return type:

float

property contact_names: Sequence[str]

Returns: Sequence[str]: Channel names

class qcodes_contrib_drivers.drivers.QDevil.QDAC2_Array.QDac2_Array(controller: QDac2, listeners: Sequence[QDac2])[source]

Bases: object

A collection of interconnected QDAC-IIs

The instruments are required to be connected as described in section 5.5 ‘Synchronization of multiple QDAC-II units’ in the manual. The sync cables must be left in place after sync, so that the clock is continuously distributed, and the Controller can trigger all Listerners by sending pulses from Ext Out 4 to all Ext In 3 simultaneously.

allocate_trigger() QDac2Trigger_Context[source]

Allocate internal trigger on the Controller

Returns:

context manager

Return type:

QDac2Trigger_Context

arrange(contacts: Dict[str, Dict[str, int]], output_triggers: Dict[str, Dict[str, int]] | None = None, internal_triggers: Sequence[str] | None = None) Array_Arrangement_Context[source]

An arrangement of contacts across several QDAC-II instruments

The arrangement is a collection of QDac2.arrangement, one for each instrument but with a dedicated controller.

See QDac2.arrangement() for further documentation. Note that an array arrangement does not (yet) support corrections between contacts (which the indiviual arrangements on each instrument does).

Parameters:
  • contacts (Dict[str,Dict[str, int]]) – Instrument name to contact-name/channel pairs

  • output_triggers (Dict[str,Dict[str, int]], optional) – Instrument name to name/output-trigger pairs

  • internal_triggers (Sequence[str], optional) – List of names of internal triggers to allocate on the controller

Returns:

context manager

Return type:

Array_Arrangement_Context

connect_external_trigger(port: int, trigger: QDac2Trigger_Context, width_s: float = 1e-06) None[source]

Route internal trigger to external trigger

Parameters:
  • port (int) – External output trigger number

  • trigger (QDac2Trigger_Context) – Internal trigger

  • width_s (float, optional) – Output trigger width in seconds (default 1ms)

sync() None[source]

Synchronizes the array of QDAC-IIs

The Listeners will stop using their own clock and start using the Controller’s clock.

trigger(internal_trigger: QDac2Trigger_Context)[source]

Fire an internal trigger on the Controller

Parameters:

QDac2Trigger_Context – internal trigger

property common_trigger_in: ExternalInput
property controller: str

Returns: str: Name of Controller

property names: FrozenSet[str]

Returns: FrozenSet[str]: Names of all QDAC-IIs in the array

property trigger_out: int

qcodes_contrib_drivers.drivers.QDevil.QSwitch module

class qcodes_contrib_drivers.drivers.QDevil.QSwitch.QSwitch(*args: Any, **kwargs: Any)[source]

Bases: VisaInstrument

__init__(name: str, address: str, **kwargs) None[source]

Connect to a QSwitch

Parameters:
  • name (str) – Name for instrument

  • address (str) – Visa identification string

  • **kwargs – additional argument to the Visa driver

arrange(breakouts: Dict[str, int] | None = None, lines: Dict[str, int] | None = None) None[source]

An arrangement of names for lines and breakouts

Parameters:
  • breakouts (Dict[str, int]) – Name/breakout pairs

  • lines (Dict[str, int]) – Name/line pairs

ask(cmd: str) str[source]

Send SCPI query to instrument

Parameters:

cmd (str) – SCPI query

Returns:

SCPI answer

Return type:

str

breakout(line: str, tap: str) None[source]
clear_read_queue() Sequence[str][source]

Flush the VISA message queue of the instrument

Takes at least _message_flush_timeout_ms to carry out.

Returns:

Messages lingering in queue

Return type:

Sequence[str]

close_relay(line: int, tap: int) None[source]
close_relays(relays: Sequence[Tuple[int, int]]) None[source]
connect(lines: str | Sequence[str]) None[source]
error() str[source]

Retrieve next error

Returns:

The next error or ‘0, “No error”’

Return type:

str

errors() str[source]

Retrieve and clear all previous errors

Returns:

Comma separated list of errors or ‘0, “No error”’

Return type:

str

get_recorded_scpi_commands() List[str][source]
Returns:

SCPI commands sent to the instrument

Return type:

Sequence[str]

ground(lines: str | Sequence[str]) None[source]
open_relay(line: int, tap: int) None[source]
open_relays(relays: Sequence[Tuple[int, int]]) None[source]
reset() None[source]
start_recording_scpi() None[source]

Record all SCPI commands sent to the instrument

Any previous recordings are removed. To inspect the SCPI commands sent to the instrument, call get_recorded_scpi_commands().

state_force_update() None[source]
write(cmd: str) None[source]

Send SCPI command to instrument

Parameters:

cmd (str) – SCPI command

OneOrMore

alias of str | Sequence[str]

qcodes_contrib_drivers.drivers.QDevil.QSwitch.channel_list_to_state(channel_list: str) Sequence[Tuple[int, int]][source]
qcodes_contrib_drivers.drivers.QDevil.QSwitch.compress_channel_list(channel_list: str) str[source]
qcodes_contrib_drivers.drivers.QDevil.QSwitch.expand_channel_list(channel_list: str) str[source]
qcodes_contrib_drivers.drivers.QDevil.QSwitch.state_to_compressed_list(state: Sequence[Tuple[int, int]]) str[source]
qcodes_contrib_drivers.drivers.QDevil.QSwitch.state_to_expanded_list(state: Sequence[Tuple[int, int]]) str[source]

Module contents