network (

Provides a n-port network class and associated functions.

Much of the functionality in this module is provided as methods and properties of the Network Class.

Network Class

Network([file, name, params, comments, ...])

A n-port electrical network.

Building Network

Network.from_z(z, *args, **kw)

Create a Network from its Z-parameters

Network Representations


Scattering parameter matrix.


Impedance parameter matrix.


Admittance parameter matrix.


abcd parameter matrix.


Scattering transfer parameters

Connecting Networks

connect(ntwkA, k, ntwkB, l[, num])

Connect two n-port networks together.

innerconnect(ntwkA, k, l[, num])

connect ports of a single n-port network.

cascade(ntwkA, ntwkB)

Cascade two 2, 2N-ports Networks together.


cascade a list of 2N-port networks

de_embed(ntwkA, ntwkB)

De-embed ntwkA from ntwkB.


Invert the ports of a networks s-matrix, 'flipping' it over left and right.

Interpolation and Concatenation Along Frequency Axis

stitch(ntwkA, ntwkB, **kwargs)

Stitches ntwkA and ntwkB together.

overlap(ntwkA, ntwkB)

Returns the overlapping parts of two Networks, interpolating if needed.

Network.resample(freq_or_n, **kwargs)

Interpolate the current Network along frequency axis (inplace).

Network.interpolate(freq_or_n[, basis, ...])

Interpolate a Network along frequency axis

Network.interpolate_self(freq_or_n, **kwargs)

Interpolate the current Network along frequency axis (inplace).

Combining and Splitting Networks

subnetwork(ntwk, ports[, offby])

Returns a subnetwork of a given Network from a list of port numbers.


Calculates the 2-port network given a symmetric, reciprocal and lossless 1-port network.

n_oneports_2_nport(ntwk_list, *args, **kwargs)

Builds a N-port Network from list of N one-ports

four_oneports_2_twoport(s11, s12, s21, s22, ...)

Builds a 2-port Network from list of four 1-ports

three_twoports_2_threeport(ntwk_triplet[, ...])

Creates 3-port from three 2-port Networks

n_twoports_2_nport(ntwk_list, nports[, offby])

Builds a N-port Network from list of two-ports

concat_ports(ntwk_list[, port_order])

Concatenate networks along the port axis

IO, *args, **kwargs)

Read skrf object[s] from a pickle file., obj[, overwrite])

Write skrf object[s] to a file.

Write a Network object to a spreadsheet, for your boss.


Write the Network to disk using the pickle module.

Network.write_touchstone([filename, dir, ...])

Write a contents of the Network to a touchstone file.*args, **kwargs)

Read a Network from a 'ntwk' file

Network.write_spreadsheet(*args, **kwargs)

Write contents of network to a spreadsheet, for your boss to use.


Network.add_noise_polar(mag_dev, phase_dev, ...)

adds a complex zero-mean gaussian white-noise.

Network.add_noise_polar_flatband(mag_dev, ...)

adds a flatband complex zero-mean gaussian white-noise signal of given standard deviations for magnitude and phase

Network.multiply_noise(mag_dev, phase_dev, ...)

multiplies a complex bivariate gaussian white-noise signal of given standard deviations for magnitude and phase.

Supporting Functions


Calculates 'inverse' s-parameter matrix, used for de-embedding

connect_s(A, k, B, l)

Connect two n-port networks' s-matrices together.

innerconnect_s(A, k, l)

connect two ports of a single n-port network's s-matrix.

s2z(s[, z0, s_def])

Convert scattering parameters [#]_ to impedance parameters [#]_

s2y(s[, z0, s_def])

convert scattering parameters [#]_ to admittance parameters [#]_


Converts scattering parameters [#]_ to scattering transfer parameters [#]_ .

s2a(s[, z0])

Converts scattering parameters to abcd parameters [#]_ .

s2h(s[, z0])

Convert scattering parameters [#]_ to hybrid parameters [#]_

z2s(z[, z0, s_def])

convert impedance parameters [#]_ to scattering parameters [#]_


convert impedance parameters [#]_ to admittance parameters [#]_


Not Implemented yet


Converts impedance parameters to abcd parameters [#]_ .

y2s(y[, z0, s_def])

convert admittance parameters [#]_ to scattering parameters [#]_


convert admittance parameters [#]_ to impedance parameters [#]_


Not Implemented Yet


converts scattering transfer parameters [#]_ to scattering parameters [#]_


Not Implemented Yet


Not Implemented Yet

h2s(h[, z0])

convert hybrid parameters to s parameters


Converts hybrid parameters to z parameters [#]_ .

fix_z0_shape(z0, nfreqs, nports)

Make a port impedance of correct shape for a given network's matrix

renormalize_s(s, z_old, z_new[, s_def, ...])

Renormalize a s-parameter matrix given old and new port impedances.


Passivity metric for a multi-port network.


Reciprocity metric for a multi-port network.

Misc Functions

average(list_of_networks[, polar])

Calculates the average network from a list of Networks.

two_port_reflect(ntwk1[, ntwk2])

Generates a two-port reflective two-port, from two one-ports.

chopinhalf(ntwk, *args, **kwargs)

Chops a sandwich of identical, reciprocal 2-ports in half.


Perturb s-parameters by small amount.

Network.renormalize(z_new[, s_def])

Renormalize s-parameter matrix given a new port impedances.


Drop invalid values based on duplicate and non increasing frequency values