Skip to content

PatrickADz/keysight-n1914a-python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

n1914a-python

Python driver and CLI for the Keysight N1914A RF power meter, used for RF power measurement in radio astronomy receiver systems.

License Python

Features

  • Full driver for the Keysight N1914A power meter over TCP/IP (VISA).
  • Sensor zeroing, reference calibration factor, and channel offset support.
  • Configurable measurement rate (NORM/FAST/DOUB) and auto-filtering.
  • Layered configuration: CLI arguments -> config.ini -> built-in defaults.
  • Interactive shell for bench use (n1914a-cli shell) - avoids VISA reconnection overhead between commands.
  • Context manager support (with N1914A(...) as pm:).
  • Mock-based test suite - no hardware required to run tests.

Installation

git clone https://github.com/PatrickADz/n1914a-python.git
cd n1914a-python
pip install -e .

# Optional: for the live-plotting example
pip install -e ".[plot]"

A VISA backend is required (NI-VISA, or the pure-Python pyvisa-py, installable with pip install pyvisa-py).

Quick Start

from n1914a import N1914A

with N1914A("TCPIP::192.168.0.4::INSTR") as pm:
    pm.set_unit("DBM")
    pm.zero()  # remove RF power from the sensor first
    print(pm.get_power())

Or via the CLI:

n1914a-cli --address TCPIP::192.168.0.4::INSTR read
n1914a-cli --address TCPIP::192.168.0.4::INSTR shell

Copy config.example.ini to config.ini to avoid passing --address every time (real config.ini files are git-ignored).

Repository Structure

n1914a/
  __init__.py      - public package API
  driver.py         - N1914A driver class
  config.py         - layered configuration loader
  cli.py            - CLI + interactive shell
  exceptions.py     - custom exception hierarchy
tests/
  test_driver.py     - mock-based test suite
examples/
  basic_read.py       - connect, zero, single reading
  continuous_plot.py  - live matplotlib plot of power readings
config.example.ini
pyproject.toml
LICENSE

Tests

pip install -e ".[dev]"
pytest

All tests run against a FakeInstrument/FakeResourceManager pair - no physical power meter is required.

Context / Notes

Developed for RF power measurement.

License

MIT - see LICENSE.

About

Python driver and CLI for Keysight N1914a power meter.

Topics

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages