network (

Provide an 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, ...])

An 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 parameter matrix.

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)

Stitch ntwkA and ntwkB together.

overlap(ntwkA, ntwkB)

Return 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])

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


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

n_oneports_2_nport(ntwk_list, *args, **kwargs)

Build an N-port Network from list of N one-ports.

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

Build a 2-port Network from list of four 1-ports.

n_twoports_2_nport(ntwk_list, nports[, ...])

Build an 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, ...)

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

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

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

Supporting Functions


Calculate '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 [#]_.


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

s2a(s[, z0])

Convert 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.


Convert 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])

Calculate the average network from a list of Networks.

two_port_reflect(ntwk1[, ntwk2, name])

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

chopinhalf(ntwk, *args, **kwargs)

Chop 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.