skrf.vectorFitting.VectorFitting.write_npz

VectorFitting.write_npz(path)[source]

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

Parameters:

path (str) – Target path without filename for the export. The filename will be added automatically based on the network name in network

Return type:

None

See also

read_npz

Reads all model parameters from a .npz file

Examples

Load and fit the Network, then export the model parameters to a .npz file:

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

The filename depends on the network name stored in nw_3port.name and will have the prefix coefficients_, for example coefficients_my3port.npz. The coefficients can then be read using NumPy’s load() function:

>>> coeffs = numpy.load('./data/coefficients_my3port.npz')
>>> poles = coeffs['poles']
>>> residues = coeffs['residues']
>>> prop_coeffs = coeffs['proportionals']
>>> constants = coeffs['constants']

Alternatively, the coefficients can be read directly into a new instance of VectorFitting, see read_npz().