Skip to main content

SPITE 0.1.2

Scattering Parameter Inspection Tool for Engineers

"The secret ingredient is SPITE :D"


1. Introduction

SPITE is a lightweight single-file Python library for RF network analysis, built so undergraduate students can learn the basics of RF/microwave engineering and run simulations outside of class or internships without needing expensive, license-gated software.

SPITE is built around the Network class, which represents RF networks using frequency data, scattering parameters, reference impedance, and schematic information. Python operators are used for 1-port and 2-port network composition: @ for cascading and ** for repeating networks.

2. Features

  • The entire library is in one file
  • Conversion between S, Z, Y, and ABCD parameters in both directions
  • Lumped R, L, C and transmission line elements (2-port and 1-port)
  • Schematics for 2-port and 1-port networks
  • @ for cascading 2-port and 1-port networks
  • ** for repeating a 2-port network
  • Linear, dB, phase, group delay, and Smith chart plots
  • Time-domain gating
  • Touchstone file import and export
  • Very important functions such as esqueleto() and merendola() (for reasons beyond RF engineering)

3. Limitations

Features not yet implemented

  • Frequency dependent / complex reference impedance
  • General N-port topology / circuit connection
  • Components such as waveguides, microstrips, etc.
  • Noise factor as a network parameter / property

Try using scikit-rf for more advanced RF engineering.

4. Installation

SPITE depends on NumPy and Matplotlib. Nothing else.

pip install spite

In a notebook environment, run the following cell to install SPITE:

!pip install spite -q  # -q is optional

Then start your Python script or notebook with:

import numpy as np
import spite as sp

SPITE imports Matplotlib internally. So importing Matplotlib again is unnecessary unless you want to make custom plots.

5. Examples

Quarter-wave matching network

f = np.linspace(0.1, 4e9, 100)  # frequency sweep

# Zc = sqrt(Z0*R) is the quarter-wave matching condition
matching_network = (
    sp.net2p_tline_series(f=f, f0=1e9, EL_deg=90, Zc=np.sqrt(50 * 75))
    @ sp.net1p_R(f=f, R=75)  # terminates the network with a 75-ohm load
)

matching_network.plot_schematic()  # horizontal stack of SYM2P_TLINE_SERIES + SYM1P_R
matching_network.plot_dB()  # S11 in dB

A quarter-wave transformer of Zc = sqrt(Z0 * R_L) matches a 75Ω load to a 50Ω system exactly at f0.

RLGC ladder

f = np.linspace(0.1, 4e9, 100)  # frequency sweep
R, L, G, C = 1.5, 5e-9, 3e-4, 2e-12  # R, L, G, C values of one section

ladder = sp.net2p_RLGC(f, R, L, G, C) ** 3  # ** repeats the section 3 times

ladder.plot_schematic()
ladder.plot_dB(port_indices=(2, 1))  # S21 in dB
ladder.plot_smith()  # color gradient encodes frequency

Lumped-element low-pass filter

f = np.linspace(0.1, 4e9, 100)  # frequency sweep

filter = (
    sp.net2p_L_series(f, 3.9785e-9)
    @ sp.net2p_C_shunt(f, 3.184e-12)
    @ sp.net2p_L_series(f, 3.9785e-9)  
)

S11_at_2GHz = filter.sample(2e9, param="S", port_indices=(1, 1))
print(20 * np.log10(np.abs(S11_at_2GHz)))  # -3.0127 dB 

filter.plot_dB(floor=-30, port_indices=[(1, 1), (2, 1)])
filter.plot_smith(port_indices=[(1, 1), (2, 1)], chart_type="Y")  # Admittance charts are available as well

This exact filter was cross-checked against an AWR Microwave Office simulation of the same design. SPITE's predicted response matched to within 0.01 dB at the 2 GHz cutoff.

6. License and Citation

SPITE is released under the 0BSD License

  • You can use, modify, and share SPITE freely.
  • Attribution is appreciated but not required.
  • The software comes as is, with no warranty.

A bibtex is provided below for those who would like to use it:

@software{spite,
  author  = {Lee, Anthony Jeongseok},
  title   = {SPITE: Scattering Parameter Inspection Tool for Engineers},
  year    = {2026},
  url     = {https://github.com/anthonyjlee377/spite},
  version = {0.1.2}
}

7. Disclosure

  • SPITE is an independent project unaffiliated with any supervisor or institution.
  • Generative AI has been used in the development of its source code and initial documentation. The source code is subject to human review and validation. The single-file source code is intended to serve as learning material for students in future versions, and therefore requires a balance between computational efficiency and pedagogical clarity to reflect this goal.

Metadata

Release files for spite 0.1.2

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

Source distribution (sdist)

Source distribution for spite 0.1.2
File Size Uploaded
spite-0.1.2.tar.gz 20.7 kB Details

Built distribution (wheel)

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

Total release size: 39.3 kB

Release files / spite-0.1.2.tar.gz

Download URL spite-0.1.2.tar.gz
Size 20.7 kB
Tags Source
SHA-256 checksum
How to use checksums
55d46cb57e2bc5de793814eb32d825dcb2d78474016f0d409f4a99ff6493ccca
BLAKE2b-256 checksum
How to use checksums
8aa8e674a834289581a6db3015b4a556fc7b5bce1b12739cae32cb0bf09507fe
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.15

Release files / spite-0.1.2-py3-none-any.whl

Download URL spite-0.1.2-py3-none-any.whl
Size 18.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
98da24e16be9bda4126d731543b564b6c10a858fb95da341ff434cb0bb06ed45
BLAKE2b-256 checksum
How to use checksums
401359db0400c68189cb42be0084a4a665372595820156fce7b81a4fb16c8bda
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.15

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files

0.1.1

2 release files

0.1.0

2 release files

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