Skip to navigation

stanza.drivers.qswitch

Module Contents

Classes

NameDescription
QSwitchChannelQSwitch channel for setting and getting the state of the lines and relays.
QSwitchNone

Data

logger

API

stanza.drivers.qswitch.logger

Value: getLogger(...)

class stanza.drivers.qswitch.QSwitchChannel(name: str, channel_id: int, config: stanza.base.channels.ChannelConfig, driver: stanza.pyvisa.PyVisaDriver)

Bases: stanza.base.channels.InstrumentChannel

QSwitch channel for setting and getting the state of the lines and relays.

_query_all_relays(command: str) -> list[int]

Query all 10 relays on this channel and return their states as a list of integers.

_set_relay(
command: str, relay: int | str
) -> None

Execute a relay command for a single relay (int) or multiple relays (comma-separated string).

_get_connect() -> list[int]

Get the connection state of all relays on this channel.

_set_connect(relay: int | str) -> None

Connect the specified relay or relays on this channel.

_get_disconnect() -> list[int]

Get the disconnection state of all relays on this channel.

_set_disconnect(relay: int | str) -> None

Disconnect the specified relay or relays on this channel.

_setup_parameters() -> None

Initialize and add connect_relay and disconnect_relay parameters to this channel.

class stanza.drivers.qswitch.QSwitch(instrument_config: stanza.models.ControlInstrumentConfig, channel_configs: dict[str, stanza.base.channels.ChannelConfig], is_simulation: bool = False, sim_file: str | None = None)

Bases: stanza.base.instruments.BaseControlInstrument

_initialize_channels(channel_configs: dict[str, stanza.base.channels.ChannelConfig]) -> None

Create and add QSwitchChannel instances for all configured breakout channels.

_channels_suffix(
channel_names: list[str], tap: int | str
) -> str

Format channel names and tap number into a SCPI command suffix for multi-channel operations.

get_grounded(channel_name: str | list[str]) -> bool | list[bool]

Check if breakout box channel(s) are grounded.

set_grounded(channel_name: str | list[str]) -> None

Set breakout box channel(s) to grounded.

get_ungrounded(channel_name: str | list[str]) -> bool | list[bool]

Check if breakout box channel(s) are ungrounded.

set_ungrounded(channel_name: str | list[str]) -> None

Set breakout box channel(s) to ungrounded.

get_connected(
channel_name: str | list[str], line_number: int
) -> bool | list[bool]

Get if breakout box channel(s) are connected to the line number.

set_connected(
channel_name: str | list[str], line_number: int
) -> None

Set breakout box channel(s) to connected to the line number.

get_disconnected(
channel_name: str | list[str], line_number: int
) -> bool | list[bool]

Get if breakout box channel(s) are disconnected from the line number.

set_disconnected(
channel_name: str | list[str], line_number: int
) -> None

Set breakout box channel(s) to disconnected from the line number.

close() -> None

Close the QSwitch driver.