Skip to content

zuwasi/keysight-ena-e5063a-python-automation

Repository files navigation

Keysight E5063A ENA Network Analyzer — Qt6 Python Control Suite

Python 3.10+ Qt6 PyVISA License: MIT

A modern, cross-platform Python/Qt6 control suite that replaces 19 legacy Excel VBA/ActiveX macros with 14 standalone GUI applications for the Keysight E5063A ENA Series Network Analyzer.

All instrument communication uses PyVISA over GPIB, LAN (TCPIP), or USB (USBTMC) with standard SCPI commands.


🖥️ Screenshot

The suite provides a unified tabbed launcher with all 14 tools:

┌──────────────────────────────────────────────────────┐
│            Main Launcher (main.py)                   │
│          QTabWidget — 14 tool tabs                   │
├──────────┬───────────┬───────────┬───────────────────┤
│ Setup    │ Calibrate │ Data/Test │ File Ops          │
│ 4 apps   │ 3 apps    │ 4 apps    │ 3 apps            │
├──────────┴───────────┴───────────┴───────────────────┤
│   ENAConnection (PyVISA) → GPIB / LAN / USB          │
├──────────────────────────────────────────────────────┤
│      Keysight E5063A ENA Network Analyzer            │
└──────────────────────────────────────────────────────┘

🚀 Quick Start

# Install dependencies
pip install PySide6 pyvisa pyvisa-py

# Run the suite
cd ena_qt6_suite
python main.py

📋 Applications

# App Description Original Source
1 ⚙ Analyzer Setup Multi-channel segment/linear sweep, trace configuration AnalyzerSetup.xlsm
2 📊 Bandwidth Search Automated -3 dB bandwidth measurement Bandwidth_Search.xlsm
3 🔍 Peak Search Marker peak, all-peak, multi-peak (9 markers) Peak_Search.xlsm
4 📌 Marker Tools Interactive marker control — activate, max, min, readout echoMarker.vbs, form.hta, userMenu.vbs
5 🔧 Calibration Full SOLT wizard — Open/Short/Load/Thru guided steps Calibration.xlsm
6 ⚡ ECal Electronic calibration — 1-port and 2-port ECal.xlsm
7 📐 Error Coefficients Read/write calibration error terms with segment table ReadWrite_ErrCoef.xlsm
8 📈 Read/Write Data Trace data transfer — ASCII & IEEE binary, CSV export ReadingWritingData.xlsm, readingData.vbs
9 ✅ Limit Test Pass/fail limit testing with configurable limit tables LimitTest.xlsm
10 ⏱ SRQ Measurement Triggered measurement with status register SRQ wait WaitingForMeasEndSRQ.xlsm
11 ⚠ Error Detection SRQ-based SCPI error detection and reporting Error_Detection_SRQ.xlsm
12 💾 Save Files State/calibration/trace/screen image saving Saving_Files.xlsm
13 📁 Transfer Files Bidirectional PC ↔ Analyzer file transfer Transferring_Files.xlsm
14 📷 Screen Capture Instrument display capture with preview ScreenCapture.xlsm

🔌 Connecting to the Analyzer

The E5063A supports three interfaces. Enter the appropriate VISA resource string in any app's connection bar:

Interface VISA Resource String Notes
GPIB GPIB0::17::INSTR Default address 17, requires GPIB adapter
LAN TCPIP::192.168.1.100::INSTR Configure IP on analyzer front panel
USB USB0::0x0957::0x1309::MY###::INSTR Auto-detected, USBTMC class
from core.visa_connection import ENAConnection

with ENAConnection("GPIB0::17::INSTR") as ena:
    ena.preset()
    print(ena.query("*IDN?"))
    data = ena.query_values(":CALC1:DATA:FDAT?")

See DEVELOPER_GUIDE.md for complete connection documentation, SCPI reference, and new-app tutorial.

📂 Project Structure

ena_qt6_suite/
├── main.py                     # Unified tabbed launcher
├── requirements.txt            # pip dependencies
├── DEVELOPER_GUIDE.md          # Full developer documentation
├── presentation_part1.html     # Project presentation (slides 1-6)
├── presentation_part2.html     # Project presentation (slides 7-12)
├── core/
│   ├── visa_connection.py      # ENAConnection — PyVISA wrapper
│   ├── base_widget.py          # ENABaseWidget — shared Qt6 connection UI
│   └── scpi_commands.py        # SCPI command constants & formatters
└── apps/
    ├── analyzer_setup.py       # ... through ...
    └── marker_tools.py         # 14 application modules

🔄 What Was Modernized

Legacy (Before) Modern (After)
Excel VBA macros (.xlsm) Python 3.10+ modules
ActiveX/COM (VisaComLib) PyVISA (pyvisa-py)
Windows-only Cross-platform (Win/Linux/macOS)
Excel UserForms + CommandButtons PySide6 (Qt6) widgets
SICL DLL (32-bit) VISA resource strings over TCPIP
No version control Git-managed source code
Hard-coded GPIB addresses Configurable connection UI

🤖 Amp's Role in This Modernization

This entire project was architected, coded, and documented by Amp — Sourcegraph's AI coding agent.

What Amp Did

  1. Reverse-Engineered the Legacy Code — Amp extracted VBA macros from all 15 Excel .xlsm workbooks using oletools, read the 4 VBScript/HTA files, and analyzed the 400+ page E5063A operation manual PDF to understand the SCPI command protocol, VISA connection interfaces, and measurement workflows.

  2. Designed the Architecture — Amp designed a clean 3-layer architecture:

    • Core layer (visa_connection.py, base_widget.py, scpi_commands.py) — shared VISA connection management, Qt6 base widget with connection UI, and typed SCPI command constants
    • Application layer (14 independent app modules) — each converting one or more original macros into a standalone Qt6 GUI widget
    • Launcher (main.py) — unified tabbed interface bringing all tools together
  3. Converted All 19 Source Files — Every Excel VBA macro, VBScript, and HTA file was faithfully converted to Python/Qt6, preserving the original SCPI command sequences, calibration workflows, data transfer modes (ASCII and IEEE 488.2 binary), SRQ status register handling, and user interaction patterns (guided calibration dialogs, pass/fail indicators, data tables).

  4. Mapped Legacy APIs to Modern Equivalents — Amp translated the entire COM/ActiveX automation stack:

    • VisaComLib.ResourceManagerpyvisa.ResourceManager()
    • VisaComLib.FormattedIO488 → PyVISA resource with write()/query()
    • SICL iopen("lan[IP]:hpib9,17")"TCPIP::IP::hpib9,17::INSTR"
    • E5070.Application COM object → direct SCPI commands over VISA
    • Excel Cells(row,col)QTableWidget / QLineEdit
    • VBA UserForm + CommandButtonQWidget + QPushButton
  5. Created Documentation — Amp wrote the comprehensive Developer Guide (focusing on device connection details for future development) and a 12-slide HTML presentation covering the project background, architecture, conversion mapping, and achievements.

Why Amp Was Effective Here

This project required simultaneously understanding RF test & measurement instrumentation (SCPI protocol, S-parameters, calibration standards, network analyzer operation), legacy Windows COM/ActiveX automation (VisaComLib, SICL DLL, VBA macro extraction), and modern Python GUI development (PySide6, PyVISA, cross-platform design). Amp handled all three domains in a single session, producing 20 Python source files, 2 HTML presentations, and 1 developer guide — a complete, working migration from a deprecated platform to a modern one.


📄 License

MIT License — see LICENSE for details.

🔗 References

About

Qt6/Python control suite for the Keysight E5063A ENA Network Analyzer. Converts 19 legacy Excel VBA/ActiveX macros to 14 cross-platform GUI apps — measurement setup, │ SOLT/ECal calibration, trace data, limit testing, peak search, file transfer & screen capture via PyVISA (GPIB/LAN/USB) SCPI.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors