Skip to content
RFrftools.io

rftools Python Library

Programmatic access to all 203 RF & electronics calculators — typed functions, batch mode, async support, and a CLI. Free tier requires no API key.

bash
pip install rftools

Python 3.9+. Dependencies: httpx, pydantic, click. View on PyPI

Quick Start (free tier)

Requires an API key. Free tier: 5 calls/month — get one free at rftools.io/pricing.

python
import rftools

result = rftools.calculate('vswr-return-loss', {'vswr': 2.5})
print(f'Return Loss: {result["returnLoss"]:.2f} dB')   # 9.54 dB
print(f'Reflection Coeff: {result["reflectionCoeff"]:.3f}')  # 0.333

rftools.calculate() returns a dict-like CalculatorResult. Access outputs by key.

Typed Category Stubs

IDE-friendly typed functions with parameter names and defaults that match the rftools.io web UI. All 13 categories available.

python
from rftools.calculators import rf, antenna, pcb

# Parameter names and defaults match the rftools.io web UI
fspl = rf.free_space_path_loss(frequency=2400.0, distance=100.0)
print(f'FSPL: {fspl["pathLoss"]:.1f} dB')   # 80.0 dB

dipole = antenna.dipole_antenna(frequency=433.0)
print(f'Dipole length: {dipole["length"]:.0f} mm')

result = pcb.trace_width_current(current=2.0, tempRise=10.0, thickness=1.0)

Batch API

Run up to 50 calculations in a single HTTP request — ideal for parameter sweeps. Requires an API-tier key (10,000 calls/month). Get a key.

python
import rftools

client = rftools.Client(api_key='rfc_live_xxx')
# or: export RFTOOLS_API_KEY=rfc_live_xxx

distances = [10, 50, 100, 500, 1000]
results = client.batch([
    ('free-space-path-loss', {'frequency': 2400, 'distance': d})
    for d in distances
])

for d, r in zip(distances, results):
    if r.ok:
        print(f'{d:>6}m  →  {r.values["pathLoss"]:.1f} dB')

Async Support

Use AsyncClient for FastAPI services, async Jupyter kernels, or concurrent sweeps.

python
import asyncio
import rftools

async def main():
    async with rftools.AsyncClient(api_key='rfc_live_xxx') as client:
        result = await client.calculate('vswr-return-loss', {'vswr': 2.5})
        print(result['returnLoss'])

asyncio.run(main())

CLI

The rftools command is installed automatically with the package.

rftools calc vswr-return-loss --vswr 2.5
rftools calc vswr-return-loss --vswr 2.5 --json | jq .values
rftools list --category rf
rftools info free-space-path-loss
rftools version

Error Handling

python
from rftools.exceptions import AuthError, RateLimitError, ValidationError, NotFoundError

try:
    result = client.calculate('vswr-return-loss', {'vswr': 2.5})
except RateLimitError as e:
    print(f'Quota exceeded. Retry after {e.retry_after}s')
except AuthError:
    print('Invalid API key')
except NotFoundError:
    print('Unknown calculator slug')
except ValidationError as e:
    print(f'Bad inputs: {e.detail}')
ExceptionWhen
AuthErrorInvalid or missing API key
RateLimitErrorMonthly quota exceeded (has .retry_after attribute)
ValidationErrorBad inputs (HTTP 422) — has .detail attribute
NotFoundErrorUnknown calculator slug
APIErrorUnexpected HTTP error — has .status_code attribute

All 13 Categories

Import from rftools.calculators.

ModuleCount
rf26
pcb13
power20
signal13
antenna8
general21
motor18
protocol11
emc16
thermal6
sensor17
unit_conversion17
audio17

API Key

Set RFTOOLS_API_KEY to avoid passing it explicitly. The module-level helpers and Client() both read it automatically.

bash
export RFTOOLS_API_KEY=rfc_live_xxx

Get a key at /pricing. API tier: $19/mo, 10,000 calls/month.

Ready to automate?

Install the library, get a free API key, and run your first calculation in under a minute.

Or get a free API key (5 calls/month) — no credit card required.