A Radar Range Equation Package
Project description
2025.10.27
Main updates include support for theta_B and calculations for spheres, RCS and radius from RCS.
New: Plotting capabilities for visualizing radar signals including pulsed radar, CW Doppler, CWFM, pulse compression, range profiles, and Doppler spectra.
Radar Range Equation
A compact toolbox for deriving and evaluating radar range equations. It exposes a small programmatic API for setting physical variables, performing common radar-related calculations, converting units, and visualizing radar signals.
Install
pip install radar-range-equation
## Quick start
```python
import radar_range_equation as RRE
# Set common variables
RRE.vars.c = 3.0e8 # speed of light (m/s)
RRE.vars.f = 430e6 # frequency (Hz)
RRE.vars.eta = 0.6 # antenna efficiency (unitless)
# Because `lambda` is a reserved word in Python, access it with getattr/setattr
setattr(RRE.vars, 'lambda', RRE.vars.c / RRE.vars.f)
print('wavelength (m):', getattr(RRE.vars, 'lambda'))
# Compute effective aperture (circular antenna example)
RRE.vars.D = RRE.convert_ft_to_m(60) # antenna diameter in meters
RRE.vars.A_e = RRE.solve.A_e_circ()
print('A_e (m^2):', RRE.vars.A_e)
# Visualize a pulsed radar signal
RRE.plot.pulsed_radar_signal(
amplitude=20,
frequency=0.5e6, # 0.5 MHz
pulse_width=15e-6, # 15 microseconds
pri=50e-6, # 50 microseconds
num_pulses=3
)
Public API (short)
vars— namespace-like container of variables (speed of lightc, frequencyf, wavelengthlambda, gains, power, sigma, etc.). Usegetattr/setattrforlambda.solve— helper functions for computing aperture, gain, R_max, P_t and other routine expressions (e.g.,solve.wavelength(),solve.G_t()).equations— symbolic SymPy expressions representing the radar equations used bysolve.plot— plotting utilities for visualizing radar signals (pulsed radar, CW Doppler, CWFM, pulse compression, range profiles, Doppler spectra).redefine_variable(name, value)— convenience to set attributes on thevarsnamespace.convert— unit conversion helpers (e.g.,convert.ft_to_m(),convert.lin_to_db(),convert.hz_to(), etc.).
Plotting Capabilities
The package now includes comprehensive plotting functions for visualizing radar signals:
Pulsed Radar Signal
import radar_range_equation as RRE
# Visualize a pulsed radar transmit signal
t, signal, fig = RRE.plot.pulsed_radar_signal(
amplitude=20, # Peak amplitude
frequency=0.5e6, # 0.5 MHz carrier
pulse_width=15e-6, # 15 µs pulse width
pri=50e-6, # 50 µs pulse repetition interval
num_pulses=3, # 3 pulses
time_span=150e-6 # 150 µs total time
)
Other Plotting Functions
plot.cw_doppler_signal()— CW radar with Doppler shiftplot.cwfm_signal()— Continuous Wave Frequency Modulated radarplot.pulse_compression_signal()— Chirp pulse and compressed outputplot.range_profile()— Target detections at various rangesplot.doppler_spectrum()— Velocity distribution of targets
See python/example_plotting.py for complete examples of all plotting capabilities.
Testing
After installing the package you can run the included smoke test:
python python/test_package.py
The test script checks basic import and example calculations.
To test the plotting functionality:
python python/test_plotting.py
To see examples of all plotting capabilities:
python python/example_plotting.py
Notes and gotchas
lambdais a reserved Python keyword; usegetattr(vars, 'lambda')andsetattr(vars, 'lambda', value)when reading/writing the wavelength variable.- The package mixes symbolic (SymPy) and numeric (NumPy/Scipy) approaches. The
equationsmodule provides symbolic forms whilesolvereturns numeric results based on values invars.
Contributing
Small, focused improvements (tests, docs, type hints) are welcome. The repository uses Hatch in CI for packaging; see .github/workflows/python-package.yml for the build/test flow.
License
See the repository LICENSE file for licensing details.
Radar Range Equation
A basic toolbox for solving radar range equations
Testing
After building and installing the package, you can run the test script to verify functionality:
python python/test_package.py
This test script verifies that:
- The package can be imported successfully
- Variables can be set dynamically (e.g.,
c,f,lambda) - The
redefine_variablefunction works correctly - Calculations work as expected (e.g.,
lambda = c/f)
Example Usage
import radar_range_equation as RRE
# Set the speed of light (m/s)
RRE.vars.c = 3.00 * 10**8
# Set the frequency (Hz)
RRE.vars.f = 10
# Calculate and set wavelength (m)
# Note: 'lambda' is a reserved keyword in Python, so use setattr/getattr
setattr(RRE.vars, 'lambda', RRE.vars.c / RRE.vars.f)
# Print the wavelength
print(getattr(RRE.vars, 'lambda')) # Output: 30000000.0
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file radar_range_equation-2025.12.12.dev1.tar.gz.
File metadata
- Download URL: radar_range_equation-2025.12.12.dev1.tar.gz
- Upload date:
- Size: 726.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d6c2973651d4d5e817b587da600684549789d8abd1a28e8e69639f4a2b1b46e7
|
|
| MD5 |
c3a59cc17d5171b21b8afdf0109c02b0
|
|
| BLAKE2b-256 |
ef0fa99399c2dca828a9eb66ded50e4fd3f36b55d14bc326b0dd2a366e78febb
|
File details
Details for the file radar_range_equation-2025.12.12.dev1-py3-none-any.whl.
File metadata
- Download URL: radar_range_equation-2025.12.12.dev1-py3-none-any.whl
- Upload date:
- Size: 39.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5e9730bcf7bb539183e0ecef9e3809caaccb5239267bb140ef54893fb38f6aca
|
|
| MD5 |
a392b78b3568434462ab70f2d30f85bd
|
|
| BLAKE2b-256 |
4d49a7e43bd0c954476a9e6fcefa0aaca7811d8e0b88788d6da59cbe77e97555
|