network (skrf.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, comments, f_unit, s_def])

A n-port electrical network.

Building Network

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

Create a Network from its Z-parameters

Network Representations

Network.s

Scattering parameter matrix.

Network.z

Impedance parameter matrix.

Network.y

Admittance parameter matrix.

Network.a

abcd parameter matrix.

Network.t

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_list(l)

cascade a list of 2N-port networks

de_embed(ntwkA, ntwkB)

De-embed ntwkA from ntwkB.

flip(a)

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)

Interpolates s-parameters given a new

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

Interpolate a Network along frequency axis

Network.interpolate_self(freq_or_n, **kwargs)

Interpolates s-parameters given a new

Combining and Splitting Networks

subnetwork(ntwk, ports[, offby])

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

one_port_2_two_port(ntwk)

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

skrf.io.general.read(file, *args, **kwargs)

Read skrf object[s] from a pickle file.

skrf.io.general.write(file, obj[, overwrite])

Write skrf object[s] to a file.

skrf.io.general.network_2_spreadsheet(ntwk)

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

Network.write([file])

Write the Network to disk using the pickle module.

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

Write a contents of the Network to a touchstone file.

Network.read(*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.

Noise

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

inv(s)

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

s2t(s)

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

z2y(z)

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

z2t(z)

Not Implemented yet

z2a(z)

Converts impedance parameters to abcd parameters [#]_ .

y2s(y[, z0, s_def])

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

y2z(y)

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

y2t(y)

Not Implemented Yet

t2s(t)

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

t2z(t)

Not Implemented Yet

t2y(t)

Not Implemented Yet

h2s(h[, z0])

convert hybrid parameters to s parameters

h2z(h)

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(s)

Passivity metric for a multi-port network.

reciprocity(s)

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.

Network.nudge([amount])

Perturb s-parameters by small amount.

Network.renormalize(z_new[, s_def])

Renormalize s-parameter matrix given a new port impedances.