Python Program for designing open/shorted transmission line stub filters.
Find a file
2026-11-28 11:15:44 -05:00
Example 1 Initial commit: transmission line stub calculator 2026-10-18 03:34:06 -04:00
Example2 Initial commit: transmission line stub calculator 2026-10-18 03:34:06 -04:00
Example3 Initial commit: transmission line stub calculator 2026-10-18 03:34:06 -04:00
Example4 Initial commit: transmission line stub calculator 2026-10-18 03:34:06 -04:00
Example5 Initial commit: transmission line stub calculator 2026-10-18 03:34:06 -04:00
Example6 Initial commit: transmission line stub calculator 2026-10-18 03:34:06 -04:00
tests Added multistub and double stub tuner calculations 2026-11-28 11:15:44 -05:00
tlcalc Added multistub and double stub tuner calculations 2026-11-28 11:15:44 -05:00
.gitignore Initial commit: transmission line stub calculator 2026-10-18 03:34:06 -04:00
LICENSE Initial commit: transmission line stub calculator 2026-10-18 03:34:06 -04:00
main.py Initial commit: transmission line stub calculator 2026-10-18 03:34:06 -04:00
README.md Added multistub and double stub tuner calculations 2026-11-28 11:15:44 -05:00
requirements.txt Initial commit: transmission line stub calculator 2026-10-18 03:34:06 -04:00

Transmission Line Stub Calculator

A desktop calculator for designing shunt-stub band-reject (notch) filters out of coax or ladder line, aimed at amateur-radio use (HF, roughly 1–30 MHz, and up to 1.3 GHz). Written in Python with PySide6 and matplotlib.

Response example

Example6: a 21.2 MHz notch from a shorted half-wave RG-213 stub into a 50 Ω load.

Features

  • 1 to 4 stub designs. Each stub is a shunt stub, open or shorted, with its own reject frequency and its own spacing from the next stub.
  • Double-stub tuner mode: enter the antenna impedance in complex notation (e.g. 100+j50) and get the two stub lengths that match it to the source impedance (50 Ω by default). See below.
  • Real cable parameters: impedance, velocity factor and loss (dB/100 ft at 10 MHz, scaled with √f), separately for the main line and the stub line. Presets for RG-58, RG-213, RG-8X, LMR-400, RG-59, RG-6 and 450 Ω ladder line.
  • All the lengths you need: transmitter → stub 1, between each pair of stubs, last stub → load, and each stub. Enter them in metres or feet; the electrical length in degrees and wavelengths is shown alongside. A "Set to…" dropdown sets a length to λ/4, λ/2 or λ/8, and "Auto-design everything" sets notch-length stubs and spacing.
  • Complex load (R + jX) and source resistance, so mismatched antennas and the lengths of line between stubs and load are modelled correctly.
  • Plots
    • Response: loss added by the stubs, total TX → load loss, and TX return loss with and without stubs, with ham bands shaded and a hover cursor (frequency, losses, return loss, SWR).
    • Smith chart: impedance seen by the transmitter across the sweep, with a hover cursor.
    • Network diagram: simplified schematic of the stub network with cable types and lengths.
    • Summary / cut list: physical lengths (m, ft/in), notch depth and 3 dB bandwidth.
  • Save / open designs as JSON (Ctrl+S / Ctrl+O). Export plot images (PNG/SVG/PDF) and the sweep data as CSV.

Double-stub tuner

Choose Mode → Double-stub tuner, then set:

  • the design frequency and the transmitter source R;
  • the antenna impedance, as R+jX (75+j40, 25 - 30j, 200);
  • the main-line lengths: transmitter → stub 1, stub spacing (λ/8, λ/4, 3λ/8 or any length) and stub 2 → antenna;
  • open or shorted ends for each stub, and the cable types.

The stub lengths are shown in the panel and in the summary, along with SWR, loss and the SWR ≤ 2 bandwidth. There are usually two solutions; pick one with Solution. Line and stub loss are included in the calculation.

A double-stub tuner cannot match every load with a given spacing (the forbidden region). If so, the app says why; change the stub 2 → antenna length or the spacing. The spacing is a physical length, so set it again after changing the design frequency.

Install and run

Requires Python 3.10+.

pip install -r requirements.txt
python main.py

The Example* folders each hold a saved design (.json, open it from File → Open design…) and the plots exported from it.

How it works

The network is solved with ABCD (transmission) matrices: main-line sections, shunt stub admittances, and a complex load. Insertion loss is the transducer gain with the stubs compared with the same network without them. The physics lives in tlcalc/core.py and has no GUI dependency; the UI is tlcalc/ui.py.

Notch rule of thumb for shunt stubs: an open stub notches at odd multiples of λ/4; a shorted stub notches at multiples of λ/2. (A shorted λ/4 stub is a band-pass element.)

Limitations

  • Stubs and junctions are ideal: no open-end fringing or T-junction discontinuity correction. Cut long and trim while watching an antenna analyzer.
  • Loss follows a conductor-loss (√f) model only; Z0 is treated as real and velocity factor as constant. The preset loss figures are approximate; check your cable's datasheet.
  • No power or voltage handling checks. A notch can put high voltage or current on the stub.

Tests

pip install pytest
python -m pytest tests

License

Licensed under the Apache License, Version 2.0. See LICENSE.