skrf.vectorFitting.VectorFitting.read_npz

VectorFitting.read_npz(file)[source]

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

Parameters:

file (str) – NumPy .npz file containing the parameters. See notes.

Return type:

None

Raises:

ValueError – If the shapes of the coefficient arrays in the provided file are not compatible.

Notes

The .npz file needs to include the model parameters as individual NumPy arrays (ndarray) labeled ‘poles’, ‘residues’, ‘proportionals’ and ‘constants’. The shapes of those arrays need to match the network properties in network (correct number of ports). Preferably, the .npz file was created by write_npz().

See also

write_npz

Writes all model parameters to a .npz file

Examples

Create an empty VectorFitting instance (with or without the fitted Network) and load the model parameters:

>>> vf = skrf.VectorFitting(None)
>>> vf.read_npz('./data/coefficients_my3port.npz')

This can be useful to analyze or process a previous vector fit instead of fitting it again, which sometimes takes a long time. For example, the model passivity can be evaluated and enforced:

>>> vf.passivity_enforce()