> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.conductorquantum.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.conductorquantum.com/_mcp/server.

# stanza.drivers.qswitch



## Module Contents

### Classes

| Name | Description |
|------|-------------|
| [`QSwitchChannel`](#stanzadriversqswitchqswitchchannel) | QSwitch channel for setting and getting the state of the lines and relays. |
| [`QSwitch`](#stanzadriversqswitchqswitch) | None |

### Data

`logger`

### API

```python
stanza.drivers.qswitch.logger
```

**Value**: `getLogger(...)`


```python
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.

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

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


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

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


```python
_get_connect() -> list[int]
```

Get the connection state of all relays on this channel.


```python
_set_connect(relay: int | str) -> None
```

Connect the specified relay or relays on this channel.


```python
_get_disconnect() -> list[int]
```

Get the disconnection state of all relays on this channel.


```python
_set_disconnect(relay: int | str) -> None
```

Disconnect the specified relay or relays on this channel.


```python
_setup_parameters() -> None
```

Initialize and add connect_relay and disconnect_relay parameters to this channel.


```python
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`

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

Create and add QSwitchChannel instances for all configured breakout channels.


```python
_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.


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

Check if breakout box channel(s) are grounded.


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

Set breakout box channel(s) to grounded.


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

Check if breakout box channel(s) are ungrounded.


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

Set breakout box channel(s) to ungrounded.


```python
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.


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

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


```python
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.


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

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


```python
close() -> None
```

Close the QSwitch driver.