-
Notifications
You must be signed in to change notification settings - Fork 1
CLI
All scripts run directly with Python and use the active workbench by default. Pass --workbench <name> to any script to override.
Scans USB and LAN for VISA instruments, identifies them, and saves a workbench file.
python core/nachoVisa.py # scan USB + LAN, prompt for name
python core/nachoVisa.py --usb-only # skip LAN scan
python core/nachoVisa.py --host 192.168.1.50 # probe a specific IP
python core/nachoVisa.py --subnet 192.168.1.0/24
python core/nachoVisa.py --save my_lab # save without prompting
python core/nachoVisa.py --set-active my_lab # switch active workbench
python core/nachoVisa.py --fix-udev # write udev rules (Linux)
python core/nachoVisa.py --debug # verbose output--fix-udev creates /etc/udev/rules.d/70-usbtmc.rules so PyVISA-py can access USBTMC instruments without root. Run once, then re-plug USB instruments.
Drives all instruments in the active workbench to a specified state defined in a config JSON file.
GUI equivalent: The Save state / Load state / Reset all bar in the Workbench tab covers the same workflow interactively. Use
setWorkbench.pyfor headless / scripted operation or when the GUI is not running. See Workbench and Instruments#bench-state--save-load-reset.
python core/setWorkbench.py # apply workbench_config.json
python core/setWorkbench.py --set foo.json # apply a specific config file
python core/setWorkbench.py --reset-bench # safe defaults on all instruments--reset-bench zeroes outputs and disables all channels without needing a config file. The state files saved by the GUI (workbench_states/*.json) use a compatible format and can be passed to --set.
Config format:
{
"name": "Lab Ready",
"hosts": ["192.168.1.100"],
"instruments": {
"edu36311a": {
"outputs": [
{ "channel": 1, "voltage": 5.0, "current_limit": 0.5, "enabled": false }
]
},
"edu33211a": {
"channels": [
{ "channel": 1, "function": "SIN", "frequency": 1000,
"amplitude": 1.0, "amplitude_unit": "VPP", "offset": 0.0, "enabled": false }
]
},
"scope": { "reset": true }
}
}"hosts" lists IP addresses of Ethernet instruments (LAN instruments are not auto-discovered by the @py backend).
These run independently without the GUI.
| Script | What it does |
|---|---|
screenshot.py |
Capture a screenshot from the active workbench scope and save as PNG |
acAnalysis.py |
AC frequency sweep: step a generator through frequencies from a CSV, record Vpp on scope CH1/CH2 |
dcSweep.py |
Step one or both PSU channels across a voltage range; log V/I readings at each point |
psuInterrupt.py |
Drive a V1 → interrupt (off or V2) → V3 cycle; sweep interrupt duration and/or voltage across multiple runs |
waveformAnalysis.py |
Live waveform analysis: autoscale, measure freq/Vpp/risetime, save screenshot and CSV |
scripts/cgb-US21x-equipment/ contains instrument-specific examples for the Keysight EDU lab kit (EDU33211A AWG, EDU34450A DMM, EDU36311A PSU) and the Korad KA3005P.
Use workbench.py helpers to find instruments by role:
import pyvisa
from workbench import load_workbench, open_by_role
from eewBackbone import get_command
wb = load_workbench() # active workbench
rm = pyvisa.ResourceManager("@py")
psu = open_by_role(rm, wb, "psu")
# find the family for SCPI dispatch
from eewBackbone import classify
idn = psu.query("*IDN?")
fam = classify(idn)
for action, scpi in get_command(fam, "set_voltage", ch=1, value="5.0"):
if action == "write":
psu.write(scpi)
elif action == "query":
print(psu.query(scpi))This pattern is instrument-agnostic — the same script works on any PSU family that defines set_voltage.