skrf.network.Network

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

A n-port electrical network.

For instructions on how to create Network see __init__(). A 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

1

http://en.wikipedia.org/wiki/Two-port_network

Parameters
  • file (str) –

  • name (str) –

  • params (dict) –

  • comments (str) –

  • f_unit (str) –

  • s_def (str) –

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

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

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.

s11

one-port sub-network.

s12

one-port sub-network.

s13

one-port sub-network.

s1_1

one-port sub-network.

s1_2

one-port sub-network.

s1_3

one-port sub-network.

s21

one-port sub-network.

s22

one-port sub-network.

s23

one-port sub-network.

s2_1

one-port sub-network.

s2_2

one-port sub-network.

s2_3

one-port sub-network.

s31

one-port sub-network.

s32

one-port sub-network.

s33

one-port sub-network.

s3_1

one-port sub-network.

s3_2

one-port sub-network.

s3_3

one-port sub-network.

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 parameters

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

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

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

copy

Returns a copy of this Network

copy_from

Copies the contents of another Network into self

copy_subset

Returns 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

Swaps 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

Applies a function parameter matrix, one frequency slice at a time

gmm2se

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

impulse_response

Calculates 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

Returns whether the 2N-port network has n-th order reflection symmetry by checking \(S_{i,i} == S_{j,j}\) for appropriate pair(s) of \(i\) and \(j\).

multiply_noise

multiplies 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 vs frequency.

plot_a_arcl_unwrap

plot the Network attribute a_arcl_unwrap vs frequency.

plot_a_complex

plot the Network attribute a vs frequency.

plot_a_db

plot the Network attribute a_db vs frequency.

plot_a_db10

plot the Network attribute a_db10 vs frequency.

plot_a_deg

plot the Network attribute a_deg vs frequency.

plot_a_deg_unwrap

plot the Network attribute a_deg_unwrap vs frequency.

plot_a_im

plot the Network attribute a_im vs frequency.

plot_a_mag

plot the Network attribute a_mag vs frequency.

plot_a_polar

plot the Network attribute a vs frequency.

plot_a_rad

plot the Network attribute a_rad vs frequency.

plot_a_rad_unwrap

plot the Network attribute a_rad_unwrap vs frequency.

plot_a_re

plot the Network attribute a_re vs frequency.

plot_a_time

plot the Network attribute a_time vs frequency.

plot_a_time_db

plot the Network attribute a_time_db vs frequency.

plot_a_time_impulse

plot the Network attribute a_time_impulse vs frequency.

plot_a_time_mag

plot the Network attribute a_time_mag vs frequency.

plot_a_time_step

plot the Network attribute a_time_step vs frequency.

plot_a_vswr

plot the Network attribute a_vswr vs frequency.

plot_h_arcl

plot the Network attribute h_arcl vs frequency.

plot_h_arcl_unwrap

plot the Network attribute h_arcl_unwrap vs frequency.

plot_h_complex

plot the Network attribute h vs frequency.

plot_h_db

plot the Network attribute h_db vs frequency.

plot_h_db10

plot the Network attribute h_db10 vs frequency.

plot_h_deg

plot the Network attribute h_deg vs frequency.

plot_h_deg_unwrap

plot the Network attribute h_deg_unwrap vs frequency.

plot_h_im

plot the Network attribute h_im vs frequency.

plot_h_mag

plot the Network attribute h_mag vs frequency.

plot_h_polar

plot the Network attribute h vs frequency.

plot_h_rad

plot the Network attribute h_rad vs frequency.

plot_h_rad_unwrap

plot the Network attribute h_rad_unwrap vs frequency.

plot_h_re

plot the Network attribute h_re vs frequency.

plot_h_time

plot the Network attribute h_time vs frequency.

plot_h_time_db

plot the Network attribute h_time_db vs frequency.

plot_h_time_impulse

plot the Network attribute h_time_impulse vs frequency.

plot_h_time_mag

plot the Network attribute h_time_mag vs frequency.

plot_h_time_step

plot the Network attribute h_time_step vs frequency.

plot_h_vswr

plot the Network attribute h_vswr vs frequency.

plot_it_all

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

plot_passivity

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

plot_reciprocity

Plot reciprocity metric.

plot_reciprocity2

Plot reciprocity metric #2.

plot_s_arcl

plot the Network attribute s_arcl vs frequency.

plot_s_arcl_unwrap

plot the Network attribute s_arcl_unwrap vs frequency.

plot_s_complex

plot the Network attribute s vs frequency.

plot_s_db

plot the Network attribute s_db vs frequency.

plot_s_db10

plot the Network attribute s_db10 vs frequency.

plot_s_db_time

plot_s_deg

plot the Network attribute s_deg vs frequency.

plot_s_deg_unwrap

plot the Network attribute s_deg_unwrap vs frequency.

plot_s_im

plot the Network attribute s_im vs frequency.

plot_s_mag

plot the Network attribute s_mag vs frequency.

plot_s_polar

plot the Network attribute s vs frequency.

plot_s_rad

plot the Network attribute s_rad vs frequency.

plot_s_rad_unwrap

plot the Network attribute s_rad_unwrap vs frequency.

plot_s_re

plot the Network attribute s_re vs frequency.

plot_s_smith

plots the scattering parameter on a smith chart

plot_s_time

plot the Network attribute s_time vs frequency.

plot_s_time_db

plot the Network attribute s_time_db vs frequency.

plot_s_time_impulse

plot the Network attribute s_time_impulse vs frequency.

plot_s_time_mag

plot the Network attribute s_time_mag vs frequency.

plot_s_time_step

plot the Network attribute s_time_step vs frequency.

plot_s_vswr

plot the Network attribute s_vswr vs frequency.

plot_t_arcl

plot the Network attribute t_arcl vs frequency.

plot_t_arcl_unwrap

plot the Network attribute t_arcl_unwrap vs frequency.

plot_t_complex

plot the Network attribute t vs frequency.

plot_t_db

plot the Network attribute t_db vs frequency.

plot_t_db10

plot the Network attribute t_db10 vs frequency.

plot_t_deg

plot the Network attribute t_deg vs frequency.

plot_t_deg_unwrap

plot the Network attribute t_deg_unwrap vs frequency.

plot_t_im

plot the Network attribute t_im vs frequency.

plot_t_mag

plot the Network attribute t_mag vs frequency.

plot_t_polar

plot the Network attribute t vs frequency.

plot_t_rad

plot the Network attribute t_rad vs frequency.

plot_t_rad_unwrap

plot the Network attribute t_rad_unwrap vs frequency.

plot_t_re

plot the Network attribute t_re vs frequency.

plot_t_time

plot the Network attribute t_time vs frequency.

plot_t_time_db

plot the Network attribute t_time_db vs frequency.

plot_t_time_impulse

plot the Network attribute t_time_impulse vs frequency.

plot_t_time_mag

plot the Network attribute t_time_mag vs frequency.

plot_t_time_step

plot the Network attribute t_time_step vs frequency.

plot_t_vswr

plot the Network attribute t_vswr vs frequency.

plot_y_arcl

plot the Network attribute y_arcl vs frequency.

plot_y_arcl_unwrap

plot the Network attribute y_arcl_unwrap vs frequency.

plot_y_complex

plot the Network attribute y vs frequency.

plot_y_db

plot the Network attribute y_db vs frequency.

plot_y_db10

plot the Network attribute y_db10 vs frequency.

plot_y_deg

plot the Network attribute y_deg vs frequency.

plot_y_deg_unwrap

plot the Network attribute y_deg_unwrap vs frequency.

plot_y_im

plot the Network attribute y_im vs frequency.

plot_y_mag

plot the Network attribute y_mag vs frequency.

plot_y_polar

plot the Network attribute y vs frequency.

plot_y_rad

plot the Network attribute y_rad vs frequency.

plot_y_rad_unwrap

plot the Network attribute y_rad_unwrap vs frequency.

plot_y_re

plot the Network attribute y_re vs frequency.

plot_y_time

plot the Network attribute y_time vs frequency.

plot_y_time_db

plot the Network attribute y_time_db vs frequency.

plot_y_time_impulse

plot the Network attribute y_time_impulse vs frequency.

plot_y_time_mag

plot the Network attribute y_time_mag vs frequency.

plot_y_time_step

plot the Network attribute y_time_step vs frequency.

plot_y_vswr

plot the Network attribute y_vswr vs frequency.

plot_z_arcl

plot the Network attribute z_arcl vs frequency.

plot_z_arcl_unwrap

plot the Network attribute z_arcl_unwrap vs frequency.

plot_z_complex

plot the Network attribute z vs frequency.

plot_z_db

plot the Network attribute z_db vs frequency.

plot_z_db10

plot the Network attribute z_db10 vs frequency.

plot_z_deg

plot the Network attribute z_deg vs frequency.

plot_z_deg_unwrap

plot the Network attribute z_deg_unwrap vs frequency.

plot_z_im

plot the Network attribute z_im vs frequency.

plot_z_mag

plot the Network attribute z_mag vs frequency.

plot_z_polar

plot the Network attribute z vs frequency.

plot_z_rad

plot the Network attribute z_rad vs frequency.

plot_z_rad_unwrap

plot the Network attribute z_rad_unwrap vs frequency.

plot_z_re

plot the Network attribute z_re vs frequency.

plot_z_time

plot the Network attribute z_time vs frequency.

plot_z_time_db

plot the Network attribute z_time_db vs frequency.

plot_z_time_impulse

plot the Network attribute z_time_impulse vs frequency.

plot_z_time_mag

plot the Network attribute z_time_mag vs frequency.

plot_z_time_step

plot the Network attribute z_time_step vs frequency.

plot_z_vswr

plot the Network attribute z_vswr vs frequency.

read

Read a Network from a 'ntwk' file

read_touchstone

loads values from a touchstone file.

renormalize

Renormalize s-parameter matrix given a new port impedances.

renumber

Renumbers ports of a Network (inplace).

renumbered

Returns 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

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

step_response

Calculates time-domain step response of one-port.

subnetwork

Returns 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

Returns 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

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

z_active

Returns 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