> 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.base.mixins



## Module Contents

### Classes

| Name | Description |
|------|-------------|
| [`InstrumentChannelMixin`](#stanzabasemixinsinstrumentchannelmixin) | Mixin class that provides the default InstrumentChannel implementation. |
| [`ControlInstrumentMixin`](#stanzabasemixinscontrolinstrumentmixin) | Mixin class that provides the default ControlInstrument implementation using channel parameters. |
| [`MeasurementInstrumentMixin`](#stanzabasemixinsmeasurementinstrumentmixin) | Mixin class that provides default MeasurementInstrument implementations. |

### API

```python
class stanza.base.mixins.InstrumentChannelMixin
```

Mixin class that provides the default InstrumentChannel implementation.

```python
add_channel(
    channel_name_or_channel: str | stanza.base.channels.InstrumentChannel | None,
    channel: stanza.base.channels.InstrumentChannel | None = None
) -> None
```

Add a channel to the instrument.

Can be called as:
- add_channel(channel) - uses channel.name as key
- add_channel(channel_name, channel) - uses provided name as key


```python
get_channel(channel_name: str) -> stanza.base.channels.InstrumentChannel
```

Get a channel by name.


```python
remove_channel(channel_name: str) -> None
```

Remove a channel from the instrument.


```python
class stanza.base.mixins.ControlInstrumentMixin
```

**Bases**: `stanza.base.mixins.InstrumentChannelMixin`

Mixin class that provides the default ControlInstrument implementation using channel parameters.

```python
set_voltage(
    channel_name: str, voltage: float
) -> None
```

Set voltage on a specific channel using parameter system.


```python
get_voltage(channel_name: str) -> float
```

Get current voltage on a specific channel using parameter system.


```python
get_slew_rate(channel_name: str) -> float
```

Get current slew rate on a specific channel using parameter system.


```python
set_slew_rate(
    channel_name: str, slew_rate: float
) -> None
```

Set slew rate on a specific channel using parameter system.


```python
class stanza.base.mixins.MeasurementInstrumentMixin
```

**Bases**: `stanza.base.mixins.InstrumentChannelMixin`

Mixin class that provides default MeasurementInstrument implementations.

```python
prepare_measurement_context() -> collections.abc.Generator[None, None, None]
```

Context manager that handles preparation, avoiding nested calls.


```python
prepare_measurement() -> None
```

Optional override in subclasses for actual preparation logic.


```python
teardown_measurement() -> None
```

Optional override in subclasses for actual teardown logic.


```python
measure(channel_name: str) -> float
```

Default measurement that reads the 'current' parameter from the first channel.

Subclasses are expected to expose channels via get_channel(int) and a
'current' Parameter on each channel whose getter performs the measurement.