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

  • f_unit (str | 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