Scikit-RF

1.11.0 · active · verified Thu Apr 16

Scikit-RF is an object-oriented Python library for microwave engineering. It provides tools for network analysis, circuit simulation, calibration, and visualization of S-parameters and other RF components. The current version is 1.11.0, and it maintains an active, though not strictly time-bound, release cadence.

Common errors

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to create a simple 2-port `Network` object in scikit-rf, populate it with dummy S-parameter data, and then plot its S21 magnitude in dB. It highlights the use of `Frequency` and `Network` classes and the common `plot_s_db` method.

import skrf as rf
import matplotlib.pyplot as plt

# Create a dummy 2-port network for demonstration
f = rf.Frequency(1, 10, 101, 'ghz') # 1-10 GHz, 101 points
s = rf.Touchstone(f, name='my_network')

# Populate with some dummy S-parameters (e.g., ideal thru) for 2-port
s.s[:,0,0] = 0 # S11
s.s[:,1,1] = 0 # S22
s.s[:,0,1] = 1 # S12
s.s[:,1,0] = 1 # S21

# Create a Network object from the Touchstone data
ntwk = rf.Network(s=s.s, frequency=f, name='Dummy Thru')

# Plot S21 magnitude in dB
ntwk.plot_s_db(m=1, n=0)
plt.title(f'{ntwk.name} S21 Magnitude')
plt.xlabel('Frequency (GHz)')
plt.ylabel('S21 Magnitude (dB)')
# plt.show() # Uncomment to display plot

print(f"Network name: {ntwk.name}")
print(f"Network frequency range: {ntwk.frequency.f_ghz[0]:.2f} GHz to {ntwk.frequency.f_ghz[-1]:.2f} GHz")

view raw JSON →