skrf.network.Network.__init__

Network.__init__(file=None, name=None, comments=None, f_unit=None, s_def='power', **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)

    • pickled Network (.ntwk, .p) see write()

  • name (str) – Name of this Network. if None will try to use file, if its a str

  • comments (str) – 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.

  • f_unit (Optional[str]) –

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])

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