Net class is the primary abstraction for interacting with hardware instruments. It provides a unified interface for controlling different types of hardware including power supplies, oscilloscopes, GPIO, ADC, DAC, and more.
Import
Class Methods
| Method | Description |
|---|---|
Net.get() | Create a Net instance for the specified net name and type |
Net.list_saved() | List all nets configured on the Lager Box |
Net.list_all_from_env() | List nets from environment (legacy) |
Net.get_local_nets() | Get all local net configurations |
Net.save_local_nets() | Save multiple net configurations |
Net.save_local_net() | Save a single net configuration |
Net.delete_local_net() | Delete a net configuration |
Net.delete_all_local_nets() | Delete all net configurations |
Net.rename_local_net() | Rename a net configuration |
Net.filter_nets() | Filter nets by name and/or role |
Instance Methods
| Method | Description |
|---|---|
enable() | Enable the net and connect to hardware |
disable() | Disable the net and disconnect from hardware |
Method Reference
Net.get(name, type, *, setup_function=None, teardown_function=None)
Create a Net instance for the specified net name and type.
| Parameter | Type | Description |
|---|---|---|
name | str | Name of the net to create |
type | NetType | Type of net (e.g., NetType.PowerSupply, NetType.GPIO) |
setup_function | callable | Optional function called when net is enabled |
teardown_function | callable | Optional function called when net is disabled |
Net.list_saved()
List all nets configured on the Lager Box.
list[dict] - List of net configurations with keys:
name(str) - Net namerole(str) - Net type/rolepin(int) - Hardware pin/channel numberinstrument(str) - Associated instrument type
Net.list_all_from_env()
List nets from the LAGER_MUXES environment variable (legacy behavior).
list[dict] - List of net information
Net.save_local_net(data)
Save a net configuration to the Lager Box.
| Parameter | Type | Description |
|---|---|---|
data | dict | Net configuration dictionary |
Net.delete_local_net(name, role=None)
Delete a net configuration from the Lager Box.
| Parameter | Type | Description |
|---|---|---|
name | str | Name of net to delete |
role | str | Optional role to match |
bool - True if net was deleted
Net.rename_local_net(old_name, new_name)
Rename a net configuration.
| Parameter | Type | Description |
|---|---|---|
old_name | str | Current net name |
new_name | str | New net name |
bool - True if net was renamed
Net.get_local_nets()
Get all local net configurations.
list[dict] - List of net configuration dictionaries
Net.save_local_nets(nets)
Save multiple net configurations at once.
| Parameter | Type | Description |
|---|---|---|
nets | list[dict] | List of net configuration dictionaries |
Net.delete_all_local_nets()
Delete all net configurations from the Lager Box.
bool - True if nets were deleted
Net.filter_nets(all_nets, name, role=None)
Filter a list of nets by name and optionally by role.
| Parameter | Type | Description |
|---|---|---|
all_nets | list[dict] | List of nets to search |
name | str | Net name to match |
role | str | Optional role to match |
list[dict] - Matching nets
enable()
Enable the net and connect to hardware.
- Analog: Connects to multiplexer and enables oscilloscope channel
- Logic: Enables logic analyzer channel
- Battery: Enables battery simulation output
- PowerSupply: Enables power supply output
- ELoad: Enables electronic load
disable(teardown=True)
Disable the net and disconnect from hardware.
| Parameter | Type | Default | Description |
|---|---|---|---|
teardown | bool | True | Whether to call teardown function |
NetType Enum
Available net types:| NetType | Role String | Description |
|---|---|---|
NetType.Analog | analog | Oscilloscope analog input |
NetType.Logic | logic | Logic analyzer input |
NetType.Waveform | waveform | Waveform generator |
NetType.Battery | battery | Battery simulator |
NetType.PowerSupply | power-supply | Power supply |
NetType.ELoad | eload | Electronic load |
NetType.GPIO | gpio | Digital I/O |
NetType.ADC | adc | Analog-to-digital converter |
NetType.DAC | dac | Digital-to-analog converter |
NetType.Thermocouple | thermocouple | Temperature sensor |
NetType.WattMeter | watt-meter | Power meter |
NetType.UART | uart | Serial communication |
NetType.Debug | debug | Debug probe |
NetType.Arm | arm | Robotic arm |
NetType.Usb | usb | USB device |
NetType.Rotation | rotation | Rotary encoder |
NetType.Wifi | wifi | WiFi module |
NetType.Actuate | actuate | Actuator control |
NetType.PowerSupply2Q | power-supply-2q | Two-quadrant power supply (solar simulation) |
Properties
name
Get the net name.
type
Get the net type.
Examples
List and Use Nets
Simple Nets (GPIO, ADC, DAC)
Complex Nets (Power, Scope)
Manage Net Configuration
Notes
- Simple nets (GPIO, ADC, DAC, Thermocouple) work directly without
enable()/disable()calls - Complex nets (Analog, Logic, PowerSupply, Battery, ELoad) require
enable()before use - Always call
disable()when finished with complex nets to properly release hardware - Net names must match those configured on the Lager Box
- Use
Net.list_saved()to see all available nets

