stanza.device

Module Contents

Classes

NameDescription
DeviceInterface for controlling quantum devices through voltage sweeps and current measurements.

API

1class stanza.device.Device(name: str, device_config: stanza.models.DeviceConfig, channel_configs: dict[str, stanza.base.channels.ChannelConfig], control_instrument: typing.Any | None, measurement_instrument: typing.Any | None)

Interface for controlling quantum devices through voltage sweeps and current measurements.

The Device class provides a high-level abstraction for interacting with quantum devices by coordinating between control instruments (for setting voltages) and measurement instruments (for reading currents). It supports various sweep patterns (1D, 2D, N-dimensional) and manages the mapping between logical pad names and physical instrument channels.

The class distinguishes between different pad types (gates vs contacts) and electrode types (e.g., BARRIER, PLUNGER for gates; SOURCE, DRAIN for contacts), providing convenient properties and methods for filtering and accessing specific electrodes based on their characteristics.

1gates: list[str]

List of all gate pad names in the device.

1contacts: list[str]

List of all contact pad names in the device.

1control_gates: list[str]

List of gate pads that have a control channel configured.

1control_contacts: list[str]

List of contact pads that have a control channel configured.

1measurement_gates: list[str]

List of gate pads that have a measurement channel configured.

1measurement_contacts: list[str]

List of contact pads that have a measurement channel configured.

1get_gates_by_type(gate_type: str | stanza.models.GateType) -> list[str]

Get the gate electrodes of a given type.

Filters all gate channels in the device to return only those matching the specified gate type (e.g., BARRIER, PLUNGER, SCREENING).

Parameters:

gate_type
str | stanza.models.GateType

The type of gate electrodes to retrieve. Can be provided

Returns:

List of gate electrode names matching the specified type. Returns an empty list if no gates of the specified type are found.

1get_contacts_by_type(contact_type: str | stanza.models.ContactType) -> list[str]

Get the contact electrodes of a given type.

Filters all contact channels in the device to return only those matching the specified contact type (e.g., SOURCE, DRAIN, RESERVOIR).

Parameters:

contact_type
str | stanza.models.ContactType

The type of contact electrodes to retrieve. Can be

Returns:

List of contact electrode names matching the specified type. Returns an empty list if no contacts of the specified type are found.

1is_configured() -> bool

Check if both instruments are configured.

Verifies that the device has both a control instrument (for setting voltages) and a measurement instrument (for reading currents) properly configured and available for use.

Returns:

True if both control_instrument and measurement_instrument are not None, False otherwise.

1_jump(
2 voltage: float,
3 pad: str,
4 wait_for_settling: bool) -> None

Set the voltage of a single gate

1jump(
2 pad_voltages: dict[str, float], wait_for_settling: bool) -> None

Set the voltages of the device.

Parameters:

pad_voltages
dict[str, float]

A dictionary of pads and their voltages.

wait_for_settling
boolDefaults to False

Whether to wait for the device to settle after setting the voltages.

Raises:

DeviceError: If the control instrument is not configured.

1_measure(pad: str) -> float

Measure the current of a single gate

1measure(pad: str | list[str]) -> float | list[float]

Measure the current of the device.

Performs current measurement on one or more pads using the measurement instrument. For multiple pads, attempts to use the instrument’s batch measurement capability if available, otherwise measures sequentially.

Parameters:

pad
str | list[str]

Either a single pad name or a list of pad names to measure.

Returns:

If a single pad name is provided, returns a single float current value. If a list of pad names is provided, returns a list of float current values corresponding to each pad in the input list.

Raises:

DeviceError: If the measurement instrument is not configured, if a specified pad is not found in channel configs, or if a pad has no measure channel configured.

1_check(pad: str) -> float

Check the current voltage of a single gate electrode.

1check(pad: str | list[str]) -> float | list[float]

Check the current voltage of the device.

Reads the current voltage setting from one or more pads using the control instrument. This returns the voltage that the control instrument believes it has set, not a measured value from the device itself.

Parameters:

pad
str | list[str]

Either a single pad name or a list of pad names to check.

Returns:

If a single pad name is provided, returns a single float voltage value. If a list of pad names is provided, returns a list of float voltage values corresponding to each pad in the input list.

Raises:

DeviceError: If the control instrument is not configured, if a specified pad is not found in channel configs, or if a pad has no control channel configured.

1sweep_1d(
2 gate_electrode: str,
3 voltages: list[float],
4 measure_electrode: str,
5 session: stanza.logger.session.LoggerSession | None = None
6) -> tuple[list[float], list[float]]

Sweep a single gate electrode and measure the current of a single contact electrode.

Performs a 1D voltage sweep by stepping through a list of voltages on a specified gate electrode while measuring the current through a contact electrode at each step. Optionally logs the sweep data to a session.

Parameters:

gate_electrode
str

Name of the gate electrode to sweep

voltages
list[float]

List of voltage values to apply to the gate electrode

measure_electrode
str

Name of the contact electrode to measure current from

session
stanza.logger.session.LoggerSession | None

Optional LoggerSession to log the sweep data. If provided,

Returns:

Tuple of (voltage_measurements, current_measurements) where:

  • voltage_measurements: List of actual voltages read from the gate
  • current_measurements: List of measured current values at each voltage
1sweep_2d(
2 gate_1: str,
3 voltages_1: list[float],
4 gate_2: str,
5 voltages_2: list[float],
6 measure_electrode: str,
7 session: stanza.logger.session.LoggerSession | None = None
8) -> tuple[list[list[float]], list[float]]

Sweep two gate electrodes and measure the current of a single contact electrode.

Performs a 2D voltage sweep by iterating through all combinations of voltages on two gate electrodes while measuring current through a contact electrode. The sweep iterates through gate_1 voltages in the outer loop and gate_2 voltages in the inner loop.

Parameters:

gate_1
str

Name of the first gate electrode to sweep

voltages_1
list[float]

List of voltage values for the first gate electrode

gate_2
str

Name of the second gate electrode to sweep

voltages_2
list[float]

List of voltage values for the second gate electrode

measure_electrode
str

Name of the contact electrode to measure current from

session
stanza.logger.session.LoggerSession | None

Optional LoggerSession to log the sweep data. If provided,

Returns:

Tuple of (voltage_measurements, current_measurements) where:

  • voltage_measurements: List of [gate_1_voltage, gate_2_voltage] pairs
  • current_measurements: List of measured current values at each voltage pair
1sweep_all(
2 voltages: list[float],
3 measure_electrode: str,
4 session: stanza.logger.session.LoggerSession | None = None
5) -> tuple[list[list[float]], list[float]]

Sweep all gate electrodes and measure the current of a single contact electrode.

Performs a voltage sweep by setting all control gates to the same voltage at each step, while measuring current through a contact electrode. This is useful for characterizing device response to overall gate bias.

Parameters:

voltages
list[float]

List of voltage values to apply to all control gates simultaneously

measure_electrode
str

Name of the contact electrode to measure current from

session
stanza.logger.session.LoggerSession | None

Optional LoggerSession to log the sweep data. If provided,

Returns:

Tuple of (voltage_measurements, current_measurements) where:

  • voltage_measurements: List of lists, each containing voltage values for all control gates at that sweep step
  • current_measurements: List of measured current values at each voltage
1sweep_nd(
2 gate_electrodes: list[str],
3 voltages: list[list[float]],
4 measure_electrode: str,
5 session: stanza.logger.session.LoggerSession | None = None
6) -> tuple[list[list[float]], list[float]]

Sweep multiple gate electrodes and measure the current of a single contact electrode.

Performs an N-dimensional voltage sweep where each specified gate can have a different voltage at each sweep step. This provides maximum flexibility for arbitrary multi-gate sweeps and trajectories through voltage space.

Parameters:

gate_electrodes
list[str]

List of gate electrode names to sweep

voltages
list[list[float]]

List of voltage lists, where each inner list contains the

measure_electrode
str

Name of the contact electrode to measure current from

session
stanza.logger.session.LoggerSession | None

Optional LoggerSession to log the sweep data. If provided,

Returns:

Tuple of (voltage_measurements, current_measurements) where:

  • voltage_measurements: List of lists, each containing the actual voltage values read from each gate at that sweep step
  • current_measurements: List of measured current values at each voltage combination
1zero(type: str | stanza.models.PadType = PadType.ALL) -> None

Set all controllable gates and/or controllable contacts to 0V.

Safely brings specified electrodes to ground voltage (0V) with settling time and verification. This is typically used for device initialization or safe shutdown.

Parameters:

type
str | stanza.models.PadTypeDefaults to PadType.ALL

Specifies which pads to zero. Options are:

Raises:

DeviceError: If an invalid pad type is provided, or if any pad fails to reach 0V within tolerance (1e-6V) after the operation.