Enumerations¶
All domain-specific string constants are defined as typed enumerations in
lab_instruments.enums. Every member uses the str, Enum mixin so enum
values compare equal to their raw strings and can be passed directly to SCPI
write calls without extra conversion.
Import them from the top-level package:
WaveformType ¶
Bases: str, Enum
Canonical SCPI waveform identifiers for AWG / function generators.
Members compare equal to their string values so they can be passed
directly to SCPI set_waveform calls::
>>> WaveformType.SIN == "SIN"
True
>>> f"FUNC {WaveformType.SQU}"
'FUNC SQU'
Use :meth:from_alias to resolve user-supplied strings (e.g. "sine",
"square") to the canonical member.
from_alias
classmethod
¶
Resolve a user-supplied waveform string to a :class:WaveformType.
Accepts both canonical names ("SIN") and friendly aliases
("sine", "sin", "square", etc.). Falls back to an
upper-cased lookup so that any future canonical value still works.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
s
|
str
|
User-supplied waveform string (case-insensitive). |
required |
Returns:
| Type | Description |
|---|---|
WaveformType
|
The matching :class: |
Raises:
| Type | Description |
|---|---|
ValueError
|
If s cannot be resolved to a known waveform. |
DMMMode ¶
Bases: str, Enum
Measurement mode identifiers for digital multimeters.
Values match the method-name fragments used by DMM drivers::
>>> getattr(dev, f"measure_{DMMMode.DC_VOLTAGE}") # → dev.measure_dc_voltage
>>> getattr(dev, f"configure_{DMMMode.FREQUENCY}") # → dev.configure_frequency
Use :meth:from_alias to resolve REPL shorthand ("vdc", "vac",
"res", …) to the canonical member.
from_alias
classmethod
¶
Resolve a user-supplied mode string to a :class:DMMMode.
Accepts both REPL shorthand ("vdc", "res") and full internal
names ("dc_voltage", "resistance_2wire").
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
s
|
str
|
User-supplied mode string (case-insensitive). |
required |
Returns:
| Type | Description |
|---|---|
DMMMode
|
The matching :class: |
Raises:
| Type | Description |
|---|---|
ValueError
|
If s cannot be resolved to a known mode. |
CouplingMode ¶
Bases: str, Enum
Input coupling modes for oscilloscope channels.
Example::
dev.set_coupling(1, CouplingMode.DC)
TriggerEdge ¶
Bases: str, Enum
Trigger slope (edge) selection for oscilloscopes.
Example::
dev.set_trigger_edge(TriggerEdge.RISE)
TriggerMode ¶
Bases: str, Enum
Trigger sweep mode for oscilloscopes.
Example::
dev.set_trigger_mode(TriggerMode.AUTO)
SMUSourceMode ¶
Bases: str, Enum
Output source mode for SMU instruments.
Example::
dev.set_source_mode(SMUSourceMode.VOLTAGE)