skrf.vectorFitting.VectorFitting

class skrf.vectorFitting.VectorFitting(network)[source]

This class provides a Python implementation of the Vector Fitting algorithm and various functions for the fit analysis, passivity evaluation and enforcement, and export of SPICE equivalent circuits.

Parameters

network (skrf.network.Network) – Network instance of the \(N\)-port holding the frequency responses to be fitted, for example a scattering, impedance or admittance matrix.

Examples

Load the Network, create a VectorFitting instance, perform the fit with a given number of real and complex-conjugate starting poles:

>>> nw_3port = skrf.Network('my3port.s3p')
>>> vf = skrf.VectorFitting(nw_3port)
>>> vf.vector_fit(n_poles_real=1, n_poles_cmplx=4)

Notes

The fitting code is based on the original algorithm 1 and on two improvements for relaxed pole relocation 2 and efficient (fast) solving 3. See also the Vector Fitting website 4 for further information and download of the papers listed below. A Matlab implementation is also available there for reference.

References

1

B. Gustavsen, A. Semlyen, “Rational Approximation of Frequency Domain Responses by Vector Fitting”, IEEE Transactions on Power Delivery, vol. 14, no. 3, pp. 1052-1061, July 1999, DOI: https://doi.org/10.1109/61.772353

2

B. Gustavsen, “Improving the Pole Relocating Properties of Vector Fitting”, IEEE Transactions on Power Delivery, vol. 21, no. 3, pp. 1587-1592, July 2006, DOI: https://doi.org/10.1109/TPWRD.2005.860281

3

D. Deschrijver, M. Mrozowski, T. Dhaene, D. De Zutter, “Marcomodeling of Multiport Systems Using a Fast Implementation of the Vector Fitting Method”, IEEE Microwave and Wireless Components Letters, vol. 18, no. 6, pp. 383-385, June 2008, DOI: https://doi.org/10.1109/LMWC.2008.922585

4

Vector Fitting website: https://www.sintef.no/projectweb/vectorfitting/

Attributes

zeros

Deprecated; Please use residues instead.

poles

Instance variable holding the list of fitted poles.

residues

Instance variable holding the list of fitted residues.

proportional_coeff

Instance variable holding the list of fitted proportional coefficients.

constant_coeff

Instance variable holding the list of fitted constants.

max_iterations

Instance variable specifying the maximum number of iterations for the fitting process and for the passivity enforcement.

max_tol

Instance variable specifying the convergence criterion in terms of relative tolerance.

wall_clock_time

Instance variable holding the wall-clock time (in seconds) consumed by the most recent fitting process with vector_fit().

Methods

__init__

get_model_response

Returns one of the frequency responses \(H_{i+1,j+1}\) of the fitted model \(H\).

get_rms_error

Returns the root-mean-square (rms) error magnitude of the fit, i.e. \(\sqrt{ \mathrm{mean}(|S - S_\mathrm{fit} |^2) }\), either for an individual response \(S_{i+1,j+1}\) or for larger slices of the network.

is_passive

Returns the passivity status of the model as a boolean value.

passivity_enforce

Enforces the passivity of the vector fitted model, if required.

passivity_test

Evaluates the passivity of reciprocal vector fitted models by means of a half-size test matrix [#]_.

plot_convergence

Plots the history of the model residue parameter d_res during the iterative pole relocation process of the vector fitting, which should eventually converge to a fixed value.

plot_passivation

Plots the history of the greatest singular value during the iterative passivity enforcement process, which should eventually converge to a value slightly lower than 1.0 or stop after reaching the maximum number of iterations specified in the class variable max_iterations.

plot_s_db

Plots the magnitude in dB of the scattering parameter response \(S_{i+1,j+1}\) in the fit.

plot_s_deg

Plots the phase in degrees of the scattering parameter response \(S_{i+1,j+1}\) in the fit.

plot_s_deg_unwrap

Plots the unwrapped phase in degrees of the scattering parameter response \(S_{i+1,j+1}\) in the fit.

plot_s_im

Plots the imaginary part of the scattering parameter response \(S_{i+1,j+1}\) in the fit.

plot_s_mag

Plots the magnitude in linear scale of the scattering parameter response \(S_{i+1,j+1}\) in the fit.

plot_s_re

Plots the real part of the scattering parameter response \(S_{i+1,j+1}\) in the fit.

plot_s_singular

Plots the singular values of the vector fitted S-matrix in linear scale.

read_npz

Reads all model parameters poles, residues, proportional_coeff and constant_coeff from a labeled NumPy .npz file.

vector_fit

Main work routine performing the vector fit.

write_npz

Writes the model parameters in poles, residues, proportional_coeff and constant_coeff to a labeled NumPy .npz file.

write_spice_subcircuit_s

Creates an equivalent N-port SPICE subcircuit based on its vector fitted S parameter responses.