RF Signal Simulation and Analysis Framework
rf_chain_modeling is a Python framework designed to model, simulate, and analyze Radio Frequency (RF) chains. It allows you to cascade various RF componentsโsuch as amplifiers, filters, cables, and antennasโto predict system performance metrics like Gain, Noise Figure (NF), and non-linearities (OP1dB, IP3, IP2).
- Component Modeling: built-in models for Attenuators, Amplifiers, Cables, Filters (HighPass, BandPass, LowPass), and Antennas.
- Data-Driven Components: Import component characteristics from CSV/TSV data files (e.g., S-parameters or measured gain/NF).
- Signal Processing: Simulation of time-domain and frequency-domain signals with thermal noise injection.
- Performance Assessment:
- Gain & Phase: Frequency response analysis.
- Noise Figure (NF): Cascaded noise analysis.
- Non-Linearities: Automatic assessment of 1dB Compression Point (P1dB) and Intercept Points (IIP3/OIP3, IIP2/OIP2).
git clone https://github.com/dunaar/RF_chain_modeling.git
cd RF_chain_modelingThe project uses pyproject.toml for dependency management. You can install it using modern environment managers like uv (recommended) or standard pip.
Using uv (Recommended):
# 1. Create a virtual environment
uv venv
source .venv/bin/activate # On Linux/macOS
# .venv\Scripts\activate # On Windows
# 2. Sync the project and install the package with dev dependencies
uv sync --extra devUsing standard pip:
# Install the package in editable mode
pip install -e .
# If you want to contribute or run tests, install the dev dependencies:
pip install -e ".[dev]"Required libraries automatically installed: numpy, scipy, matplotlib, tqdm.
The project serves a primary chain example which can be executed directly via the package's main entry point.
Standard execution (module mode via __main__.py):
python3 -m rf_chain_modelingUsing uv:
uv run python -m rf_chain_modeling(Alternatively, you can run the main.py script located at the repository root: uv run python main.py)
The script rf_chain_example.py demonstrates how to create a complete transmission chain combining a signal generator, an antenna, filters, and amplifiers.
Standard execution (module mode):
python3 -m rf_chain_modeling.examples.rf_chain_exampleUsing uv:
uv run python -m rf_chain_modeling.examples.rf_chain_exampleWhat it does:
- Signal Generation: Creates a broad-band signal (40 GHz bandwidth) with thermal noise and three specific tones (at 3, 11, and 17 GHz).
- Chain Definition:
- Antenna: Defines frequency-dependent gain.
- High-Pass Filter: Cutoff at 6 GHz.
- LNA (Low Noise Amplifier): Gain 16 dB, NF 3 dB.
- Attenuator: 5 dB attenuation.
- Power Amplifier: Gain 20 dB, OIP3 40 dBm.
- RF Cable: 10m length with frequency-dependent loss.
- Band-Pass Filter: 9-12 GHz passband.
- Simulation: Processes the signal through the chain and plots the Time Domain and Frequency Spectrum before and after processing.
- Assessment: Automatically characterizes the Gain, Noise Figure, and Intercept points (IP2, IP3) of the entire chain and individual components.
The script rf_modeling_example.py demonstrates the core signal modeling features independently from a full RF chain.
Standard execution (module mode):
python3 -m rf_chain_modeling.examples.rf_modeling_exampleUsing uv:
uv run python -m rf_chain_modeling.examples.rf_modeling_exampleWhat it does:
- Creates a signal over a wide RF bandwidth.
- Adds thermal noise and several tones with different amplitudes and phases.
- Computes RMS-related quantities in time and frequency domains.
- Plots temporal and spectral representations of the signal.
The script rf_subchain_example.py provides an additional example entry point for reusable RF subchain workflows.
Standard execution (module mode):
python3 -m rf_chain_modeling.examples.rf_subchain_exampleUsing uv:
uv run python -m rf_chain_modeling.examples.rf_subchain_exampleThe script rf_components/zvq_183_s_plus.py shows how to model a specific commercial component (Mini-Circuits ZVQ-183-S+ amplifier) using measured data packaged within the module.
Standard execution (module mode):
python3 -m rf_chain_modeling.rf_components.zvq_183_s_plusUsing uv:
uv run python -m rf_chain_modeling.rf_components.zvq_183_s_plusWhat it does:
- Data Import: Reads
zvq_183_s_plus.tsvsecurely viaimportlib.resources. - Component Creation: Instantiates an
RF_Modelised_Componentusing the real-world data points. - Characterization:
- Interpolates performance metrics across the frequency band (10 MHz - 20 GHz).
- Calculates and plots Gain, Phase, and Noise Figure vs. Frequency.
- Assesses linearity (P1dB, IP3) at specific test frequencies.
The project includes a comprehensive test suite (unit tests and end-to-end integration tests) located in the tests/ directory.
If you installed the package with the [dev] dependencies, you can run the test suite using pytest:
Standard execution:
pytest
# Or to see verbose output:
pytest -vlUsing uv:
uv run pytest
# Or to see verbose output:
uv run pytest -vlThe package source code is located under the src/rf_chain_modeling/ directory:
examples/: Demonstration scripts showing how to use the framework (e.g., complete RF chain, specific components).rf_utils/: Core utilities for signal processing (Signalsclass), abstract base component classes, and CSV data handling.rf_components/: Definitions for specific or generic RF components (e.g., amplifiers, cables, filters), including packaged.tsvdata.rf_chains/: Definitions and simulations of complete cascaded RF chains.rf_subchains/: Reusable sub-blocks of RF components.
The test suite is located under tests/ and currently includes:
test_10_rf_modeling.pytest_20_components.pyrf_components/test_21_zvq_183_s_plus.py
This project is licensed under the MIT License. See the LICENSE file for details.
Author: Pessel Arnaud
If you use this software in your research, please cite it using the following DOI (as defined in the CITATION.cff release):
Pessel, A. (2026). rf_chain_modeling (v0.1.2.dev1). Zenodo. https://doi.org/10.5281/zenodo.18145792
When contributing to this project, you must strictly adhere to the Functional Requirements (FR-STD-01 to FR-STD-07) defined in pyproject.toml:
- Language (
FR-STD-01): All source code, docstrings, variable names, and inline comments must be written entirely in English. - Documentation (
FR-STD-02,FR-STD-04): Use the Google docstring style for all public classes and methods. - Logging (
FR-STD-05): Do not useprint()statements in production code; use theloggingmodule. - Naming (
FR-STD-06): Strictly preserve and respect underscore-based naming conventions in all Python identifiers (e.g.,rf_chain_modeling,im2___power). - Formatting (
FR-STD-07): Maintain existing vertical alignments for assignment operators and dictionary definitions.