skrf.network.Network

class skrf.network.Network(file=None, name=None, params=None, comments=None, f_unit=None, s_def=None, **kwargs)[source]

An n-port electrical network.

For instructions on how to create Network see __init__(). An n-port network [1] may be defined by three quantities * network parameter matrix (s, z, or y-matrix) * port characteristic impedance matrix * frequency information

The Network class stores these data structures internally in the form of complex numpy.ndarray’s. These arrays are not interfaced directly but instead through the use of the properties:

Property

Meaning

s

Scattering parameter matrix.

z0

Characteristic impedance matrix.

f

Frequency vector.

Although these docs focus on s-parameters, other equivalent network representations such as z and y are available. Scalar projections of the complex network parameters are accessible through properties as well. These also return numpy.ndarray’s.

Property

Meaning

s_re

Real part of the s-matrix.

s_im

Imaginary part of the s-matrix.

s_mag

Magnitude of the s-matrix.

s_db

Magnitude in log scale of the s-matrix.

s_deg

Phase of the s-matrix in degrees.

The following operations act on the networks s-matrix.

Operator

Function

+

Element-wise addition of the s-matrix.

-

Element-wise difference of the s-matrix.

*

Element-wise multiplication of the s-matrix.

/

Element-wise division of the s-matrix.

**

Cascading (only for 2-ports).

//

De-embedding (for 2-ports, see inv).

Different components of the Network can be visualized through various plotting methods. These methods can be used to plot individual elements of the s-matrix or all at once. For more info about plotting see the Plotting tutorial.

Method

Meaning

plot_s_smith()

Plot complex s-parameters on smith chart.

plot_s_re()

Plot real part of s-parameters vs frequency.

plot_s_im()

Plot imaginary part of s-parameters vs frequency.

plot_s_mag()

Plot magnitude of s-parameters vs frequency.

plot_s_db()

Plot magnitude (in dB) of s-parameters vs frequency.

plot_s_deg()

Plot phase of s-parameters (in degrees) vs frequency.

plot_s_deg_unwrap()

Plot phase of s-parameters (in unwrapped degrees) vs frequency.

Network objects can be created from a touchstone or pickle file (see __init__()), by a Media object, or manually by assigning the network properties directly. Network objects can be saved to disk in the form of touchstone files with the write_touchstone() method.

An exhaustive list of Network Methods and Properties (Attributes) are given below

References

Parameters:

Attributes

COMPONENT_FUNC_DICT

Component functions like 're', 'im', 'mag', 'db', etc.

PRIMARY_PROPERTIES

Primary Network Properties list like 's', 'z', 'y', etc.

Y_LABEL_DICT

Y-axis labels to the plotting functions.

a

abcd parameter matrix.

a_arcl

The arcl component of the a-matrix.

a_arcl_unwrap

The arcl_unwrap component of the a-matrix.

a_db

The db component of the a-matrix.

a_db10

The db10 component of the a-matrix.

a_deg

The deg component of the a-matrix.

a_deg_unwrap

The deg_unwrap component of the a-matrix.

a_im

The im component of the a-matrix.

a_mag

The mag component of the a-matrix.

a_rad

The rad component of the a-matrix.

a_rad_unwrap

The rad_unwrap component of the a-matrix.

a_re

The re component of the a-matrix.

a_time

The time component of the a-matrix.

a_time_db

The time_db component of the a-matrix.

a_time_impulse

The time_impulse component of the a-matrix.

a_time_mag

The time_mag component of the a-matrix.

a_time_step

The time_step component of the a-matrix.

a_vswr

The vswr component of the a-matrix.

f

The frequency vector for the network, in Hz.

f_noise

The frequency vector for the noise of the network, in Hz.

frequency

Frequency information for the network.

g_opt

The optimum source reflection coefficient to minimize noise.

group_delay

Group delay.

h

Hybrid parameter matrix.

h_arcl

The arcl component of the h-matrix.

h_arcl_unwrap

The arcl_unwrap component of the h-matrix.

h_db

The db component of the h-matrix.

h_db10

The db10 component of the h-matrix.

h_deg

The deg component of the h-matrix.

h_deg_unwrap

The deg_unwrap component of the h-matrix.

h_im

The im component of the h-matrix.

h_mag

The mag component of the h-matrix.

h_rad

The rad component of the h-matrix.

h_rad_unwrap

The rad_unwrap component of the h-matrix.

h_re

The re component of the h-matrix.

h_time

The time component of the h-matrix.

h_time_db

The time_db component of the h-matrix.

h_time_impulse

The time_impulse component of the h-matrix.

h_time_mag

The time_mag component of the h-matrix.

h_time_step

The time_step component of the h-matrix.

h_vswr

The vswr component of the h-matrix.

inv

A Network object with 'inverse' s-parameters.

max_gain

Maximum available power gain for K > 1 and maximum stable power gain for K <= 1 (in linear).

max_stable_gain

Maximum stable power gain (in linear).

n

The ABCD form of the noise correlation matrix for the network.

nfmin

The minimum noise figure for the network.

nfmin_db

The minimum noise figure for the network in dB.

noise_interp_kind

Default interpolation method.

noisy

Whether this network has noise.

nports

The number of ports the network has.

number_of_ports

The number of ports the network has.

passivity

Passivity metric for a multi-port network.

port_tuples

Returns a list of tuples, for each port index pair.

reciprocity

Reciprocity metric for a multi-port network.

reciprocity2

Reciprocity metric #2

rn

The equivalent noise resistance for the network.

s

Scattering parameter matrix.

s_arcl

The arcl component of the s-matrix.

s_arcl_unwrap

The arcl_unwrap component of the s-matrix.

s_db

The db component of the s-matrix.

s_db10

The db10 component of the s-matrix.

s_deg

The deg component of the s-matrix.

s_deg_unwrap

The deg_unwrap component of the s-matrix.

s_im

The im component of the s-matrix.

s_invert

Inverted scattering parameter matrix.

s_mag

The mag component of the s-matrix.

s_power

Scattering parameter matrix with s_def = 'power'.

s_pseudo

Scattering parameter matrix with s_def = 'pseudo'.

s_rad

The rad component of the s-matrix.

s_rad_unwrap

The rad_unwrap component of the s-matrix.

s_re

The re component of the s-matrix.

s_time

The time component of the s-matrix.

s_time_db

The time_db component of the s-matrix.

s_time_impulse

The time_impulse component of the s-matrix.

s_time_mag

The time_mag component of the s-matrix.

s_time_step

The time_step component of the s-matrix.

s_traveling

Scattering parameter matrix with s_def = 'traveling'.

s_vswr

The vswr component of the s-matrix.

stability

Stability factor.

t

Scattering transfer parameter matrix.

t_arcl

The arcl component of the t-matrix.

t_arcl_unwrap

The arcl_unwrap component of the t-matrix.

t_db

The db component of the t-matrix.

t_db10

The db10 component of the t-matrix.

t_deg

The deg component of the t-matrix.

t_deg_unwrap

The deg_unwrap component of the t-matrix.

t_im

The im component of the t-matrix.

t_mag

The mag component of the t-matrix.

t_rad

The rad component of the t-matrix.

t_rad_unwrap

The rad_unwrap component of the t-matrix.

t_re

The re component of the t-matrix.

t_time

The time component of the t-matrix.

t_time_db

The time_db component of the t-matrix.

t_time_impulse

The time_impulse component of the t-matrix.

t_time_mag

The time_mag component of the t-matrix.

t_time_step

The time_step component of the t-matrix.

t_vswr

The vswr component of the t-matrix.

unilateral_gain

Mason's unilateral power gain (in linear).

y

Admittance parameter matrix.

y_arcl

The arcl component of the y-matrix.

y_arcl_unwrap

The arcl_unwrap component of the y-matrix.

y_db

The db component of the y-matrix.

y_db10

The db10 component of the y-matrix.

y_deg

The deg component of the y-matrix.

y_deg_unwrap

The deg_unwrap component of the y-matrix.

y_im

The im component of the y-matrix.

y_mag

The mag component of the y-matrix.

y_opt

The optimum source admittance to minimize noise.

y_rad

The rad component of the y-matrix.

y_rad_unwrap

The rad_unwrap component of the y-matrix.

y_re

The re component of the y-matrix.

y_time

The time component of the y-matrix.

y_time_db

The time_db component of the y-matrix.

y_time_impulse

The time_impulse component of the y-matrix.

y_time_mag

The time_mag component of the y-matrix.

y_time_step

The time_step component of the y-matrix.

y_vswr

The vswr component of the y-matrix.

z

Impedance parameter matrix.

z0

Characteristic impedance[s] of the network ports.

z_arcl

The arcl component of the z-matrix.

z_arcl_unwrap

The arcl_unwrap component of the z-matrix.

z_db

The db component of the z-matrix.

z_db10

The db10 component of the z-matrix.

z_deg

The deg component of the z-matrix.

z_deg_unwrap

The deg_unwrap component of the z-matrix.

z_im

The im component of the z-matrix.

z_mag

The mag component of the z-matrix.

z_opt

The optimum source impedance to minimize noise.

z_rad

The rad component of the z-matrix.

z_rad_unwrap

The rad_unwrap component of the z-matrix.

z_re

The re component of the z-matrix.

z_time

The time component of the z-matrix.

z_time_db

The time_db component of the z-matrix.

z_time_impulse

The time_impulse component of the z-matrix.

z_time_mag

The time_mag component of the z-matrix.

z_time_step

The time_step component of the z-matrix.

z_vswr

The vswr component of the z-matrix.

Methods

__init__

Network constructor.

add_noise_polar

Adds a complex zero-mean gaussian white-noise.

add_noise_polar_flatband

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

attribute

copy

Return a copy of this Network.

copy_from

Copy the contents of another Network into self.

copy_subset

Return a copy of a frequency subset of this Network.

crop

Crop Network based on start and stop frequencies.

cropped

Returns a cropped network, leaves self alone.

delay

Add phase delay to a given port.

drop_non_monotonic_increasing

Drop invalid values based on duplicate and non increasing frequency values.

extrapolate_to_dc

Extrapolate S-parameters down to 0 Hz and interpolate to uniform spacing.

flip

Swap the ports of a 2n-port Network (inplace).

flipped

Returns a flipped network, leaves self alone.

from_z

Create a Network from its Z-parameters.

func_on_parameter

Apply a function parameter matrix, one frequency slice at a time.

gain_circle

Returns loci of gain circles for a given port (0 or 1) and a specified gain.

gmm2se

Transform network from generalized mixed mode parameters [#]_ to single ended parameters.

impulse_response

Calculate time-domain impulse response of one-port.

interpolate

Interpolate a Network along frequency axis.

interpolate_self

Interpolate the current Network along frequency axis (inplace).

is_lossless

Test for losslessness.

is_passive

Test for passivity.

is_reciprocal

Test for reciprocity.

is_symmetric

Return whether the 2N-port network has n-th order reflection symmetry by checking.

multiply_noise

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

nf

The noise figure for the network if the source impedance is z.

nfdb_gs

Return dB(NF) foreach gamma_source x noise_frequency.

nonreciprocity

Normalized non-reciprocity metric.

nudge

Perturb s-parameters by small amount.

plot

Plot something vs frequency

plot_a_arcl

plot the Network attribute a_arcl component vs frequency.

plot_a_arcl_unwrap

plot the Network attribute a_arcl_unwrap component vs frequency.

plot_a_complex

plot the Network attribute {} vs frequency.

plot_a_db

plot the Network attribute a_db component vs frequency.

plot_a_db10

plot the Network attribute a_db10 component vs frequency.

plot_a_deg

plot the Network attribute a_deg component vs frequency.

plot_a_deg_unwrap

plot the Network attribute a_deg_unwrap component vs frequency.

plot_a_im

plot the Network attribute a_im component vs frequency.

plot_a_mag

plot the Network attribute a_mag component vs frequency.

plot_a_polar

plot the Network attribute {} vs frequency.

plot_a_rad

plot the Network attribute a_rad component vs frequency.

plot_a_rad_unwrap

plot the Network attribute a_rad_unwrap component vs frequency.

plot_a_re

plot the Network attribute a_re component vs frequency.

plot_a_time

plot the Network attribute a_time component vs time.

plot_a_time_db

plot the Network attribute a_time_db component vs time.

plot_a_time_impulse

plot the Network attribute a_time_impulse component vs time.

plot_a_time_mag

plot the Network attribute a_time_mag component vs time.

plot_a_time_step

plot the Network attribute a_time_step component vs time.

plot_a_vswr

plot the Network attribute a_vswr component vs frequency.

plot_attribute

plot the Network attribute conversion_attribute component vs frequency or time.

plot_h_arcl

plot the Network attribute h_arcl component vs frequency.

plot_h_arcl_unwrap

plot the Network attribute h_arcl_unwrap component vs frequency.

plot_h_complex

plot the Network attribute {} vs frequency.

plot_h_db

plot the Network attribute h_db component vs frequency.

plot_h_db10

plot the Network attribute h_db10 component vs frequency.

plot_h_deg

plot the Network attribute h_deg component vs frequency.

plot_h_deg_unwrap

plot the Network attribute h_deg_unwrap component vs frequency.

plot_h_im

plot the Network attribute h_im component vs frequency.

plot_h_mag

plot the Network attribute h_mag component vs frequency.

plot_h_polar

plot the Network attribute {} vs frequency.

plot_h_rad

plot the Network attribute h_rad component vs frequency.

plot_h_rad_unwrap

plot the Network attribute h_rad_unwrap component vs frequency.

plot_h_re

plot the Network attribute h_re component vs frequency.

plot_h_time

plot the Network attribute h_time component vs time.

plot_h_time_db

plot the Network attribute h_time_db component vs time.

plot_h_time_impulse

plot the Network attribute h_time_impulse component vs time.

plot_h_time_mag

plot the Network attribute h_time_mag component vs time.

plot_h_time_step

plot the Network attribute h_time_step component vs time.

plot_h_vswr

plot the Network attribute h_vswr component vs frequency.

plot_it_all

Plot dB, deg, smith, and complex in subplots.

plot_passivity

Plot dB(diag(passivity metric)) vs frequency.

plot_prop_complex

plot the Network attribute {} vs frequency.

plot_prop_polar

plot the Network attribute {} vs frequency.

plot_reciprocity

Plot reciprocity metric.

plot_reciprocity2

Plot reciprocity metric #2.

plot_s_arcl

plot the Network attribute s_arcl component vs frequency.

plot_s_arcl_unwrap

plot the Network attribute s_arcl_unwrap component vs frequency.

plot_s_complex

plot the Network attribute {} vs frequency.

plot_s_db

plot the Network attribute s_db component vs frequency.

plot_s_db10

plot the Network attribute s_db10 component vs frequency.

plot_s_db_time

plot_s_deg

plot the Network attribute s_deg component vs frequency.

plot_s_deg_unwrap

plot the Network attribute s_deg_unwrap component vs frequency.

plot_s_im

plot the Network attribute s_im component vs frequency.

plot_s_mag

plot the Network attribute s_mag component vs frequency.

plot_s_polar

plot the Network attribute {} vs frequency.

plot_s_rad

plot the Network attribute s_rad component vs frequency.

plot_s_rad_unwrap

plot the Network attribute s_rad_unwrap component vs frequency.

plot_s_re

plot the Network attribute s_re component vs frequency.

plot_s_smith

Plots the scattering parameter on a smith chart.

plot_s_time

plot the Network attribute s_time component vs time.

plot_s_time_db

plot the Network attribute s_time_db component vs time.

plot_s_time_impulse

plot the Network attribute s_time_impulse component vs time.

plot_s_time_mag

plot the Network attribute s_time_mag component vs time.

plot_s_time_step

plot the Network attribute s_time_step component vs time.

plot_s_vswr

plot the Network attribute s_vswr component vs frequency.

plot_t_arcl

plot the Network attribute t_arcl component vs frequency.

plot_t_arcl_unwrap

plot the Network attribute t_arcl_unwrap component vs frequency.

plot_t_complex

plot the Network attribute {} vs frequency.

plot_t_db

plot the Network attribute t_db component vs frequency.

plot_t_db10

plot the Network attribute t_db10 component vs frequency.

plot_t_deg

plot the Network attribute t_deg component vs frequency.

plot_t_deg_unwrap

plot the Network attribute t_deg_unwrap component vs frequency.

plot_t_im

plot the Network attribute t_im component vs frequency.

plot_t_mag

plot the Network attribute t_mag component vs frequency.

plot_t_polar

plot the Network attribute {} vs frequency.

plot_t_rad

plot the Network attribute t_rad component vs frequency.

plot_t_rad_unwrap

plot the Network attribute t_rad_unwrap component vs frequency.

plot_t_re

plot the Network attribute t_re component vs frequency.

plot_t_time

plot the Network attribute t_time component vs time.

plot_t_time_db

plot the Network attribute t_time_db component vs time.

plot_t_time_impulse

plot the Network attribute t_time_impulse component vs time.

plot_t_time_mag

plot the Network attribute t_time_mag component vs time.

plot_t_time_step

plot the Network attribute t_time_step component vs time.

plot_t_vswr

plot the Network attribute t_vswr component vs frequency.

plot_y_arcl

plot the Network attribute y_arcl component vs frequency.

plot_y_arcl_unwrap

plot the Network attribute y_arcl_unwrap component vs frequency.

plot_y_complex

plot the Network attribute {} vs frequency.

plot_y_db

plot the Network attribute y_db component vs frequency.

plot_y_db10

plot the Network attribute y_db10 component vs frequency.

plot_y_deg

plot the Network attribute y_deg component vs frequency.

plot_y_deg_unwrap

plot the Network attribute y_deg_unwrap component vs frequency.

plot_y_im

plot the Network attribute y_im component vs frequency.

plot_y_mag

plot the Network attribute y_mag component vs frequency.

plot_y_polar

plot the Network attribute {} vs frequency.

plot_y_rad

plot the Network attribute y_rad component vs frequency.

plot_y_rad_unwrap

plot the Network attribute y_rad_unwrap component vs frequency.

plot_y_re

plot the Network attribute y_re component vs frequency.

plot_y_time

plot the Network attribute y_time component vs time.

plot_y_time_db

plot the Network attribute y_time_db component vs time.

plot_y_time_impulse

plot the Network attribute y_time_impulse component vs time.

plot_y_time_mag

plot the Network attribute y_time_mag component vs time.

plot_y_time_step

plot the Network attribute y_time_step component vs time.

plot_y_vswr

plot the Network attribute y_vswr component vs frequency.

plot_z_arcl

plot the Network attribute z_arcl component vs frequency.

plot_z_arcl_unwrap

plot the Network attribute z_arcl_unwrap component vs frequency.

plot_z_complex

plot the Network attribute {} vs frequency.

plot_z_db

plot the Network attribute z_db component vs frequency.

plot_z_db10

plot the Network attribute z_db10 component vs frequency.

plot_z_deg

plot the Network attribute z_deg component vs frequency.

plot_z_deg_unwrap

plot the Network attribute z_deg_unwrap component vs frequency.

plot_z_im

plot the Network attribute z_im component vs frequency.

plot_z_mag

plot the Network attribute z_mag component vs frequency.

plot_z_polar

plot the Network attribute {} vs frequency.

plot_z_rad

plot the Network attribute z_rad component vs frequency.

plot_z_rad_unwrap

plot the Network attribute z_rad_unwrap component vs frequency.

plot_z_re

plot the Network attribute z_re component vs frequency.

plot_z_time

plot the Network attribute z_time component vs time.

plot_z_time_db

plot the Network attribute z_time_db component vs time.

plot_z_time_impulse

plot the Network attribute z_time_impulse component vs time.

plot_z_time_mag

plot the Network attribute z_time_mag component vs time.

plot_z_time_step

plot the Network attribute z_time_step component vs time.

plot_z_vswr

plot the Network attribute z_vswr component vs frequency.

read

Read a Network from a 'ntwk' file.

read_touchstone

Load values from a touchstone file.

renormalize

Renormalize s-parameter matrix given a new port impedances.

renumber

Renumber ports of a Network (inplace).

renumbered

Return a renumbered Network, leave self alone.

resample

Interpolate the current Network along frequency axis (inplace).

rotate

Rotate S-parameters

s_active

Returns the active s-parameters of the network for a defined wave excitation a.

se2gmm

Transform network from single ended parameters to generalized mixed mode parameters [#]_.

set_noise_a

Set the "A" (ie cascade) representation of the correlation matrix, based on the noise frequency and input parameters.

stability_circle

Returns loci of stability circles for a given port (0 or 1).

step_response

Calculate time-domain step response of one-port.

subnetwork

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

time_gate

Time gate this Network.

to_dataframe

Convert attributes of a Network to a pandas DataFrame.

vswr_active

Return the active VSWR of the network for a defined wave excitation a.

windowed

Return a windowed version of s-matrix.

write

Write the Network to disk using the pickle module.

write_spreadsheet

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

write_to_json_string

Serialize and convert network to a JSON string.

write_touchstone

Write a contents of the Network to a touchstone file.

y_active

Return the active Y-parameters of the network for a defined wave excitation a.

z_active

Return the active Z-parameters of the network for a defined wave excitation a.

zipped_touchstone

Read a Network from a Touchstone file in a ziparchive.