skrf.network.Network.__init__
- Network.__init__(file=None, name=None, params=None, comments=None, f_unit=None, s_def=None, **kwargs)[source]
Network constructor.
Creates an n-port microwave network from a file or directly from data. If no file or data is given, then an empty Network is created.
- Parameters:
file (str, Path, or file-object) –
- file to load information from. supported formats are:
touchstone file (.s?p) (or .ts)
io.StringIO object (with .name property which contains the file extension, such as myfile.s4p)
pickled Network (.ntwk, .p) see
write()
name (str, optional) – Name of this Network. if None will try to use file, if it is a str
params (dict, optional) – Dictionnary of parameters associated with the Network
comments (str, optional) – Comments associated with the Network
s_def (str -> s_def : can be: 'power', 'pseudo' or 'traveling') – Scattering parameter definition : ‘power’ for power-waves definition, ‘pseudo’ for pseudo-waves definition. ‘traveling’ corresponds to the initial implementation. Default is ‘power’. NB: results are the same for real-valued characteristic impedances.
**kwargs –
key word arguments can be used to assign properties of the Network, such as s, f and z0. keyword encoding can be used to define the Touchstone file encoding. keyword noise_interp_kind used to change the default interpolation
method for noisy networks. Options are ‘linear’, ‘nearest’, ‘nearest-up’, ‘zero’, ‘slinear’, ‘quadratic’, ‘cubic’, ‘previous’, or ‘next’. Review scipy.interpolate.interp_1d for details on each interpolation style. Defaults to ‘linear’.
- keyword noise_fill_value used to change the default interpolation
fill value for noisy networks. Defaults to np.nan.
f_unit (Literal['Hz', 'kHz', 'MHz', 'GHz', 'THz'] | None)
- Return type:
None
Examples
From a touchstone
>>> n = rf.Network('ntwk1.s2p')
From a pickle file
>>> n = rf.Network('ntwk1.ntwk')
Create a blank network, then fill in values
>>> n = rf.Network() >>> freq = rf.Frequency(1, 3, 3, 'GHz') >>> n.frequency, n.s, n.z0 = freq, [1,2,3], [1,2,3]
Directly from values
>>> n = rf.Network(f=[1,2,3], s=[1,2,3], z0=[1,2,3])
Define some parameters associated with the Network
>>> n = rf.Network('ntwk1.s2p', params={'temperature': 25, 'voltage':5})
See also
from_z
init from impedance values
read
read a network from a file
write
write a network to a file, using pickle
write_touchstone
write a network to a touchstone file