Skip to main content

rfproto

CI Pipeline PyPI - Version PyPI - License Code style: black

Python library for RF and SDR prototyping. Provides reusable methods for RF measurements, communication systems, radar, antenna arrays, and related signal processing tasks. The library supports both floating-point and fixed-point arithmetic for modeling hardware implementations (FPGA/ASIC).

Features & Modules

The library is organized into focused modules for different aspects of RF/SDR signal processing:

Core Signal Processing

  • nco.py: Numerically Controlled Oscillator (NCO) with both floating-point and fixed-point support, including frequency-to-FCW conversion and Taylor series approximations for sine/cosine generation
  • filter.py: Filter design including Raised Cosine, Root Raised Cosine, and polyphase filtering
  • multirate.py: Multirate signal processing (interpolation, decimation, rational resampling with polyphase filters)
  • sig_gen.py: Signal generation utilities for test waveforms and modulated signals
  • modulation.py: Modulation/demodulation schemes for digital communications

Measurements & Analysis

  • measurements.py: Signal quality metrics (EVM, PSD, SFDR, SNR, and spectral analysis)
  • plot.py: Visualization utilities (time-domain, frequency-domain, constellation diagrams, eye diagrams)
  • impairments.py: Channel impairment modeling (noise, phase offset, timing errors)

Fixed-Point Arithmetic

  • fxp_int.py: Fixed-point integer class modeling hardware bit-width constraints with overflow/wrapping behavior
  • utils.py: Fixed-point/floating-point conversion, binary representation, rounding methods, and dB/magnitude conversions

Control & Processing

  • agc_magest.py: Automatic Gain Control (AGC) using magnitude estimation
  • pi_filter.py: Proportional-Integral filter implementations
  • signal.py: Basic signal operations and transformations
  • frequency.py: Frequency-related utilities and conversions

Architecture

Fixed-Point Arithmetic Support

A key feature of rfproto is dual floating-point and fixed-point implementations for hardware prototyping:

  1. fxp_int class: Models fixed bit-width integers with 2's complement overflow/wrapping behavior
  2. Conversion utilities: dbl_to_fxp() / fxp_to_dbl() for converting between representations
  3. Rounding operations: fxp_round_halfup() / fxp_truncate() for proper fixed-point arithmetic
  4. Q-format notation: Uses standard Q-format (e.g., Q0.15 for 16-bit signed with 15 fractional bits)
  5. Switchable implementations: Some modules like nco.py have use_fxp flags to toggle between floating-point and fixed-point

Design Patterns

  • Normalized filters: Filter functions return normalized coefficients (sum to 1.0 for unity passband gain)
  • Rational resampling: Use multirate.get_rational_resampling_factors() for optimal interpolation/decimation ratios
  • Type hints: All functions include type hints for parameters and return values
  • Doctests: Inline documentation examples that serve as both docs and tests

Developing

Building & CI

  • Install editable local version (preferably within a venv) with all optional packages for testing with $ pip install --upgrade -e .[docs,test] (add --user if not in venv).
  • Install pre-commit checks with $ ln -sf ../../scripts/pre-commit ./.git/hooks/pre-commit
  • Trigger GitHub action to publish to PyPI with a tagged commit (e.x. git tag -am "test auto versioning" 0.0.2) on main branch. Note versioning is also inferred from the git tag value, and this will only run on push on tag.

Testing

Run test suite with $ ./scripts/run-tests.sh

Additional testing options:

# Run tests with plots displayed (default suppresses plots)
./scripts/run-tests.sh --show_plots

# Run specific test file
pytest tests/test_filter.py

# Run with coverage report
pytest --doctest-modules --cov-report=term-missing:skip-covered --cov=rfproto/ tests/

# Run mypy static type checking
mypy rfproto/

The test suite includes:

  • pytest with doctest support for inline documentation examples
  • Tests in both tests/ directory and doctests embedded in module docstrings
  • Coverage reporting via pytest-cov
  • Full mypy type checking (enforced in CI)
  • Pre-commit hook that runs full test suite and auto-generates TODO.md

Documentation

Documentation uses mkdocs-material, preview with $ mkdocs serve -a localhost:8888. Publishes with GitHub action as well.

Code Formatting

The project uses black for code formatting. The pre-commit hook automatically runs the full test suite (including formatting checks) before commits are allowed.

TODO

See auto-generated TODO.md.

Metadata

Release files for rfproto 0.0.21

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for rfproto 0.0.21
File Size Uploaded Provenance Actions
rfproto-0.0.21.tar.gz 33.2 kB With provenance Details for rfproto-0.0.21.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for rfproto 0.0.21
File Interpreter ABI Platform Actions
rfproto-0.0.21-py3-none-any.whl Python 3 none any Details for rfproto-0.0.21-py3-none-any.whl

Total release size: 66.8 kB

Release files / rfproto-0.0.21.tar.gz

Download URL rfproto-0.0.21.tar.gz
Size 33.2 kB
Tags Source
SHA-256 checksum
How to use checksums
380261451018d6c4574aef05ed57c7554b710ab87b97f92c1a687b50e3cae610
BLAKE2b-256 checksum
How to use checksums
122f1c70d1559009e2d30f75a577a550b27b41c81281876582b7de3b15ffaf0c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 15, 2026.

Transparency log

Release files / rfproto-0.0.21-py3-none-any.whl

Download URL rfproto-0.0.21-py3-none-any.whl
Size 33.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1ca3dd3178b1960a099e9f8c9dd76c89eb5f129a637f270badde678dbecad1dc
BLAKE2b-256 checksum
How to use checksums
3a02e301e824f1342163ace15678eea00c42970e219713885eaa4e1e7366cacd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 15, 2026.

Transparency log

Security for rfproto 0.0.21

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for rfproto-0.0.21.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 15, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page