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

1class 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

1name: str

Value: None

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

Value: None

1pad_type: stanza.models.PadType

Value: None

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

Value: None

1control_channel: int | None

Value: None

1measure_channel: int | None

Value: None

1output_mode: str

Value: dc

1enabled: bool

Value: True

1unit: str

Value: V

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

Value: None

1__post_init__() -> None
1class 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

1name: str

Value: None

1value: typing.Any

Value: None

1unit: str

Value: “

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

Value: None

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

Value: None

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

Value: None

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

Value: None

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

Validate parameter value.

1set(value: typing.Any) -> None

Set parameter value with validation.

1get() -> typing.Any

Get parameter value.

1class stanza.base.channels.Validators

Common validators for instrument parameters.

1range_validator(
2 min_val: float, max_val: float
3) -> 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

1positive_validator(value: float) -> bool

Validate that value is positive.

1negative_validator(value: float) -> bool

Validate that value is negative.

1non_zero_validator(value: float) -> bool

Validate that value is non-zero.

1class 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.

1__str__() -> str

Return a string representation of the channel.

1channel_info: dict[str, typing.Any]

Return a dictionary of channel information.

1_setup_parameters() -> None

Setup channel-specific parameters.

Must be implemented by subclasses to define their specific parameters.

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

Add a parameter to this channel.

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

Get parameter by name.

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

Set parameter value.

1get_parameter_value(name: str) -> typing.Any

Get parameter value.

1class 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.

1_setup_parameters() -> None

Setup voltage parameter with range validation.

1class 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.

1_setup_parameters() -> None

Setup measurement parameters with validation.