skrf.network.Network.from_string

classmethod Network.from_string(data, **kwargs)[source]

Create a Network object from a text string

Parameters:
  • data (str) –

    Touchstone file contents. Supported formats are
    • touchstone file (.s?p) (or .ts)

  • **kwargs

    key word arguments can be used to assign properties of the Network, such as s, f and z0. keyword name can be used to name the Network. keyword params is used to assign parameters to the Network. keyword comments associates comments with the Network. keyword s_def sets the scattering parameter definition. Can be ‘power’,

    ’pseudo’, or ‘traveling’. ‘power’ for power-wave 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.

    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.

Return type:

Network

Examples

From file contents

>>> filepath = 'ntwk1.s2p'
>>> with open(filepath, 'r') as f:
>>>     content = f.read()
>>> n = rf.Network.from_string(content)