Skip to navigation

stanza.base.channels

Module Contents

Classes

NameDescription
ChannelConfigConfiguration for an instrument channel.
ParameterInstrument parameter with validation and metadata.
ValidatorsCommon validators for instrument parameters.
InstrumentChannelBase class for instrument channels with parameter management.
ControlChannelStandard control channel implementation with voltage parameter.
MeasurementChannelStandard measurement channel implementation with measurement parameters.

API

class stanza.base.channels.ChannelConfig

Configuration for an instrument channel.

Attributes: name: Unique channel string identifier, used to reference the gate or contact on the device voltage_range: Min and max voltage limits (V) control_channel: Physical control channel number measure_channel: Physical measurement channel number output_mode: Output mode (dc, ac, etc.) enabled: Whether channel is enabled unit: Channel units metadata: Additional channel metadata

name: str

Value: None

voltage_range: tuple[float | None, float | None]

Value: None

pad_type: stanza.models.PadType

Value: None

electrode_type: stanza.models.GateType | stanza.models.ContactType | stanza.models.GPIOType

Value: None

control_channel: int | None

Value: None

measure_channel: int | None

Value: None

breakout_channel: int | None

Value: None

output_mode: str

Value: dc

enabled: bool

Value: True

unit: str

Value: V

metadata: dict[str, typing.Any] | None

Value: None

__post_init__() -> None
class stanza.base.channels.Parameter

Instrument parameter with validation and metadata.

Attributes: name: Parameter name value: Current parameter value unit: Parameter unit validator: Value validation function getter: Value getter function setter: Value setter function metadata: Additional parameter metadata

name: str

Value: None

value: typing.Any

Value: None

unit: str

Value: “

validator: collections.abc.Callable[[typing.Any], bool] | None

Value: None

getter: collections.abc.Callable[[], typing.Any] | None

Value: None

setter: collections.abc.Callable[[typing.Any], None] | None

Value: None

metadata: dict[str, typing.Any] | None

Value: None

__post_init__() -> None
validate(value: typing.Any) -> bool

Validate parameter value.

set(value: typing.Any) -> None

Set parameter value with validation.

get() -> typing.Any

Get parameter value.

class stanza.base.channels.Validators

Common validators for instrument parameters.

range_validator(
min_val: float, max_val: float
) -> collections.abc.Callable[[float], bool]

Create a range validator.

Parameters:

min_val
float

Minimum allowed value

max_val
float

Maximum allowed value

Returns:

Validator function that checks if value is within range

positive_validator(value: float) -> bool

Validate that value is positive.

negative_validator(value: float) -> bool

Validate that value is negative.

non_zero_validator(value: float) -> bool

Validate that value is non-zero.

class stanza.base.channels.InstrumentChannel(config: stanza.base.channels.ChannelConfig)

Bases: abc.ABC

Base class for instrument channels with parameter management.

Attributes: name: Unique channel string identifier channel_id: Physical channel identifier config: Channel configuration parameters: Dictionary of channel parameters

Initialization

Initialize instrument channel.

__str__() -> str

Return a string representation of the channel.

channel_info: dict[str, typing.Any]

Return a dictionary of channel information.

_setup_parameters() -> None

Setup channel-specific parameters.

Must be implemented by subclasses to define their specific parameters.

add_parameter(param: stanza.base.channels.Parameter) -> None

Add a parameter to this channel.

get_parameter(name: str) -> stanza.base.channels.Parameter

Get parameter by name.

set_parameter(
name: str, value: typing.Any
) -> None

Set parameter value.

get_parameter_value(name: str) -> typing.Any

Get parameter value.

class stanza.base.channels.ControlChannel(config: stanza.base.channels.ChannelConfig)

Bases: stanza.base.channels.InstrumentChannel

Standard control channel implementation with voltage parameter.

Provides voltage control functionality with range validation based on the channel configuration.

Initialization

Initialize instrument channel.

_setup_parameters() -> None

Setup voltage parameter with range validation.

class stanza.base.channels.MeasurementChannel(config: stanza.base.channels.ChannelConfig)

Bases: stanza.base.channels.InstrumentChannel

Standard measurement channel implementation with measurement parameters.

Provides current measurement functionality with conversion factor support for ADC-based measurements.

Initialization

Initialize instrument channel.

_setup_parameters() -> None

Setup measurement parameters with validation.